|
|
1.1 root 1: /* vinit.c
2: Initialize for reading V2 configuration files.
3:
4: Copyright (C) 1992 Ian Lance Taylor
5:
6: This file is part of the Taylor UUCP uuconf library.
7:
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.
12:
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.
17:
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21:
22: The author of the program may be contacted at [email protected] or
23: c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
24: */
25:
26: #include "uucnfi.h"
27:
28: #if USE_RCS_ID
29: const char _uuconf_vinit_rcsid[] = "$Id: vinit.c,v 1.1 93/07/30 08:08:20 bin Exp Locker: bin $";
30: #endif
31:
32: #include <errno.h>
33:
34: static int ivinlib P((struct sglobal *qglobal, const char *z, size_t csize,
35: char **pz));
36:
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. */
40:
41: static int
42: ivinlib (qglobal, z, c, pz)
43: struct sglobal *qglobal;
44: const char *z;
45: size_t c;
46: char **pz;
47: {
48: char *zalc;
49:
50: zalc = uuconf_malloc (qglobal->pblock, sizeof OLDCONFIGLIB - 1 + c);
51: if (zalc == NULL)
52: {
53: qglobal->ierrno = errno;
54: return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
55: }
56:
57: memcpy ((pointer) zalc, (pointer) OLDCONFIGLIB,
58: sizeof OLDCONFIGLIB - 1);
59: memcpy ((pointer) (zalc + sizeof OLDCONFIGLIB - 1), (pointer) z, c);
60:
61: *pz = zalc;
62:
63: return UUCONF_SUCCESS;
64: }
65:
66: /* Initialize the routines which read V2 configuration files. The
67: only thing we do here is allocate the file names. */
68:
69: int
70: uuconf_v2_init (ppglobal)
71: pointer *ppglobal;
72: {
73: struct sglobal **pqglobal = (struct sglobal **) ppglobal;
74: int iret;
75: struct sglobal *qglobal;
76: char *zdialcodes;
77:
78: if (*pqglobal == NULL)
79: {
80: iret = _uuconf_iinit_global (pqglobal);
81: if (iret != UUCONF_SUCCESS)
82: return iret;
83: }
84:
85: qglobal = *pqglobal;
86:
87: iret = ivinlib (qglobal, V2_SYSTEMS, sizeof V2_SYSTEMS,
88: &qglobal->qprocess->zv2systems);
89: if (iret != UUCONF_SUCCESS)
90: return iret;
91: iret = ivinlib (qglobal, V2_DEVICES, sizeof V2_DEVICES,
92: &qglobal->qprocess->zv2devices);
93: if (iret != UUCONF_SUCCESS)
94: return iret;
95: iret = ivinlib (qglobal, V2_USERFILE, sizeof V2_USERFILE,
96: &qglobal->qprocess->zv2userfile);
97: if (iret != UUCONF_SUCCESS)
98: return iret;
99: iret = ivinlib (qglobal, V2_CMDS, sizeof V2_CMDS,
100: &qglobal->qprocess->zv2cmds);
101: if (iret != UUCONF_SUCCESS)
102: return iret;
103:
104: iret = ivinlib (qglobal, V2_DIALCODES, sizeof V2_DIALCODES,
105: &zdialcodes);
106: if (iret != UUCONF_SUCCESS)
107: return iret;
108:
109: return _uuconf_iadd_string (qglobal, zdialcodes, FALSE, FALSE,
110: &qglobal->qprocess->pzdialcodefiles,
111: qglobal->pblock);
112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.