4 Copyright (C) 1992, 1993 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_diacod_rcsid[] = "$Id$";
34 static int idcode P((pointer pglobal, int argc, char **argv,
35 pointer pinfo, pointer pvar));
37 /* Get the name of the UUCP log file. */
40 uuconf_dialcode (pglobal, zdial, pznum)
45 struct sglobal *qglobal = (struct sglobal *) pglobal;
46 struct uuconf_cmdtab as[2];
50 as[0].uuconf_zcmd = zdial;
51 as[0].uuconf_itype = UUCONF_CMDTABTYPE_FN | 0;
52 as[0].uuconf_pvar = (pointer) pznum;
53 as[0].uuconf_pifn = idcode;
55 as[1].uuconf_zcmd = NULL;
59 iret = UUCONF_SUCCESS;
61 for (pz = qglobal->qprocess->pzdialcodefiles; *pz != NULL; pz++)
70 qglobal->ierrno = errno;
71 iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
75 iret = uuconf_cmd_file (pglobal, e, as, (pointer) NULL,
76 (uuconf_cmdtabfn) NULL, 0, (pointer) NULL);
79 if (iret != UUCONF_SUCCESS || *pznum != NULL)
83 if (iret != UUCONF_SUCCESS)
85 qglobal->zfilename = *pz;
86 iret |= UUCONF_ERROR_FILENAME;
88 else if (*pznum == NULL)
89 iret = UUCONF_NOT_FOUND;
94 /* This is called if the dialcode is found. It copies the number into
95 the heap and gets out of reading the file. */
99 idcode (pglobal, argc, argv, pvar, pinfo)
106 struct sglobal *qglobal = (struct sglobal *) pglobal;
107 char **pznum = (char **) pvar;
116 *pznum = strdup (argv[1]);
118 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
122 qglobal->ierrno = errno;
123 return (UUCONF_MALLOC_FAILED
125 | UUCONF_CMDTABRET_EXIT);
128 return UUCONF_CMDTABRET_EXIT;