2 Get information about a system from the Taylor UUCP configuration files.
4 Copyright (C) 1992, 1993, 1995 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_tsinfo_rcsid[] = "$Id$";
39 static void uiset_call P((struct uuconf_system *qsys));
40 static int iisizecmp P((long i1, long i2));
42 /* Local functions needed to parse the system information file. */
45 static int z P((pointer, int, char **, pointer, pointer))
49 CMDTABFN (iialternate);
50 CMDTABFN (iidefault_alternates);
52 CMDTABFN (iitimegrade);
54 CMDTABFN (iibaud_range);
58 CMDTABFN (iicalled_login);
59 CMDTABFN (iiproto_param);
61 CMDTABFN (iitransfer);
67 /* We have to pass a fair amount of information in and out of the
68 various system commands. Using global variables would make the
69 code non-reentrant, so we instead pass a pointer to single
70 structure as the pinfo argument to the system commands. */
74 /* The system information we're building up. */
75 struct uuconf_system *qsys;
76 /* Whether any alternates have been used. */
78 /* A list of the previous alternates. */
79 struct uuconf_system salternate;
80 /* Whether to use extra alternates from the file wide defaults. */
81 int fdefault_alternates;
84 /* The command table for system commands. */
85 static const struct cmdtab_offset asIcmds[] =
87 { "system", UUCONF_CMDTABTYPE_FN | 2, (size_t) -1, iisystem },
88 { "alias", UUCONF_CMDTABTYPE_FN | 2, (size_t) -1, iialias },
89 { "alternate", UUCONF_CMDTABTYPE_FN | 0, (size_t) -1, iialternate },
90 { "default-alternates", UUCONF_CMDTABTYPE_FN | 2, (size_t) -1,
91 iidefault_alternates },
92 { "time", UUCONF_CMDTABTYPE_FN | 0,
93 offsetof (struct uuconf_system, uuconf_qtimegrade), iitime },
94 { "timegrade", UUCONF_CMDTABTYPE_FN | 0,
95 offsetof (struct uuconf_system, uuconf_qtimegrade), iitimegrade },
96 { "max-retries", UUCONF_CMDTABTYPE_INT,
97 offsetof (struct uuconf_system, uuconf_cmax_retries), NULL },
98 { "success-wait", UUCONF_CMDTABTYPE_INT,
99 offsetof (struct uuconf_system, uuconf_csuccess_wait), NULL },
100 { "call-timegrade", UUCONF_CMDTABTYPE_FN | 3,
101 offsetof (struct uuconf_system, uuconf_qcalltimegrade), iitimegrade },
102 { "called-timegrade", UUCONF_CMDTABTYPE_FN | 3,
103 offsetof (struct uuconf_system, uuconf_qcalledtimegrade), iitimegrade },
104 { "call-local-size", UUCONF_CMDTABTYPE_FN | 3,
105 offsetof (struct uuconf_system, uuconf_qcall_local_size), iisize },
106 { "call-remote-size", UUCONF_CMDTABTYPE_FN | 3,
107 offsetof (struct uuconf_system, uuconf_qcall_remote_size), iisize },
108 { "called-local-size", UUCONF_CMDTABTYPE_FN | 3,
109 offsetof (struct uuconf_system, uuconf_qcalled_local_size), iisize },
110 { "called-remote-size", UUCONF_CMDTABTYPE_FN | 3,
111 offsetof (struct uuconf_system, uuconf_qcalled_remote_size), iisize },
112 { "timetable", UUCONF_CMDTABTYPE_FN | 3, (size_t) -1, _uuconf_itimetable },
113 { "baud", UUCONF_CMDTABTYPE_LONG,
114 offsetof (struct uuconf_system, uuconf_ibaud), NULL },
115 { "speed", UUCONF_CMDTABTYPE_LONG,
116 offsetof (struct uuconf_system, uuconf_ibaud), NULL },
117 { "baud-range", UUCONF_CMDTABTYPE_FN | 3, 0, iibaud_range },
118 { "speed-range", UUCONF_CMDTABTYPE_FN | 3, 0, iibaud_range },
119 { "port", UUCONF_CMDTABTYPE_FN | 0, (size_t) -1, iiport },
120 { "phone", UUCONF_CMDTABTYPE_STRING,
121 offsetof (struct uuconf_system, uuconf_zphone), NULL },
122 { "address", UUCONF_CMDTABTYPE_STRING,
123 offsetof (struct uuconf_system, uuconf_zphone), NULL },
124 { "chat", UUCONF_CMDTABTYPE_PREFIX | 0,
125 offsetof (struct uuconf_system, uuconf_schat), iichat },
126 { "call-login", UUCONF_CMDTABTYPE_STRING,
127 offsetof (struct uuconf_system, uuconf_zcall_login), NULL },
128 { "call-password", UUCONF_CMDTABTYPE_STRING,
129 offsetof (struct uuconf_system, uuconf_zcall_password), NULL },
130 { "called-login", UUCONF_CMDTABTYPE_FN | 0,
131 offsetof (struct uuconf_system, uuconf_zcalled_login), iicalled_login },
132 { "callback", UUCONF_CMDTABTYPE_BOOLEAN,
133 offsetof (struct uuconf_system, uuconf_fcallback), NULL },
134 { "sequence", UUCONF_CMDTABTYPE_BOOLEAN,
135 offsetof (struct uuconf_system, uuconf_fsequence), NULL },
136 { "protocol", UUCONF_CMDTABTYPE_STRING,
137 offsetof (struct uuconf_system, uuconf_zprotocols), NULL },
138 { "protocol-parameter", UUCONF_CMDTABTYPE_FN | 0,
139 offsetof (struct uuconf_system, uuconf_qproto_params), iiproto_param },
140 { "called-chat", UUCONF_CMDTABTYPE_PREFIX | 0,
141 offsetof (struct uuconf_system, uuconf_scalled_chat), iichat },
142 { "debug", UUCONF_CMDTABTYPE_FN | 0,
143 offsetof (struct uuconf_system, uuconf_zdebug), iidebug },
144 { "max-remote-debug", UUCONF_CMDTABTYPE_STRING,
145 offsetof (struct uuconf_system, uuconf_zmax_remote_debug), NULL },
146 { "send-request", UUCONF_CMDTABTYPE_BOOLEAN,
147 offsetof (struct uuconf_system, uuconf_fsend_request), NULL },
148 { "receive-request", UUCONF_CMDTABTYPE_BOOLEAN,
149 offsetof (struct uuconf_system, uuconf_frec_request), NULL },
150 { "request", UUCONF_CMDTABTYPE_FN | 2, (size_t) -1, iirequest },
151 { "call-transfer", UUCONF_CMDTABTYPE_BOOLEAN,
152 offsetof (struct uuconf_system, uuconf_fcall_transfer), NULL },
153 { "called-transfer", UUCONF_CMDTABTYPE_BOOLEAN,
154 offsetof (struct uuconf_system, uuconf_fcalled_transfer), NULL },
155 { "transfer", UUCONF_CMDTABTYPE_FN | 2, (size_t) -1, iitransfer },
156 { "local-send", UUCONF_CMDTABTYPE_FULLSTRING,
157 offsetof (struct uuconf_system, uuconf_pzlocal_send), NULL },
158 { "remote-send", UUCONF_CMDTABTYPE_FULLSTRING,
159 offsetof (struct uuconf_system, uuconf_pzremote_send), NULL },
160 { "local-receive", UUCONF_CMDTABTYPE_FULLSTRING,
161 offsetof (struct uuconf_system, uuconf_pzlocal_receive), NULL },
162 { "remote-receive", UUCONF_CMDTABTYPE_FULLSTRING,
163 offsetof (struct uuconf_system, uuconf_pzremote_receive), NULL },
164 { "command-path", UUCONF_CMDTABTYPE_FULLSTRING,
165 offsetof (struct uuconf_system, uuconf_pzpath), NULL },
166 { "commands", UUCONF_CMDTABTYPE_FULLSTRING,
167 offsetof (struct uuconf_system, uuconf_pzcmds), NULL },
168 { "free-space", UUCONF_CMDTABTYPE_LONG,
169 offsetof (struct uuconf_system, uuconf_cfree_space), NULL },
170 { "forward-from", UUCONF_CMDTABTYPE_FULLSTRING,
171 offsetof (struct uuconf_system, uuconf_pzforward_from), NULL },
172 { "forward-to", UUCONF_CMDTABTYPE_FULLSTRING,
173 offsetof (struct uuconf_system, uuconf_pzforward_to), NULL },
174 { "forward", UUCONF_CMDTABTYPE_FN | 0, (size_t) -1, iiforward },
175 { "pubdir", UUCONF_CMDTABTYPE_STRING,
176 offsetof (struct uuconf_system, uuconf_zpubdir), NULL },
177 { "myname", UUCONF_CMDTABTYPE_STRING,
178 offsetof (struct uuconf_system, uuconf_zlocalname), NULL },
182 #define CSYSTEM_CMDS (sizeof asIcmds / sizeof asIcmds[0])
184 /* Get information about the system zsystem from the Taylor UUCP
185 configuration files. Sets *qsys. This does not ensure that all
186 default information is set. */
189 _uuconf_itaylor_system_internal (qglobal, zsystem, qsys)
190 struct sglobal *qglobal;
192 struct uuconf_system *qsys;
195 struct stsysloc *qloc;
196 struct uuconf_cmdtab as[CSYSTEM_CMDS];
198 struct uuconf_system sdefaults;
200 if (! qglobal->qprocess->fread_syslocs)
202 iret = _uuconf_iread_locations (qglobal);
203 if (iret != UUCONF_SUCCESS)
207 /* Find the system in the list of locations. */
208 for (qloc = qglobal->qprocess->qsyslocs; qloc != NULL; qloc = qloc->qnext)
209 if (qloc->zname[0] == zsystem[0]
210 && strcmp (qloc->zname, zsystem) == 0)
213 return UUCONF_NOT_FOUND;
215 /* If this is an alias, then the real system is the next non-alias
221 return UUCONF_NOT_FOUND;
224 _uuconf_ucmdtab_base (asIcmds, CSYSTEM_CMDS, (char *) qsys, as);
228 /* Read the file wide defaults from the start of the file. */
229 _uuconf_uclear_system (qsys);
232 si.falternates = FALSE;
233 si.fdefault_alternates = TRUE;
234 qsys->uuconf_palloc = uuconf_malloc_block ();
235 if (qsys->uuconf_palloc == NULL)
237 qglobal->ierrno = errno;
238 return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
241 iret = uuconf_cmd_file ((pointer) qglobal, qloc->e, as, (pointer) &si,
242 iiunknown, UUCONF_CMDTABFLAG_BACKSLASH,
243 qsys->uuconf_palloc);
244 if (iret != UUCONF_SUCCESS)
246 qglobal->zfilename = qloc->zfile;
247 return iret | UUCONF_ERROR_FILENAME;
250 if (! si.falternates)
254 /* Attach the final alternate. */
255 iret = iialternate ((pointer) qglobal, 0, (char **) NULL,
256 (pointer) NULL, (pointer) &si);
257 if (iret != UUCONF_SUCCESS)
261 /* Save off the defaults. */
264 /* Advance to the information for the system we want. */
265 if (fseek (qloc->e, qloc->iloc, SEEK_SET) != 0)
267 qglobal->ierrno = errno;
268 qglobal->zfilename = qloc->zfile;
269 return (UUCONF_FSEEK_FAILED
271 | UUCONF_ERROR_FILENAME);
274 /* Read in the system we want. */
275 _uuconf_uclear_system (qsys);
276 qsys->uuconf_zname = (char *) qloc->zname;
277 qsys->uuconf_palloc = sdefaults.uuconf_palloc;
279 si.falternates = FALSE;
281 iret = uuconf_cmd_file (qglobal, qloc->e, as, (pointer) &si, iiunknown,
282 UUCONF_CMDTABFLAG_BACKSLASH, qsys->uuconf_palloc);
283 qglobal->ilineno += qloc->ilineno;
285 if (iret == UUCONF_SUCCESS)
287 if (! si.falternates)
290 iret = iialternate ((pointer) qglobal, 0, (char **) NULL,
291 (pointer) NULL, (pointer) &si);
294 /* Merge in the defaults. */
295 if (iret == UUCONF_SUCCESS)
296 iret = _uuconf_isystem_default (qglobal, qsys, &sdefaults,
297 si.fdefault_alternates);
299 /* The first alternate is always available for calling in. It is
300 always available for calling out if it has some way to choose a
301 port (this would normally be set by uiset_call anyhow, but it
302 won't be if all the port information comes from the defaults). */
303 if (iret == UUCONF_SUCCESS)
305 qsys->uuconf_fcalled = TRUE;
306 if (qsys->uuconf_zport != (char *) &_uuconf_unset
307 || qsys->uuconf_qport != (struct uuconf_port *) &_uuconf_unset
308 || qsys->uuconf_ibaud >= 0
309 || qsys->uuconf_zphone != (char *) &_uuconf_unset)
310 qsys->uuconf_fcall = TRUE;
313 if (iret != UUCONF_SUCCESS)
315 qglobal->zfilename = qloc->zfile;
316 iret |= UUCONF_ERROR_FILENAME;
322 /* Set the fcall and fcalled field for the system. This marks a
323 particular alternate for use when calling out or calling in. This
324 is where we implement the semantics described in the documentation:
325 a change to a relevant field implies that the alternate is used.
326 If all the relevant fields are unchanged, the alternate is not
331 struct uuconf_system *qsys;
334 (qsys->uuconf_qtimegrade != (struct uuconf_timespan *) &_uuconf_unset
335 || qsys->uuconf_zport != (char *) &_uuconf_unset
336 || qsys->uuconf_qport != (struct uuconf_port *) &_uuconf_unset
337 || qsys->uuconf_ibaud >= 0
338 || qsys->uuconf_zphone != (char *) &_uuconf_unset
339 || qsys->uuconf_schat.uuconf_pzchat != (char **) &_uuconf_unset
340 || qsys->uuconf_schat.uuconf_pzprogram != (char **) &_uuconf_unset);
342 qsys->uuconf_fcalled =
343 qsys->uuconf_zcalled_login != (char *) &_uuconf_unset;
346 /* Handle the "system" command. Because we skip directly to the
347 system we want to read, a "system" command means we've reached the
351 iisystem (pglobal, argc, argv, pvar, pinfo)
358 return UUCONF_CMDTABRET_EXIT;
361 /* Handle the "alias" command. */
365 iialias (pglobal, argc, argv, pvar, pinfo)
372 struct sglobal *qglobal = (struct sglobal *) pglobal;
373 struct sinfo *qinfo = (struct sinfo *) pinfo;
376 iret = _uuconf_iadd_string (qglobal, argv[1], TRUE, FALSE,
377 &qinfo->qsys->uuconf_pzalias,
378 qinfo->qsys->uuconf_palloc);
379 if (iret != UUCONF_SUCCESS)
380 iret |= UUCONF_CMDTABRET_EXIT;
384 /* Handle the "alternate" command. The information just read is in
385 sIhold. If this is the first "alternate" command for this system,
386 we save off the current information in sIalternate. Otherwise we
387 default this information to sIalternate, and then add it to the end
388 of the list of alternates in sIalternate. */
391 iialternate (pglobal, argc, argv, pvar, pinfo)
398 struct sglobal *qglobal = (struct sglobal *) pglobal;
399 struct sinfo *qinfo = (struct sinfo *) pinfo;
401 uiset_call (qinfo->qsys);
403 if (! qinfo->falternates)
405 qinfo->salternate = *qinfo->qsys;
406 qinfo->falternates = TRUE;
411 struct uuconf_system *qnew, **pq;
413 iret = _uuconf_isystem_default (qglobal, qinfo->qsys,
414 &qinfo->salternate, FALSE);
415 if (iret != UUCONF_SUCCESS)
416 return iret | UUCONF_CMDTABRET_EXIT;
417 qnew = ((struct uuconf_system *)
418 uuconf_malloc (qinfo->qsys->uuconf_palloc,
419 sizeof (struct uuconf_system)));
422 qglobal->ierrno = errno;;
423 return (UUCONF_MALLOC_FAILED
425 | UUCONF_CMDTABRET_EXIT);
427 *qnew = *qinfo->qsys;
428 for (pq = &qinfo->salternate.uuconf_qalternate;
430 pq = &(*pq)->uuconf_qalternate)
435 /* If this is the last alternate command, move the information back
438 *qinfo->qsys = qinfo->salternate;
441 _uuconf_uclear_system (qinfo->qsys);
442 qinfo->qsys->uuconf_zname = qinfo->salternate.uuconf_zname;
443 qinfo->qsys->uuconf_palloc = qinfo->salternate.uuconf_palloc;
446 qinfo->qsys->uuconf_zalternate = argv[1];
447 return UUCONF_CMDTABRET_KEEP;
451 return UUCONF_CMDTABRET_CONTINUE;
454 /* Handle the "default-alternates" command. This just takes a boolean
455 argument which is used to set the fdefault_alternates field of the
460 iidefault_alternates (pglobal, argc, argv, pvar, pinfo)
467 struct sglobal *qglobal = (struct sglobal *) pglobal;
468 struct sinfo *qinfo = (struct sinfo *) pinfo;
470 return _uuconf_iboolean (qglobal, argv[1], &qinfo->fdefault_alternates);
473 /* Handle the "time" command. We do this by turning it into a
474 "timegrade" command with a grade of BGRADE_LOW. The first argument
475 is a time string, and the optional second argument is the retry
480 iitime (pglobal, argc, argv, pvar, pinfo)
490 if (argc != 2 && argc != 3)
491 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
494 ab[0] = UUCONF_GRADE_LOW;
501 return iitimegrade (pglobal, argc + 1, aznew, pvar, pinfo);
504 /* Handle the "timegrade" command by calling _uuconf_itime_parse with
505 appropriate ival (the work grade) and cretry (the retry time)
509 iitimegrade (pglobal, argc, argv, pvar, pinfo)
516 struct sglobal *qglobal = (struct sglobal *) pglobal;
517 struct uuconf_timespan **pqspan = (struct uuconf_timespan **) pvar;
518 struct sinfo *qinfo = (struct sinfo *) pinfo;
522 if (argc < 3 || argc > 4)
523 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
525 if (argv[1][1] != '\0' || ! UUCONF_GRADE_LEGAL (argv[1][0]))
526 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
532 iret = _uuconf_iint (qglobal, argv[3], (pointer) &cretry, TRUE);
533 if (iret != UUCONF_SUCCESS)
537 iret = _uuconf_itime_parse (qglobal, argv[2], (long) argv[1][0],
538 cretry, _uuconf_itime_grade_cmp, pqspan,
539 qinfo->qsys->uuconf_palloc);
540 if (iret != UUCONF_SUCCESS)
541 iret |= UUCONF_CMDTABRET_EXIT;
545 /* Handle the "baud-range" command, also known as "speed-range". */
548 iibaud_range (pglobal, argc, argv, pvar, pinfo)
555 struct sglobal *qglobal = (struct sglobal *) pglobal;
556 struct uuconf_system *qsys = (struct uuconf_system *) pvar;
559 iret = _uuconf_iint (qglobal, argv[1], (pointer) &qsys->uuconf_ibaud,
561 if (iret != UUCONF_SUCCESS)
563 return _uuconf_iint (qglobal, argv[2], (pointer) &qsys->uuconf_ihighbaud,
567 /* Handle one of the size commands ("call-local-size", etc.). The
568 first argument is a number of bytes, and the second argument is a
569 time string. The pvar argument points to the string array to which
570 we add this new string. */
574 iisize (pglobal, argc, argv, pvar, pinfo)
581 struct sglobal *qglobal = (struct sglobal *) pglobal;
582 struct uuconf_timespan **pqspan = (struct uuconf_timespan **) pvar;
583 struct sinfo *qinfo = (struct sinfo *) pinfo;
587 iret = _uuconf_iint (qglobal, argv[1], (pointer) &ival, FALSE);
588 if (iret != UUCONF_SUCCESS)
591 iret = _uuconf_itime_parse (qglobal, argv[2], ival, 0, iisizecmp,
592 pqspan, qinfo->qsys->uuconf_palloc);
593 if (iret != UUCONF_SUCCESS)
594 iret |= UUCONF_CMDTABRET_EXIT;
598 /* A comparison function for sizes to pass to _uuconf_itime_parse. */
605 /* We can't just return i1 - i2 because that would be a long. */
614 /* Handle the "port" command. If there is one argument, this names a
615 port. Otherwise, the remaining arguments form a command describing
620 iiport (pglobal, argc, argv, pvar, pinfo)
627 struct sglobal *qglobal = (struct sglobal *) pglobal;
628 struct sinfo *qinfo = (struct sinfo *) pinfo;
631 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
634 qinfo->qsys->uuconf_zport = argv[1];
635 return UUCONF_CMDTABRET_KEEP;
641 if (qinfo->qsys->uuconf_qport
642 == (struct uuconf_port *) &_uuconf_unset)
644 struct uuconf_port *qnew;
646 qnew = ((struct uuconf_port *)
647 uuconf_malloc (qinfo->qsys->uuconf_palloc,
648 sizeof (struct uuconf_port)));
651 qglobal->ierrno = errno;
652 return (UUCONF_MALLOC_FAILED
654 | UUCONF_CMDTABRET_EXIT);
657 _uuconf_uclear_port (qnew);
659 if (qinfo->qsys->uuconf_zname == NULL)
660 qnew->uuconf_zname = (char *) "default system file port";
666 clen = strlen (qinfo->qsys->uuconf_zname);
667 zname = (char *) uuconf_malloc (qinfo->qsys->uuconf_palloc,
668 clen + sizeof "system port");
671 qglobal->ierrno = errno;
672 return (UUCONF_MALLOC_FAILED
674 | UUCONF_CMDTABRET_EXIT);
677 memcpy ((pointer) zname, (pointer) "system ",
678 sizeof "system " - 1);
679 memcpy ((pointer) (zname + sizeof "system " - 1),
680 (pointer) qinfo->qsys->uuconf_zname,
682 memcpy ((pointer) (zname + sizeof "system " - 1 + clen),
683 (pointer) " port", sizeof " port");
685 qnew->uuconf_zname = zname;
688 qnew->uuconf_palloc = qinfo->qsys->uuconf_palloc;
690 qinfo->qsys->uuconf_qport = qnew;
693 iret = _uuconf_iport_cmd (qglobal, argc - 1, argv + 1,
694 qinfo->qsys->uuconf_qport);
695 if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS)
696 iret |= UUCONF_CMDTABRET_EXIT;
701 /* Handle the "chat" and "called-chat" set of commands. These just
702 hand off to the generic chat script function. */
705 iichat (pglobal, argc, argv, pvar, pinfo)
712 struct sglobal *qglobal = (struct sglobal *) pglobal;
713 struct sinfo *qinfo = (struct sinfo *) pinfo;
714 struct uuconf_chat *qchat = (struct uuconf_chat *) pvar;
717 iret = _uuconf_ichat_cmd (qglobal, argc, argv, qchat,
718 qinfo->qsys->uuconf_palloc);
719 if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS)
720 iret |= UUCONF_CMDTABRET_EXIT;
724 /* Local interface to the _uuconf_idebug_cmd function, which handles
725 the "debug" command. */
728 iidebug (pglobal, argc, argv, pvar, pinfo)
735 struct sglobal *qglobal = (struct sglobal *) pglobal;
736 struct sinfo *qinfo = (struct sinfo *) pinfo;
737 char **pzdebug = (char **) pvar;
739 return _uuconf_idebug_cmd (qglobal, pzdebug, argc, argv,
740 qinfo->qsys->uuconf_palloc);
743 /* Handle the "called-login" command. This only needs to be in a
744 function because there can be additional arguments listing the
745 remote systems which are permitted to use this login name. The
746 additional arguments are not actually handled here; they are
747 handled by uuconf_taylor_system_names, which already has to go
748 through all the system files. */
752 iicalled_login (pglobal, argc, argv, pvar, pinfo)
759 char **pz = (char **) pvar;
762 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
764 return UUCONF_CMDTABRET_KEEP;
767 /* Handle the "protocol-parameter" command. This just hands off to
768 the generic protocol parameter handler. */
771 iiproto_param (pglobal, argc, argv, pvar, pinfo)
778 struct sglobal *qglobal = (struct sglobal *) pglobal;
779 struct uuconf_proto_param **pqparam = (struct uuconf_proto_param **) pvar;
780 struct sinfo *qinfo = (struct sinfo *) pinfo;
782 if (*pqparam == (struct uuconf_proto_param *) &_uuconf_unset)
784 return _uuconf_iadd_proto_param (qglobal, argc - 1, argv + 1, pqparam,
785 qinfo->qsys->uuconf_palloc);
788 /* Handle the "request" command. This is equivalent to specifying
789 both "call-request" and "called-request". */
793 iirequest (pglobal, argc, argv, pvar, pinfo)
800 struct sglobal *qglobal = (struct sglobal *) pglobal;
801 struct sinfo *qinfo = (struct sinfo *) pinfo;
804 iret = _uuconf_iboolean (qglobal, argv[1],
805 &qinfo->qsys->uuconf_fsend_request);
806 if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS)
807 qinfo->qsys->uuconf_frec_request = qinfo->qsys->uuconf_fsend_request;
812 /* Handle the "transfer" command. This is equivalent to specifying
813 both "call-transfer" and "called-transfer". */
817 iitransfer (pglobal, argc, argv, pvar, pinfo)
824 struct sglobal *qglobal = (struct sglobal *) pglobal;
825 struct sinfo *qinfo = (struct sinfo *) pinfo;
828 iret = _uuconf_iboolean (qglobal, argv[1],
829 &qinfo->qsys->uuconf_fcall_transfer);
830 if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS)
831 qinfo->qsys->uuconf_fcalled_transfer = qinfo->qsys->uuconf_fcall_transfer;
836 /* Handle the "forward" command. This is equivalent to specifying
837 both "forward-from" and "forward-to". */
841 iiforward (pglobal, argc, argv, pvar, pinfo)
848 struct sglobal *qglobal = (struct sglobal *) pglobal;
849 struct sinfo *qinfo = (struct sinfo *) pinfo;
850 struct uuconf_system *qsys;
855 qsys->uuconf_pzforward_from = NULL;
856 qsys->uuconf_pzforward_to = NULL;
857 for (i = 1; i < argc; i++)
859 iret = _uuconf_iadd_string (qglobal, argv[i], FALSE, FALSE,
860 &qsys->uuconf_pzforward_to,
861 qsys->uuconf_palloc);
862 if (iret != UUCONF_SUCCESS)
863 return iret | UUCONF_CMDTABRET_KEEP | UUCONF_CMDTABRET_EXIT;
864 iret = _uuconf_iadd_string (qglobal, argv[i], FALSE, FALSE,
865 &qsys->uuconf_pzforward_from,
866 qsys->uuconf_palloc);
867 if (iret != UUCONF_SUCCESS)
868 return iret | UUCONF_CMDTABRET_KEEP | UUCONF_CMDTABRET_EXIT;
871 return UUCONF_CMDTABRET_KEEP;
874 /* Handle an unknown command. This should probably be done more
879 iiunknown (pglobal, argc, argv, pvar, pinfo)
886 return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
889 /* Return information for an unknown system. It would be better to
890 put this in a different file, but it would require breaking several
891 functions out of this file. Perhaps I will do it sometime. */
894 uuconf_taylor_system_unknown (pglobal, qsys)
896 struct uuconf_system *qsys;
898 struct sglobal *qglobal = (struct sglobal *) pglobal;
899 struct uuconf_cmdtab as[CSYSTEM_CMDS];
904 if (qglobal->qprocess->qunknown == NULL)
905 return UUCONF_NOT_FOUND;
907 _uuconf_ucmdtab_base (asIcmds, CSYSTEM_CMDS, (char *) qsys, as);
909 _uuconf_uclear_system (qsys);
912 si.falternates = FALSE;
913 si.fdefault_alternates = TRUE;
914 qsys->uuconf_palloc = uuconf_malloc_block ();
915 if (qsys->uuconf_palloc == NULL)
917 qglobal->ierrno = errno;
918 return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
921 for (q = qglobal->qprocess->qunknown; q != NULL; q = q->qnext)
923 iret = uuconf_cmd_args (pglobal, q->cargs, q->pzargs, as,
924 (pointer) &si, iiunknown,
925 UUCONF_CMDTABFLAG_BACKSLASH,
926 qsys->uuconf_palloc);
927 iret &=~ UUCONF_CMDTABRET_KEEP;
928 if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS)
930 qglobal->zfilename = qglobal->qprocess->zconfigfile;
931 qglobal->ilineno = q->ilineno;
932 return ((iret &~ UUCONF_CMDTABRET_EXIT)
933 | UUCONF_ERROR_FILENAME
934 | UUCONF_ERROR_LINENO);
936 if ((iret & UUCONF_CMDTABRET_EXIT) != 0)
940 if (! si.falternates)
944 iret = iialternate (pglobal, 0, (char **) NULL, (pointer) NULL,
946 if (iret != UUCONF_SUCCESS)
950 /* The first alternate is always available for calling in. */
951 qsys->uuconf_fcalled = TRUE;
953 return _uuconf_isystem_basic_default (qglobal, qsys);