|
|
1.1 ! root 1: /* iniglb.c ! 2: Initialize the global information structure. ! 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_iniglb_rcsid[] = "$Id: iniglb.c,v 1.1 93/07/30 08:07:21 bin Exp Locker: bin $"; ! 30: #endif ! 31: ! 32: #include <errno.h> ! 33: ! 34: /* Initialize the global information structure. */ ! 35: ! 36: int ! 37: _uuconf_iinit_global (pqglobal) ! 38: struct sglobal **pqglobal; ! 39: { ! 40: pointer pblock; ! 41: register struct sprocess *qprocess; ! 42: char *azargs[3]; ! 43: int iret; ! 44: ! 45: pblock = uuconf_malloc_block (); ! 46: if (pblock == NULL) ! 47: return UUCONF_MALLOC_FAILED; ! 48: ! 49: *pqglobal = (struct sglobal *) uuconf_malloc (pblock, ! 50: sizeof (struct sglobal)); ! 51: if (*pqglobal == NULL) ! 52: { ! 53: uuconf_free_block (pblock); ! 54: return UUCONF_MALLOC_FAILED; ! 55: } ! 56: ! 57: (*pqglobal)->qprocess = ((struct sprocess *) ! 58: uuconf_malloc (pblock, ! 59: sizeof (struct sprocess))); ! 60: if ((*pqglobal)->qprocess == NULL) ! 61: { ! 62: uuconf_free_block (pblock); ! 63: *pqglobal = NULL; ! 64: return UUCONF_MALLOC_FAILED; ! 65: } ! 66: ! 67: (*pqglobal)->pblock = pblock; ! 68: (*pqglobal)->ierrno = 0; ! 69: (*pqglobal)->ilineno = 0; ! 70: (*pqglobal)->zfilename = NULL; ! 71: ! 72: qprocess = (*pqglobal)->qprocess; ! 73: ! 74: qprocess->zlocalname = NULL; ! 75: qprocess->zspooldir = SPOOLDIR; ! 76: qprocess->zpubdir = PUBDIR; ! 77: #ifdef LOCKDIR ! 78: qprocess->zlockdir = LOCKDIR; ! 79: #else ! 80: qprocess->zlockdir = SPOOLDIR; ! 81: #endif ! 82: qprocess->zlogfile = LOGFILE; ! 83: qprocess->zstatsfile = STATFILE; ! 84: qprocess->zdebugfile = DEBUGFILE; ! 85: qprocess->zdebug = ""; ! 86: qprocess->cmaxuuxqts = 0; ! 87: qprocess->fv2 = TRUE; ! 88: qprocess->fhdb = TRUE; ! 89: qprocess->pzdialcodefiles = NULL; ! 90: qprocess->pztimetables = NULL; ! 91: qprocess->zconfigfile = NULL; ! 92: qprocess->pzsysfiles = NULL; ! 93: qprocess->pzportfiles = NULL; ! 94: qprocess->pzdialfiles = NULL; ! 95: qprocess->pzpwdfiles = NULL; ! 96: qprocess->pzcallfiles = NULL; ! 97: qprocess->qunknown = NULL; ! 98: qprocess->fread_syslocs = FALSE; ! 99: qprocess->qsyslocs = NULL; ! 100: qprocess->qvalidate = NULL; ! 101: qprocess->fuses_myname = FALSE; ! 102: qprocess->zv2systems = NULL; ! 103: qprocess->zv2devices = NULL; ! 104: qprocess->zv2userfile = NULL; ! 105: qprocess->zv2cmds = NULL; ! 106: qprocess->pzhdb_systems = NULL; ! 107: qprocess->pzhdb_devices = NULL; ! 108: qprocess->pzhdb_dialers = NULL; ! 109: qprocess->fhdb_read_permissions = FALSE; ! 110: qprocess->qhdb_permissions = NULL; ! 111: ! 112: azargs[0] = NULL; ! 113: azargs[1] = (char *) "Evening"; ! 114: azargs[2] = (char *) "Wk1705-0755,Sa,Su"; ! 115: iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs, ! 116: (pointer) NULL, (pointer) NULL); ! 117: if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS) ! 118: { ! 119: azargs[1] = (char *) "Night"; ! 120: azargs[2] = (char *) "Wk2305-0755,Sa,Su2305-1655"; ! 121: iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs, ! 122: (pointer) NULL, (pointer) NULL); ! 123: } ! 124: if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS) ! 125: { ! 126: azargs[1] = (char *) "NonPeak"; ! 127: azargs[2] = (char *) "Wk1805-0655,Sa,Su"; ! 128: iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs, ! 129: (pointer) NULL, (pointer) NULL); ! 130: } ! 131: if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS) ! 132: { ! 133: uuconf_free_block (pblock); ! 134: *pqglobal = NULL; ! 135: ! 136: /* Strip off any special bits, since there's no global ! 137: structure. */ ! 138: return UUCONF_ERROR_VALUE (iret); ! 139: } ! 140: ! 141: return UUCONF_SUCCESS; ! 142: } ! 143: ! 144: /* Add a timetable. This is also called by the Taylor UUCP ! 145: initialization code, as well as by the Taylor UUCP sys file code ! 146: (although the latter is obsolete). There's no point in putting ! 147: this in a separate file, since everything must call ! 148: _uuconf_init_global. There is a race condition here if this is ! 149: called by two different threads on a sys file command, but the sys ! 150: file command is obsolete anyhow. */ ! 151: ! 152: /*ARGSUSED*/ ! 153: int ! 154: _uuconf_itimetable (pglobal, argc, argv, pvar, pinfo) ! 155: pointer pglobal; ! 156: int argc; ! 157: char **argv; ! 158: pointer pvar; ! 159: pointer pinfo; ! 160: { ! 161: struct sglobal *qglobal = (struct sglobal *) pglobal; ! 162: int iret; ! 163: ! 164: iret = _uuconf_iadd_string (qglobal, argv[1], FALSE, FALSE, ! 165: &qglobal->qprocess->pztimetables, ! 166: qglobal->pblock); ! 167: if (iret != UUCONF_SUCCESS) ! 168: return iret | UUCONF_CMDTABRET_EXIT; ! 169: ! 170: iret = _uuconf_iadd_string (qglobal, argv[2], FALSE, FALSE, ! 171: &qglobal->qprocess->pztimetables, ! 172: qglobal->pblock); ! 173: if (iret != UUCONF_SUCCESS) ! 174: return iret | UUCONF_CMDTABRET_EXIT; ! 175: ! 176: return UUCONF_CMDTABRET_KEEP; ! 177: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.