forked from quinot/taylor-uucp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uuchk.c
1163 lines (1015 loc) · 31.7 KB
/
uuchk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* uuchk.c
Display what we think the permissions of systems are.
Copyright (C) 1991, 1992, 1993, 1994, 1995, 2002 Ian Lance Taylor
This file is part of the Taylor UUCP package.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
The author of the program may be contacted at [email protected].
*/
#include "uucp.h"
#if USE_RCS_ID
const char uuchk_rcsid[] = "$Id$";
#endif
#include "getopt.h"
#include "uuconf.h"
/* Local functions. */
static void ukusage P((void));
static void ukhelp P((void));
static void ukshow_names P((const char *zheader, const char * const *pznames));
static void ukshow P((const struct uuconf_system *qsys,
pointer puuconf));
static int ikshow_port P((struct uuconf_port *qport, pointer pinfo));
static void ukshow_dialer P((struct uuconf_dialer *qdial));
static void ukshow_chat P((const struct uuconf_chat *qchat,
const char *zhdr));
static void ukshow_size P((struct uuconf_timespan *q, boolean fcall,
boolean flocal));
static void ukshow_reliable P ((int i, const char *zhdr));
static void ukshow_proto_params P((struct uuconf_proto_param *pas,
int cindent));
static void ukshow_time P((const struct uuconf_timespan *));
static struct uuconf_timespan *qcompress_span P((struct uuconf_timespan *));
static void ukuuconf_error P((pointer puuconf, int iret));
/* Structure used to pass uuconf pointer into ikshow_port and also let
it record whether any ports were found. */
struct sinfo
{
/* The uuconf global pointer. */
pointer puuconf;
/* The system. */
const struct uuconf_system *qsys;
/* Whether any ports were seen. */
boolean fgot;
};
/* Program name. */
static const char *zKprogram;
/* Long getopt options. */
static const struct option asKlongopts[] =
{
{ "system", required_argument, NULL,'s' },
{ "config", required_argument, NULL, 'I' },
{ "debug", required_argument, NULL, 'x' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 1 },
{ NULL, 0, NULL, 0 }
};
int
main (int argc, char **argv)
{
int iopt;
const char *zsystem = NULL;
const char *zconfig = NULL;
int iret;
pointer puuconf;
zKprogram = argv[0];
while ((iopt = getopt_long (argc, argv, "I:s:vx:", asKlongopts,
(int *) NULL)) != EOF)
{
switch (iopt)
{
case 's':
/* Examine specific system. */
zsystem = optarg;
break;
case 'I':
/* Set the configuration file name. */
zconfig = optarg;
break;
case 'x':
/* Set the debugging level. There is actually no debugging
information for this program. */
break;
case 'v':
/* Print version and exit. */
printf ("uuchk (Taylor UUCP) %s\n", VERSION);
printf ("Copyright (C) 1991, 92, 93, 94, 1995, 2002 Ian Lance Taylor\n");
printf ("This program is free software; you may redistribute it under the terms of\n");
printf ("the GNU General Public LIcense. This program has ABSOLUTELY NO WARRANTY.\n");
exit (EXIT_SUCCESS);
/*NOTREACHED*/
case 1:
/* --help. */
ukhelp ();
exit (EXIT_SUCCESS);
/*NOTREACHED*/
case 0:
/* Long option found and flag set. */
break;
default:
ukusage ();
/*NOTREACHED*/
}
}
if (optind != argc)
{
fprintf (stderr, "%s: too many arguments", zKprogram);
ukusage ();
}
iret = uuconf_init (&puuconf, (const char *) NULL, zconfig);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
if (zsystem != NULL)
{
struct uuconf_system ssys;
iret = uuconf_system_info (puuconf, zsystem, &ssys);
if (iret == UUCONF_NOT_FOUND)
{
fprintf (stderr, "%s: system not found\n", zsystem);
exit (EXIT_FAILURE);
}
else if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
ukshow (&ssys, puuconf);
(void) uuconf_system_free (puuconf, &ssys);
}
else
{
struct uuconf_config_file_names snames;
const char *zstr;
int iint;
char **pzsystems;
iret = uuconf_config_files (puuconf, &snames);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
if (snames.uuconf_ztaylor_config != NULL)
printf ("config file: %s\n", snames.uuconf_ztaylor_config);
ukshow_names("sys file", snames.uuconf_pztaylor_sys);
ukshow_names("port file", snames.uuconf_pztaylor_port);
ukshow_names("dial file", snames.uuconf_pztaylor_dial);
ukshow_names("dialcode file", snames.uuconf_pzdialcode);
ukshow_names("passwd file", snames.uuconf_pztaylor_pwd);
ukshow_names("call file", snames.uuconf_pztaylor_call);
if (snames.uuconf_zv2_systems != NULL)
printf ("V2 L.sys file: %s\n", snames.uuconf_zv2_systems);
if (snames.uuconf_zv2_device != NULL)
printf ("V2 L-devices file: %s\n", snames.uuconf_zv2_device);
if (snames.uuconf_zv2_userfile != NULL)
printf ("V2 USERFILE file: %s\n", snames.uuconf_zv2_userfile);
if (snames.uuconf_zv2_cmds != NULL)
printf ("V2 L.cmds file: %s\n", snames.uuconf_zv2_cmds);
ukshow_names("HDB Systems file", snames.uuconf_pzhdb_systems);
ukshow_names("HDB Devices file", snames.uuconf_pzhdb_devices);
ukshow_names("HDB Dialers file", snames.uuconf_pzhdb_dialers);
if (snames.uuconf_zhdb_permissions != NULL)
printf ("HDB Permissions file: %s\n", snames.uuconf_zhdb_permissions);
/* FIXME: This doesn't dump the following HDB file names:
Sysfiles, Maxuuxqts, remote.unknown. */
iret = uuconf_localname (puuconf, &zstr);
if (iret == UUCONF_SUCCESS)
printf ("Local node name %s\n", zstr);
else if (iret != UUCONF_NOT_FOUND)
ukuuconf_error (puuconf, iret);
iret = uuconf_spooldir (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("Spool directory %s\n", zstr);
iret = uuconf_pubdir (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("Public directory %s\n", zstr);
iret = uuconf_lockdir (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("Lock directory %s\n", zstr);
iret = uuconf_logfile (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("Log file %s\n", zstr);
iret = uuconf_statsfile (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("Statistics file %s\n", zstr);
iret = uuconf_debugfile (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("Debug file %s\n", zstr);
iret = uuconf_debuglevel (puuconf, &zstr);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
if (zstr != NULL)
printf ("Global debugging level %s\n", zstr);
iret = uuconf_strip (puuconf, &iint);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
printf ("uucico -l will %sstrip login names and passwords\n",
(iint & UUCONF_STRIP_LOGIN) != 0 ? "" : "not ");
printf ("uucico will %sstrip UUCP protocol commands\n",
(iint & UUCONF_STRIP_PROTO) != 0 ? "" : "not ");
iret = uuconf_maxuuxqts (puuconf, &iint);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
if (iint != 0)
printf ("Maximum number of uuxqt processes permitted %d\n", iint);
iret = uuconf_runuuxqt (puuconf, &iint);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
if (iint > 0)
printf ("Start uuxqt every %d jobs\n", iint);
else
{
switch (iint)
{
case UUCONF_RUNUUXQT_NEVER:
printf ("Never start uuxqt\n");
break;
case UUCONF_RUNUUXQT_ONCE:
printf ("Start uuxqt once per uucico invocation\n");
break;
case UUCONF_RUNUUXQT_PERCALL:
printf ("Start uuxqt once per call\n");
break;
default:
fprintf (stderr, "Illegal value from uuconf_runuuxqt\n");
exit (EXIT_FAILURE);
break;
}
}
iret = uuconf_system_names (puuconf, &pzsystems, FALSE);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
if (*pzsystems == NULL)
{
fprintf (stderr, "%s: no systems found\n", zKprogram);
exit (EXIT_FAILURE);
}
while (*pzsystems != NULL)
{
struct uuconf_system ssys;
printf ("\n");
iret = uuconf_system_info (puuconf, *pzsystems, &ssys);
if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
else
ukshow (&ssys, puuconf);
(void) uuconf_system_free (puuconf, &ssys);
++pzsystems;
}
}
exit (EXIT_SUCCESS);
/* Avoid errors about not returning a value. */
return 0;
}
/* Print a usage message and die. */
static void ukusage (void)
{
fprintf (stderr, "Usage: %s [-s system] [-I file]\n", zKprogram);
fprintf (stderr, "Use %s --help for help\n", zKprogram);
exit (EXIT_FAILURE);
}
/* Print a help message. */
static void
ukhelp (void)
{
printf ("Taylor UUCP %s, copyright (C) 1991, 92, 93, 94, 1995, 2002 Ian Lance Taylor\n",
VERSION);
printf ("Usage: %s [-s system] [-I file] [-v]\n", zKprogram);
printf (" -s,--system system: Only print configuration for named system\n");
printf (" -I,--config file: Set configuration file to use\n");
printf (" -v,--version: Print version and exit\n");
printf (" --help: Print help and exit\n");
printf ("Report bugs to [email protected]\n");
}
/* Print a list of configuration file names. */
static void
ukshow_names (const char *zheader, const char *const *pznames)
{
if (pznames == NULL)
return;
if (pznames[1] == NULL)
printf ("%s: %s\n", zheader, pznames[0]);
else
{
const char * const *pz;
printf ("%s:\n", zheader);
for (pz = pznames; *pz != NULL; ++pz)
printf (" %s\n", *pz);
}
}
/* Dump out the information for a system. */
static void
ukshow (const struct uuconf_system *qsys, pointer puuconf)
{
char **pz;
int i;
int iret;
boolean fanycall;
printf ("System: %s", qsys->uuconf_zname);
if (qsys->uuconf_pzalias != NULL)
{
printf (" (");
for (pz = qsys->uuconf_pzalias; *pz != NULL; pz++)
{
printf ("%s", *pz);
if (pz[1] != NULL)
printf (" ");
}
printf (")");
}
printf ("\n");
fanycall = FALSE;
for (i = 0; qsys != NULL; qsys = qsys->uuconf_qalternate, i++)
{
boolean fcall, fcalled;
struct uuconf_timespan *qtime, *qspan;
if (i != 0 || qsys->uuconf_qalternate != NULL)
{
printf ("Alternate %d", i);
if (qsys->uuconf_zalternate != NULL)
printf (" (%s)", qsys->uuconf_zalternate);
printf ("\n");
}
/* See if this alternate could be used when calling out. */
fcall = qsys->uuconf_fcall;
if (qsys->uuconf_qtimegrade == NULL)
fcall = FALSE;
/* See if this alternate could be used when calling in. */
fcalled = qsys->uuconf_fcalled;
if (! fcall && ! fcalled)
{
printf (" This alternate is never used\n");
continue;
}
if (fcall)
fanycall = TRUE;
if (fcalled)
{
if (qsys->uuconf_zcalled_login != NULL
&& strcmp (qsys->uuconf_zcalled_login, "ANY") != 0)
{
if (i == 0 && qsys->uuconf_qalternate == NULL)
printf (" Caller must log in as %s\n",
qsys->uuconf_zcalled_login);
else
printf (" When called using login name %s\n",
qsys->uuconf_zcalled_login);
}
else
printf (" When called using any login name\n");
if (qsys->uuconf_zlocalname != NULL)
printf (" Will use %s as name of local system\n",
qsys->uuconf_zlocalname);
}
if (fcalled && qsys->uuconf_fcallback)
{
printf (" If called, will call back\n");
fcalled = FALSE;
}
if (fcall)
{
struct sinfo si;
if (i == 0 && qsys->uuconf_qalternate == NULL)
printf (" Call out");
else
printf (" This alternate applies when calling");
if (qsys->uuconf_zport != NULL || qsys->uuconf_qport != NULL)
{
printf (" using ");
if (qsys->uuconf_zport != NULL)
printf ("port %s", qsys->uuconf_zport);
else
printf ("a specially defined port");
if (qsys->uuconf_ibaud != 0)
{
printf (" at speed %ld", qsys->uuconf_ibaud);
if (qsys->uuconf_ihighbaud != 0)
printf (" to %ld", qsys->uuconf_ihighbaud);
}
printf ("\n");
}
else if (qsys->uuconf_ibaud != 0)
{
printf (" at speed %ld", qsys->uuconf_ibaud);
if (qsys->uuconf_ihighbaud != 0)
printf (" to %ld", qsys->uuconf_ihighbaud);
printf ("\n");
}
else
printf (" using any port\n");
si.puuconf = puuconf;
si.qsys = qsys;
si.fgot = FALSE;
if (qsys->uuconf_qport != NULL)
{
printf (" The port is defined as:\n");
(void) ikshow_port (qsys->uuconf_qport, (pointer) &si);
}
else
{
struct uuconf_port sdummy;
printf (" The possible ports are:\n");
iret = uuconf_find_port (puuconf, qsys->uuconf_zport,
qsys->uuconf_ibaud,
qsys->uuconf_ihighbaud,
ikshow_port, (pointer) &si,
&sdummy);
if (iret != UUCONF_NOT_FOUND)
ukuuconf_error (puuconf, iret);
if (! si.fgot)
printf (" *** There are no matching ports\n");
}
if (qsys->uuconf_zphone != NULL)
{
if ((qsys->uuconf_zport != NULL
&& strcmp (qsys->uuconf_zport, "TCP") == 0)
|| (qsys->uuconf_qport != NULL
&& (qsys->uuconf_qport->uuconf_ttype
== UUCONF_PORTTYPE_TCP
|| qsys->uuconf_qport->uuconf_ttype
== UUCONF_PORTTYPE_TLI)))
printf (" Remote address %s\n", qsys->uuconf_zphone);
else
printf (" Phone number %s\n", qsys->uuconf_zphone);
}
ukshow_chat (&qsys->uuconf_schat, " Chat");
if (qsys->uuconf_zcall_login != NULL
|| qsys->uuconf_zcall_password != NULL)
{
char *zlogin, *zpass;
iret = uuconf_callout (puuconf, qsys, &zlogin, &zpass);
if (iret == UUCONF_NOT_FOUND)
printf (" Can not determine login name or password\n");
else if (UUCONF_ERROR_VALUE (iret) == UUCONF_FOPEN_FAILED)
printf (" Can not read call out file\n");
else if (iret != UUCONF_SUCCESS)
ukuuconf_error (puuconf, iret);
else
{
if (zlogin != NULL)
{
printf (" Login name %s\n", zlogin);
free ((pointer) zlogin);
}
if (zpass != NULL)
{
printf (" Password %s\n", zpass);
free ((pointer) zpass);
}
}
}
qtime = qcompress_span (qsys->uuconf_qtimegrade);
for (qspan = qtime; qspan != NULL; qspan = qspan->uuconf_qnext)
{
printf (" ");
ukshow_time (qspan);
printf (" may call if ");
if ((char) qspan->uuconf_ival == UUCONF_GRADE_LOW)
printf ("any work");
else
printf ("work grade %c or higher", (char) qspan->uuconf_ival);
if (qspan->uuconf_cretry != 0)
printf (" (retry %d)", qspan->uuconf_cretry);
printf ("\n");
}
if (qsys->uuconf_cmax_retries > 0)
printf (" May retry the call up to %d times\n",
qsys->uuconf_cmax_retries);
if (qsys->uuconf_qcalltimegrade != NULL)
{
boolean fprint, fother;
qtime = qcompress_span (qsys->uuconf_qcalltimegrade);
fprint = FALSE;
fother = FALSE;
if (qtime->uuconf_istart != 0)
fother = TRUE;
for (qspan = qtime; qspan != NULL; qspan = qspan->uuconf_qnext)
{
if ((char) qspan->uuconf_ival == UUCONF_GRADE_LOW)
{
fother = TRUE;
continue;
}
fprint = TRUE;
printf (" ");
ukshow_time (qspan);
printf (" may accept work grade %c or higher\n",
(char) qspan->uuconf_ival);
if (qspan->uuconf_qnext == NULL)
{
if (qspan->uuconf_iend != 7 * 24 * 60)
fother = TRUE;
}
else
{
if (qspan->uuconf_iend
!= qspan->uuconf_qnext->uuconf_istart)
fother = TRUE;
}
}
if (fprint && fother)
printf (" (At other times may accept any work)\n");
}
}
if (fcalled)
{
if (qsys->uuconf_qcalledtimegrade != NULL)
{
boolean fprint, fother;
qtime = qcompress_span (qsys->uuconf_qcalledtimegrade);
fprint = FALSE;
fother = FALSE;
if (qtime->uuconf_istart != 0)
fother = TRUE;
for (qspan = qtime; qspan != NULL; qspan = qspan->uuconf_qnext)
{
if ((char) qspan->uuconf_ival == UUCONF_GRADE_LOW)
{
fother = TRUE;
continue;
}
fprint = TRUE;
printf (" ");
ukshow_time (qspan);
printf (" will send work grade %c or higher\n",
(char) qspan->uuconf_ival);
if (qspan->uuconf_qnext == NULL)
{
if (qspan->uuconf_iend != 7 * 24 * 60)
fother = TRUE;
}
else
{
if (qspan->uuconf_iend
!= qspan->uuconf_qnext->uuconf_istart)
fother = TRUE;
}
}
if (fprint && fother)
printf (" (At other times will send any work)\n");
}
}
if (fcall && qsys->uuconf_csuccess_wait != 0)
printf (" Will wait %d seconds after a successful call\n",
qsys->uuconf_csuccess_wait);
if (qsys->uuconf_fsequence)
printf (" Sequence numbers are used\n");
if (fcalled)
ukshow_chat (&qsys->uuconf_scalled_chat, " When called, chat");
if (qsys->uuconf_zdebug != NULL)
printf (" Debugging level %s\n", qsys->uuconf_zdebug);
if (qsys->uuconf_zmax_remote_debug != NULL)
printf (" Max remote debugging level %s\n",
qsys->uuconf_zmax_remote_debug);
if (fcall)
{
ukshow_size (qsys->uuconf_qcall_local_size, TRUE, TRUE);
ukshow_size (qsys->uuconf_qcall_remote_size, TRUE, FALSE);
}
if (fcalled)
{
ukshow_size (qsys->uuconf_qcalled_local_size, FALSE, TRUE);
ukshow_size (qsys->uuconf_qcalled_remote_size, FALSE, FALSE);
}
if (fcall)
printf (" May %smake local requests when calling\n",
qsys->uuconf_fcall_transfer ? "" : "not ");
if (fcalled)
printf (" May %smake local requests when called\n",
qsys->uuconf_fcalled_transfer ? "" : "not ");
if (qsys->uuconf_fcall_transfer || qsys->uuconf_fcalled_transfer)
{
printf (" May send by local request:");
for (pz = qsys->uuconf_pzlocal_send; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (! qsys->uuconf_fsend_request)
printf (" May not send files by remote request\n");
else
{
printf (" May send by remote request:");
for (pz = qsys->uuconf_pzremote_send; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qsys->uuconf_fcall_transfer || qsys->uuconf_fcalled_transfer)
{
printf (" May accept by local request:");
for (pz = qsys->uuconf_pzlocal_receive; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (! qsys->uuconf_frec_request)
printf (" May not receive files by remote request\n");
else
{
printf (" May receive by remote request:");
for (pz = qsys->uuconf_pzremote_receive; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
printf (" May execute");
for (pz = qsys->uuconf_pzcmds; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
printf (" Execution path");
for (pz = qsys->uuconf_pzpath; *pz != NULL; pz++)
printf (" %s" , *pz);
printf ("\n");
if (qsys->uuconf_cfree_space != 0)
printf (" Will leave %ld bytes available\n", qsys->uuconf_cfree_space);
if (qsys->uuconf_zpubdir != NULL)
printf (" Public directory is %s\n", qsys->uuconf_zpubdir);
if (qsys->uuconf_pzforward_from != NULL)
{
printf (" May forward from");
for (pz = qsys->uuconf_pzforward_from; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qsys->uuconf_pzforward_to != NULL)
{
printf (" May forward to");
for (pz = qsys->uuconf_pzforward_to; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qsys->uuconf_cmax_file_time > 0)
printf (" Maximum file send time: %ld\n", qsys->uuconf_cmax_file_time);
if (qsys->uuconf_zprotocols != NULL)
printf (" Will use protocols %s\n", qsys->uuconf_zprotocols);
else
printf (" Will use any known protocol\n");
if (qsys->uuconf_qproto_params != NULL)
ukshow_proto_params (qsys->uuconf_qproto_params, 1);
}
if (! fanycall)
printf (" Calls will never be placed to this system\n");
}
/* Show information about a port. */
/*ARGSUSED*/
static int
ikshow_port (struct uuconf_port *qport, pointer pinfo)
{
struct sinfo *qi = (struct sinfo *) pinfo;
char **pz;
struct uuconf_modem_port *qmodem;
struct uuconf_tcp_port *qtcp;
struct uuconf_tli_port *qtli;
struct uuconf_pipe_port *qpipe;
qi->fgot = TRUE;
printf (" Port name %s\n", qport->uuconf_zname);
switch (qport->uuconf_ttype)
{
case UUCONF_PORTTYPE_STDIN:
printf (" Port type stdin\n");
break;
case UUCONF_PORTTYPE_DIRECT:
printf (" Port type direct\n");
if (qport->uuconf_u.uuconf_sdirect.uuconf_zdevice != NULL)
printf (" Device %s\n",
qport->uuconf_u.uuconf_sdirect.uuconf_zdevice);
else
printf (" Using port name as device name\n");
printf (" Speed %ld\n", qport->uuconf_u.uuconf_sdirect.uuconf_ibaud);
printf (" Carrier %savailable\n",
qport->uuconf_u.uuconf_sdirect.uuconf_fcarrier ? "" : "not ");
printf (" Hardware flow control %savailable\n",
qport->uuconf_u.uuconf_sdirect.uuconf_fhardflow ? "" : "not ");
break;
case UUCONF_PORTTYPE_MODEM:
qmodem = &qport->uuconf_u.uuconf_smodem;
printf (" Port type modem\n");
if (qmodem->uuconf_zdevice != NULL)
printf (" Device %s\n", qmodem->uuconf_zdevice);
else
printf (" Using port name as device name\n");
if (qmodem->uuconf_zdial_device != NULL)
printf (" Dial device %s\n", qmodem->uuconf_zdial_device);
printf (" Speed %ld\n", qmodem->uuconf_ibaud);
if (qmodem->uuconf_ilowbaud != qmodem->uuconf_ihighbaud)
printf (" Speed range %ld to %ld\n", qmodem->uuconf_ilowbaud,
qmodem->uuconf_ihighbaud);
printf (" Carrier %savailable\n",
qmodem->uuconf_fcarrier ? "" : "not ");
printf (" Hardware flow control %savailable\n",
qmodem->uuconf_fhardflow ? "" : "not ");
if (qmodem->uuconf_qdialer != NULL)
{
printf (" Specially defined dialer\n");
ukshow_dialer (qmodem->uuconf_qdialer);
}
else if (qmodem->uuconf_pzdialer != NULL
&& qmodem->uuconf_pzdialer[0] != NULL)
{
struct uuconf_dialer sdial;
int iret;
/* This might be a single dialer name, or it might be a
sequence of dialer/token pairs. */
if (qmodem->uuconf_pzdialer[1] == NULL
|| qmodem->uuconf_pzdialer[2] == NULL)
{
iret = uuconf_dialer_info (qi->puuconf,
qmodem->uuconf_pzdialer[0],
&sdial);
if (iret == UUCONF_NOT_FOUND)
printf (" *** No dialer %s\n", qmodem->uuconf_pzdialer[0]);
else if (iret != UUCONF_SUCCESS)
ukuuconf_error (qi->puuconf, iret);
else
{
printf (" Dialer %s\n", qmodem->uuconf_pzdialer[0]);
ukshow_dialer (&sdial);
if (qmodem->uuconf_pzdialer[1] != NULL)
printf (" Token %s\n", qmodem->uuconf_pzdialer[1]);
}
}
else
{
pz = qmodem->uuconf_pzdialer;
while (*pz != NULL)
{
iret = uuconf_dialer_info (qi->puuconf, *pz, &sdial);
if (iret == UUCONF_NOT_FOUND)
printf (" *** No dialer %s\n", *pz);
else if (iret != UUCONF_SUCCESS)
ukuuconf_error (qi->puuconf, iret);
else
{
printf (" Dialer %s\n", *pz);
ukshow_dialer (&sdial);
}
++pz;
if (*pz != NULL)
{
printf (" Token %s\n", *pz);
++pz;
}
}
}
}
else
printf (" *** No dialer information\n");
break;
case UUCONF_PORTTYPE_TCP:
qtcp = &qport->uuconf_u.uuconf_stcp;
printf (" Port type tcp\n");
printf (" TCP service %s\n", qtcp->uuconf_zport);
if (qtcp->uuconf_iversion != 0)
printf (" IP version %d\n", qtcp->uuconf_iversion);
if (qtcp->uuconf_pzdialer != NULL
&& qtcp->uuconf_pzdialer[0] != NULL)
{
printf (" Dialer sequence");
for (pz = qtcp->uuconf_pzdialer; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
break;
case UUCONF_PORTTYPE_TLI:
qtli = &qport->uuconf_u.uuconf_stli;
printf (" Port type TLI%s\n",
qtli->uuconf_fstream ? "S" : "");
if (qtli->uuconf_zdevice != NULL)
printf (" Device %s\n", qtli->uuconf_zdevice);
else
printf (" Using port name as device name\n");
if (qtli->uuconf_pzpush != NULL)
{
printf (" Push");
for (pz = qtli->uuconf_pzpush; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qtli->uuconf_pzdialer != NULL
&& qtli->uuconf_pzdialer[0] != NULL)
{
printf (" Dialer sequence");
for (pz = qtli->uuconf_pzdialer; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qtli->uuconf_zservaddr != NULL)
printf (" Server address %s\n", qtli->uuconf_zservaddr);
break;
case UUCONF_PORTTYPE_PIPE:
qpipe = &qport->uuconf_u.uuconf_spipe;
printf (" Port type pipe\n");
if (qpipe->uuconf_pzcmd != NULL)
{
printf (" Command");
for (pz = qpipe->uuconf_pzcmd; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
break;
default:
fprintf (stderr, " CAN'T HAPPEN\n");
break;
}
if (qport->uuconf_zprotocols != NULL)
printf (" Will use protocols %s\n", qport->uuconf_zprotocols);
if (qport->uuconf_zlockname != NULL)
printf (" Will use lockname %s\n", qport->uuconf_zlockname);
if ((qport->uuconf_ireliable & UUCONF_RELIABLE_SPECIFIED) != 0)
ukshow_reliable (qport->uuconf_ireliable, " ");
if (qport->uuconf_qproto_params != NULL)
ukshow_proto_params (qport->uuconf_qproto_params, 3);
/* Return NOT_FOUND to force find_port to continue searching. */
return UUCONF_NOT_FOUND;
}
/* Show information about a dialer. */
static void
ukshow_dialer (struct uuconf_dialer *q)
{
ukshow_chat (&q->uuconf_schat, " Chat");
printf (" Wait for dialtone %s\n", q->uuconf_zdialtone);
printf (" Pause while dialing %s\n", q->uuconf_zpause);
printf (" Carrier %savailable\n", q->uuconf_fcarrier ? "" : "not ");
if (q->uuconf_fcarrier)
printf (" Wait %d seconds for carrier\n", q->uuconf_ccarrier_wait);
if (q->uuconf_fdtr_toggle)
{
printf (" Toggle DTR");
if (q->uuconf_fdtr_toggle_wait)
printf (" and wait");
printf ("\n");
}
ukshow_chat (&q->uuconf_scomplete, " When complete chat");
ukshow_chat (&q->uuconf_sabort, " When aborting chat");
if ((q->uuconf_ireliable & UUCONF_RELIABLE_SPECIFIED) != 0)
ukshow_reliable (q->uuconf_ireliable, " ");
if (q->uuconf_qproto_params != NULL)
ukshow_proto_params (q->uuconf_qproto_params, 4);
}
/* Show a chat script. */
static void
ukshow_chat (const struct uuconf_chat *qchat, const char *zhdr)
{
char **pz;
if (qchat->uuconf_pzprogram != NULL)
{
printf ("%s program", zhdr);
for (pz = qchat->uuconf_pzprogram; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qchat->uuconf_pzchat != NULL)
{
printf ("%s script", zhdr);
for (pz = qchat->uuconf_pzchat; *pz != NULL; pz++)
{
if ((*pz)[0] != '-' || pz == qchat->uuconf_pzchat)
printf (" ");
printf ("%s", *pz);
}
printf ("\n");
printf ("%s script timeout %d\n", zhdr, qchat->uuconf_ctimeout);
if (qchat->uuconf_pzfail != NULL)
{
printf ("%s failure strings", zhdr);
for (pz = qchat->uuconf_pzfail; *pz != NULL; pz++)
printf (" %s", *pz);
printf ("\n");
}
if (qchat->uuconf_fstrip)
printf ("%s script incoming bytes stripped to seven bits\n", zhdr);
}
}
/* Show a size/time restriction. */