Annotation of coherent/g/usr/lib/uucp/tay104/uuconf/vsnams.c, revision 1.1

1.1     ! root        1: /* vsnams.c
        !             2:    Get all known system names from the 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_vsnams_rcsid[] = "$Id: vsnams.c,v 1.1 93/07/30 08:08:23 bin Exp Locker: bin $";
        !            30: #endif
        !            31: 
        !            32: #include <errno.h>
        !            33: 
        !            34: /* Get all the system names from the V2 L.sys file.  This code does
        !            35:    not support aliases, although some V2 versions do have an L-aliases
        !            36:    file.  */
        !            37: 
        !            38: /*ARGSUSED*/
        !            39: int
        !            40: uuconf_v2_system_names (pglobal, ppzsystems, falias)
        !            41:      pointer pglobal;
        !            42:      char ***ppzsystems;
        !            43:      int falias;
        !            44: {
        !            45:   struct sglobal *qglobal = (struct sglobal *) pglobal;
        !            46:   FILE *e;
        !            47:   int iret;
        !            48:   char *zline;
        !            49:   size_t cline;
        !            50: 
        !            51:   *ppzsystems = NULL;
        !            52: 
        !            53:   e = fopen (qglobal->qprocess->zv2systems, "r");
        !            54:   if (e == NULL)
        !            55:     {
        !            56:       if (FNO_SUCH_FILE ())
        !            57:        return _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
        !            58:                                    ppzsystems, (pointer) NULL);
        !            59:       qglobal->ierrno = errno;
        !            60:       qglobal->zfilename = qglobal->qprocess->zv2systems;
        !            61:       return (UUCONF_FOPEN_FAILED
        !            62:              | UUCONF_ERROR_ERRNO
        !            63:              | UUCONF_ERROR_FILENAME);
        !            64:     }
        !            65: 
        !            66:   qglobal->ilineno = 0;
        !            67:   iret = UUCONF_SUCCESS;
        !            68: 
        !            69:   zline = NULL;
        !            70:   cline = 0;
        !            71:   while (getline (&zline, &cline, e) > 0)
        !            72:     {
        !            73:       char *zname;
        !            74: 
        !            75:       ++qglobal->ilineno;
        !            76: 
        !            77:       /* Skip leading whitespace to get to the system name.  Then cut
        !            78:         the system name off at the first whitespace, comment, or
        !            79:         newline.  */
        !            80:       zname = zline + strspn (zline, " \t");
        !            81:       zname[strcspn (zname, " \t#\n")] = '\0';
        !            82:       if (*zname == '\0')
        !            83:        continue;
        !            84: 
        !            85:       iret = _uuconf_iadd_string (qglobal, zname, TRUE, TRUE, ppzsystems,
        !            86:                                  (pointer) NULL);
        !            87:       if (iret != UUCONF_SUCCESS)
        !            88:        break;
        !            89:     }
        !            90: 
        !            91:   (void) fclose (e);
        !            92:   if (zline != NULL)
        !            93:     free ((pointer) zline);
        !            94: 
        !            95:   if (iret != UUCONF_SUCCESS)
        !            96:     {
        !            97:       qglobal->zfilename = qglobal->qprocess->zv2systems;
        !            98:       return iret | UUCONF_ERROR_FILENAME | UUCONF_ERROR_LINENO;
        !            99:     }
        !           100: 
        !           101:   if (*ppzsystems == NULL)
        !           102:     iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
        !           103:                                ppzsystems, (pointer) NULL);
        !           104: 
        !           105:   return iret;
        !           106: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.