2 Initialize for reading V2 configuration files.
4 Copyright (C) 1992 Ian Lance Taylor
6 This file is part of the Taylor UUCP uuconf library.
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public License
10 as published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 The author of the program may be contacted at ian@airs.com or
23 c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
29 const char _uuconf_vinit_rcsid[] = "$FreeBSD$";
34 static int ivinlib P((struct sglobal *qglobal, const char *z, size_t csize,
37 /* Return an allocated buffer holding a file name in OLDCONFIGLIB.
38 The c argument is the size of z including the trailing null byte,
39 since this is convenient for both the caller and this function. */
42 ivinlib (qglobal, z, c, pz)
43 struct sglobal *qglobal;
50 zalc = uuconf_malloc (qglobal->pblock, sizeof OLDCONFIGLIB - 1 + c);
53 qglobal->ierrno = errno;
54 return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
57 memcpy ((pointer) zalc, (pointer) OLDCONFIGLIB,
58 sizeof OLDCONFIGLIB - 1);
59 memcpy ((pointer) (zalc + sizeof OLDCONFIGLIB - 1), (pointer) z, c);
63 return UUCONF_SUCCESS;
66 /* Initialize the routines which read V2 configuration files. The
67 only thing we do here is allocate the file names. */
70 uuconf_v2_init (ppglobal)
73 struct sglobal **pqglobal = (struct sglobal **) ppglobal;
75 struct sglobal *qglobal;
78 if (*pqglobal == NULL)
80 iret = _uuconf_iinit_global (pqglobal);
81 if (iret != UUCONF_SUCCESS)
87 iret = ivinlib (qglobal, V2_SYSTEMS, sizeof V2_SYSTEMS,
88 &qglobal->qprocess->zv2systems);
89 if (iret != UUCONF_SUCCESS)
91 iret = ivinlib (qglobal, V2_DEVICES, sizeof V2_DEVICES,
92 &qglobal->qprocess->zv2devices);
93 if (iret != UUCONF_SUCCESS)
95 iret = ivinlib (qglobal, V2_USERFILE, sizeof V2_USERFILE,
96 &qglobal->qprocess->zv2userfile);
97 if (iret != UUCONF_SUCCESS)
99 iret = ivinlib (qglobal, V2_CMDS, sizeof V2_CMDS,
100 &qglobal->qprocess->zv2cmds);
101 if (iret != UUCONF_SUCCESS)
104 iret = ivinlib (qglobal, V2_DIALCODES, sizeof V2_DIALCODES,
106 if (iret != UUCONF_SUCCESS)
109 return _uuconf_iadd_string (qglobal, zdialcodes, FALSE, FALSE,
110 &qglobal->qprocess->pzdialcodefiles,