2 Initialize the global information structure.
4 Copyright (C) 1992, 1994, 1995 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_iniglb_rcsid[] = "$FreeBSD$";
34 /* Initialize the global information structure. */
37 _uuconf_iinit_global (pqglobal)
38 struct sglobal **pqglobal;
41 register struct sprocess *qprocess;
45 pblock = uuconf_malloc_block ();
47 return UUCONF_MALLOC_FAILED;
49 *pqglobal = (struct sglobal *) uuconf_malloc (pblock,
50 sizeof (struct sglobal));
51 if (*pqglobal == NULL)
53 uuconf_free_block (pblock);
54 return UUCONF_MALLOC_FAILED;
57 (*pqglobal)->qprocess = ((struct sprocess *)
58 uuconf_malloc (pblock,
59 sizeof (struct sprocess)));
60 if ((*pqglobal)->qprocess == NULL)
62 uuconf_free_block (pblock);
64 return UUCONF_MALLOC_FAILED;
67 (*pqglobal)->pblock = pblock;
68 (*pqglobal)->ierrno = 0;
69 (*pqglobal)->ilineno = 0;
70 (*pqglobal)->zfilename = NULL;
72 qprocess = (*pqglobal)->qprocess;
74 qprocess->zlocalname = NULL;
75 qprocess->zspooldir = SPOOLDIR;
76 qprocess->zpubdir = PUBDIR;
78 qprocess->zlockdir = LOCKDIR;
80 qprocess->zlockdir = SPOOLDIR;
82 qprocess->zlogfile = LOGFILE;
83 qprocess->zstatsfile = STATFILE;
84 qprocess->zdebugfile = DEBUGFILE;
85 qprocess->zdebug = "";
86 qprocess->fstrip_login = TRUE;
87 qprocess->fstrip_proto = TRUE;
88 qprocess->cmaxuuxqts = 0;
89 qprocess->zrunuuxqt = NULL;
91 qprocess->fhdb = TRUE;
92 qprocess->pzdialcodefiles = NULL;
93 qprocess->pztimetables = NULL;
94 qprocess->zconfigfile = NULL;
95 qprocess->pzsysfiles = NULL;
96 qprocess->pzportfiles = NULL;
97 qprocess->pzdialfiles = NULL;
98 qprocess->pzpwdfiles = NULL;
99 qprocess->pzcallfiles = NULL;
100 qprocess->qunknown = NULL;
101 qprocess->fread_syslocs = FALSE;
102 qprocess->qsyslocs = NULL;
103 qprocess->qvalidate = NULL;
104 qprocess->fuses_myname = FALSE;
105 qprocess->zv2systems = NULL;
106 qprocess->zv2devices = NULL;
107 qprocess->zv2userfile = NULL;
108 qprocess->zv2cmds = NULL;
109 qprocess->pzhdb_systems = NULL;
110 qprocess->pzhdb_devices = NULL;
111 qprocess->pzhdb_dialers = NULL;
112 qprocess->fhdb_read_permissions = FALSE;
113 qprocess->qhdb_permissions = NULL;
116 azargs[1] = (char *) "Evening";
117 azargs[2] = (char *) "Wk1705-0755,Sa,Su";
118 iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs,
119 (pointer) NULL, (pointer) NULL);
120 if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS)
122 azargs[1] = (char *) "Night";
123 azargs[2] = (char *) "Wk2305-0755,Sa,Su2305-1655";
124 iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs,
125 (pointer) NULL, (pointer) NULL);
127 if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS)
129 azargs[1] = (char *) "NonPeak";
130 azargs[2] = (char *) "Wk1805-0655,Sa,Su";
131 iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs,
132 (pointer) NULL, (pointer) NULL);
134 if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS)
136 uuconf_free_block (pblock);
139 /* Strip off any special bits, since there's no global
141 return UUCONF_ERROR_VALUE (iret);
144 return UUCONF_SUCCESS;
147 /* Add a timetable. This is also called by the Taylor UUCP
148 initialization code, as well as by the Taylor UUCP sys file code
149 (although the latter is obsolete). There's no point in putting
150 this in a separate file, since everything must call
151 _uuconf_init_global. There is a race condition here if this is
152 called by two different threads on a sys file command, but the sys
153 file command is obsolete anyhow. */
157 _uuconf_itimetable (pglobal, argc, argv, pvar, pinfo)
164 struct sglobal *qglobal = (struct sglobal *) pglobal;
167 iret = _uuconf_iadd_string (qglobal, argv[1], FALSE, FALSE,
168 &qglobal->qprocess->pztimetables,
170 if (iret != UUCONF_SUCCESS)
171 return iret | UUCONF_CMDTABRET_EXIT;
173 iret = _uuconf_iadd_string (qglobal, argv[2], FALSE, FALSE,
174 &qglobal->qprocess->pztimetables,
176 if (iret != UUCONF_SUCCESS)
177 return iret | UUCONF_CMDTABRET_EXIT;
179 return UUCONF_CMDTABRET_KEEP;