1/* snams.c 2 Get all known system names. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 21 22 The author of the program may be contacted at ian@airs.com. 23 */ 24 25#include "uucnfi.h" 26 27#if USE_RCS_ID 28const char _uuconf_snams_rcsid[] = "$Id: snams.c,v 1.6 2002/03/05 19:10:42 ian Rel $"; 29#endif 30 31/* Get all known system names. */ 32 33int 34uuconf_system_names (pglobal, ppzsystems, falias) 35 pointer pglobal; 36 char ***ppzsystems; 37 int falias; 38{ 39 struct sglobal *qglobal = (struct sglobal *) pglobal; 40 char **pztaylor; 41 char **pzv2; 42 char **pzhdb; 43 int iret; 44 45 *ppzsystems = NULL; 46 pztaylor = NULL; 47 pzv2 = NULL; 48 pzhdb = NULL; 49 50#if HAVE_TAYLOR_CONFIG 51 iret = uuconf_taylor_system_names (pglobal, &pztaylor, falias); 52 if (iret != UUCONF_SUCCESS) 53 return iret; 54#endif 55 56#if HAVE_V2_CONFIG 57 if (qglobal->qprocess->fv2) 58 { 59 iret = uuconf_v2_system_names (pglobal, &pzv2, falias); 60 if (iret != UUCONF_SUCCESS) 61 return iret; 62 } 63#endif 64 65#if HAVE_HDB_CONFIG 66 if (qglobal->qprocess->fhdb) 67 { 68 iret = uuconf_hdb_system_names (pglobal, &pzhdb, falias); 69 if (iret != UUCONF_SUCCESS) 70 return iret; 71 } 72#endif 73 74 if (pzv2 == NULL && pzhdb == NULL) 75 *ppzsystems = pztaylor; 76 else if (pztaylor == NULL && pzhdb == NULL) 77 *ppzsystems = pzv2; 78 else if (pztaylor == NULL && pzv2 == NULL) 79 *ppzsystems = pzhdb; 80 else 81 { 82 char **pz; 83 84 iret = UUCONF_SUCCESS; 85 86 if (pztaylor != NULL) 87 { 88 for (pz = pztaylor; *pz != NULL; pz++) 89 { 90 iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE, 91 ppzsystems, (pointer) NULL); 92 if (iret != UUCONF_SUCCESS) 93 break; 94 } 95 } 96 97 if (pzv2 != NULL && iret == UUCONF_SUCCESS) 98 { 99 for (pz = pzv2; *pz != NULL; pz++) 100 { 101 iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE, 102 ppzsystems, (pointer) NULL); 103 if (iret != UUCONF_SUCCESS) 104 break; 105 } 106 } 107 108 if (pzhdb != NULL && iret == UUCONF_SUCCESS) 109 { 110 for (pz = pzhdb; *pz != NULL; pz++) 111 { 112 iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE, 113 ppzsystems, (pointer) NULL); 114 if (iret != UUCONF_SUCCESS) 115 break; 116 } 117 } 118 119 if (pztaylor != NULL) 120 free ((pointer) pztaylor); 121 if (pzv2 != NULL) 122 free ((pointer) pzv2); 123 if (pzhdb != NULL) 124 free ((pointer) pzhdb); 125 } 126 127 if (iret == UUCONF_SUCCESS && *ppzsystems == NULL) 128 iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE, 129 ppzsystems, (pointer) NULL); 130 131 return iret; 132} 133