|
|
1.1 root 1: /* tsnams.c
2: Get all known system names from the Taylor UUCP 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_tsnams_rcsid[] = "$Id: tsnams.c,v 1.1 93/07/30 08:08:09 bin Exp Locker: bin $";
30: #endif
31:
32: /* Get all the system names from the Taylor UUCP configuration files.
33: These were actually already recorded by uuconf_taylor_init, so this
34: function is pretty simple. */
35:
36: int
37: uuconf_taylor_system_names (pglobal, ppzsystems, falias)
38: pointer pglobal;
39: char ***ppzsystems;
40: int falias;
41: {
42: struct sglobal *qglobal = (struct sglobal *) pglobal;
43: int iret;
44: register struct stsysloc *q;
45: char **pz;
46: int c, i;
47:
48: if (! qglobal->qprocess->fread_syslocs)
49: {
50: iret = _uuconf_iread_locations (qglobal);
51: if (iret != UUCONF_SUCCESS)
52: return iret;
53: }
54:
55: *ppzsystems = NULL;
56: c = 0;
57:
58: for (q = qglobal->qprocess->qsyslocs; q != NULL; q = q->qnext)
59: {
60: if (! falias && q->falias)
61: continue;
62:
63: iret = _uuconf_iadd_string (qglobal, (char *) q->zname, TRUE, FALSE,
64: ppzsystems, (pointer) NULL);
65: if (iret != UUCONF_SUCCESS)
66: return iret;
67: ++c;
68: }
69:
70: /* The order of the qSyslocs list is reversed from the list in the
71: configuration files. Reverse the returned list in order to make
72: uuname output more intuitive. */
73: pz = *ppzsystems;
74: for (i = c / 2 - 1; i >= 0; i--)
75: {
76: char *zhold;
77:
78: zhold = pz[i];
79: pz[i] = pz[c - i - 1];
80: pz[c - i - 1] = zhold;
81: }
82:
83: return UUCONF_SUCCESS;
84: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.