Annotation of coherent/g/usr/lib/uucp/tay104/uuchk.c, revision 1.1.1.1

1.1       root        1: /* uuchk.c
                      2:    Display what we think the permissions of systems are.
                      3: 
                      4:    Copyright (C) 1991, 1992 Ian Lance Taylor
                      5: 
                      6:    This file is part of the Taylor UUCP package.
                      7: 
                      8:    This program is free software; you can redistribute it and/or
                      9:    modify it under the terms of the GNU General Public License as
                     10:    published by the Free Software Foundation; either version 2 of the
                     11:    License, or (at your option) any later version.
                     12: 
                     13:    This program 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:    General Public License for more details.
                     17: 
                     18:    You should have received a copy of the GNU General Public License
                     19:    along with this program; 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 "uucp.h"
                     27: 
                     28: #if USE_RCS_ID
                     29: const char uuchk_rcsid[] = "$Id: uuchk.c,v 1.1 93/07/30 07:54:31 bin Exp Locker: bin $";
                     30: #endif
                     31: 
                     32: #include "getopt.h"
                     33: 
                     34: #include "uuconf.h"
                     35: 
                     36: /* Local functions.  */
                     37: 
                     38: static void ukusage P((void));
                     39: static void ukshow P((const struct uuconf_system *qsys,
                     40:                      pointer puuconf));
                     41: static int ikshow_port P((struct uuconf_port *qport, pointer pinfo));
                     42: static void ukshow_dialer P((struct uuconf_dialer *qdial));
                     43: static void ukshow_chat P((const struct uuconf_chat *qchat,
                     44:                           const char *zhdr));
                     45: static void ukshow_size P((struct uuconf_timespan *q, boolean fcall,
                     46:                           boolean flocal));
                     47: static void ukshow_proto_params P((struct uuconf_proto_param *pas,
                     48:                                   int cindent));
                     49: static void ukshow_time P((const struct uuconf_timespan *));
                     50: static struct uuconf_timespan *qcompress_span P((struct uuconf_timespan *));
                     51: static void ukuuconf_error P((pointer puuconf, int iret));
                     52: 
                     53: /* Structure used to pass uuconf pointer into ikshow_port and also let
                     54:    it record whether any ports were found.  */
                     55: struct sinfo
                     56: {
                     57:   /* The uuconf global pointer.  */
                     58:   pointer puuconf;
                     59:   /* The system.  */
                     60:   const struct uuconf_system *qsys;
                     61:   /* Whether any ports were seen.  */
                     62:   boolean fgot;
                     63: };
                     64: 
                     65: /* Long getopt options.  */
                     66: static const struct option asKlongopts[] = { { NULL, 0, NULL, 0 } };
                     67: 
                     68: int
                     69: main (argc, argv)
                     70:      int argc;
                     71:      char **argv;
                     72: {
                     73:   int iopt;
                     74:   /* The configuration file name.  */
                     75:   const char *zconfig = NULL;
                     76:   int iret;
                     77:   pointer puuconf;
                     78:   char **pzsystems;
                     79: 
                     80:   while ((iopt = getopt_long (argc, argv, "I:x:", asKlongopts,
                     81:                              (int *) NULL)) != EOF)
                     82:     {
                     83:       switch (iopt)
                     84:        {
                     85:        case 'I':
                     86:          /* Set the configuration file name.  */
                     87:          zconfig = optarg;
                     88:          break;
                     89: 
                     90:        case 'x':
                     91:          /* Set the debugging level.  There is actually no debugging
                     92:             information for this program.  */
                     93:          break;
                     94: 
                     95:        case 0:
                     96:          /* Long option found and flag set.  */
                     97:          break;
                     98: 
                     99:        default:
                    100:          ukusage ();
                    101:          break;
                    102:        }
                    103:     }
                    104: 
                    105:   if (optind != argc)
                    106:     ukusage ();
                    107: 
                    108:   iret = uuconf_init (&puuconf, (const char *) NULL, zconfig);
                    109:   if (iret != UUCONF_SUCCESS)
                    110:     ukuuconf_error (puuconf, iret);
                    111: 
                    112:   iret = uuconf_system_names (puuconf, &pzsystems, FALSE);
                    113:   if (iret != UUCONF_SUCCESS)
                    114:     ukuuconf_error (puuconf, iret);
                    115: 
                    116:   while (*pzsystems != NULL)
                    117:     {
                    118:       struct uuconf_system ssys;
                    119: 
                    120:       iret = uuconf_system_info (puuconf, *pzsystems, &ssys);
                    121:       if (iret != UUCONF_SUCCESS)
                    122:        ukuuconf_error (puuconf, iret);
                    123:       else
                    124:        ukshow (&ssys, puuconf);
                    125:       (void) uuconf_system_free (puuconf, &ssys);
                    126:       ++pzsystems;
                    127:       if (*pzsystems != NULL)
                    128:        printf ("\n");
                    129:     }
                    130: 
                    131:   exit (EXIT_SUCCESS);
                    132: 
                    133:   /* Avoid errors about not returning a value.  */
                    134:   return 0;
                    135: }
                    136: 
                    137: /* Print a usage message and die.  */
                    138: 
                    139: static void
                    140: ukusage ()
                    141: {
                    142:   fprintf (stderr,
                    143:           "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n",
                    144:           VERSION);
                    145:   fprintf (stderr,
                    146:           "Usage: uuchk [-I file]\n");
                    147:   fprintf (stderr,
                    148:           " -I file: Set configuration file to use\n");
                    149:   exit (EXIT_FAILURE);
                    150: }
                    151: 
                    152: /* Dump out the information for a system.  */
                    153: 
                    154: static void
                    155: ukshow (qsys, puuconf)
                    156:      const struct uuconf_system *qsys;
                    157:      pointer puuconf;
                    158: {
                    159:   char **pz;
                    160:   int i;
                    161:   int iret;
                    162: 
                    163:   printf ("System: %s", qsys->uuconf_zname);
                    164:   if (qsys->uuconf_pzalias != NULL)
                    165:     {
                    166:       printf (" (");
                    167:       for (pz = qsys->uuconf_pzalias; *pz != NULL; pz++)
                    168:        {
                    169:          printf ("%s", *pz);
                    170:          if (pz[1] != NULL)
                    171:            printf (" ");
                    172:        }
                    173:       printf (")");
                    174:     }
                    175:   printf ("\n");
                    176: 
                    177:   for (i = 0; qsys != NULL; qsys = qsys->uuconf_qalternate, i++)
                    178:     {
                    179:       boolean fcall, fcalled;
                    180:       struct uuconf_timespan *qtime, *qspan;
                    181: 
                    182:       if (i != 0 || qsys->uuconf_qalternate != NULL)
                    183:        {
                    184:          printf ("Alternate %d", i);
                    185:          if (qsys->uuconf_zalternate != NULL)
                    186:            printf (" (%s)", qsys->uuconf_zalternate);
                    187:          printf ("\n");
                    188:        }
                    189: 
                    190:       /* See if this alternate could be used when calling out.  */
                    191:       fcall = qsys->uuconf_fcall;
                    192:       if (qsys->uuconf_qtimegrade == NULL)
                    193:        fcall = FALSE;
                    194: 
                    195:       /* See if this alternate could be used when calling in.  */
                    196:       fcalled = qsys->uuconf_fcalled;
                    197: 
                    198:       if (! fcall && ! fcalled)
                    199:        {
                    200:          printf (" This alternate is never used\n");
                    201:          continue;
                    202:        }
                    203: 
                    204:       if (fcalled)
                    205:        {
                    206:          if (qsys->uuconf_zcalled_login != NULL
                    207:              && strcmp (qsys->uuconf_zcalled_login, "ANY") != 0)
                    208:            {
                    209:              if (i == 0 && qsys->uuconf_qalternate == NULL)
                    210:                printf (" Caller must log in as %s\n",
                    211:                        qsys->uuconf_zcalled_login);
                    212:              else
                    213:                printf (" When called using login name %s\n",
                    214:                        qsys->uuconf_zcalled_login);
                    215:            }
                    216:          else
                    217:            printf (" When called using any login name\n");
                    218: 
                    219:          if (qsys->uuconf_zlocalname != NULL)
                    220:            printf (" Will use %s as name of local system\n",
                    221:                    qsys->uuconf_zlocalname);
                    222:        }
                    223: 
                    224:       if (fcalled && qsys->uuconf_fcallback)
                    225:        {
                    226:          printf (" If called, will call back\n");
                    227:          fcalled = FALSE;
                    228:        }
                    229: 
                    230:       if (fcall)
                    231:        {
                    232:          struct sinfo si;
                    233: 
                    234:          if (i == 0 && qsys->uuconf_qalternate == NULL)
                    235:            printf (" Call out");
                    236:          else
                    237:            printf (" This alternate applies when calling");
                    238:          
                    239:          if (qsys->uuconf_zport != NULL || qsys->uuconf_qport != NULL)
                    240:            {
                    241:              printf (" using ");
                    242:              if (qsys->uuconf_zport != NULL)
                    243:                printf ("port %s", qsys->uuconf_zport);
                    244:              else
                    245:                printf ("a specially defined port");
                    246:              if (qsys->uuconf_ibaud != 0)
                    247:                {
                    248:                  printf (" at speed %ld", qsys->uuconf_ibaud);
                    249:                  if (qsys->uuconf_ihighbaud != 0)
                    250:                    printf (" to %ld", qsys->uuconf_ihighbaud);
                    251:                }
                    252:              printf ("\n");
                    253:            }
                    254:          else if (qsys->uuconf_ibaud != 0)
                    255:            {
                    256:              printf (" at speed %ld", qsys->uuconf_ibaud);
                    257:              if (qsys->uuconf_ihighbaud != 0)
                    258:                printf (" to %ld", qsys->uuconf_ihighbaud);
                    259:              printf ("\n");
                    260:            }
                    261:          else
                    262:            printf (" using any port\n");
                    263: 
                    264:          si.puuconf = puuconf;
                    265:          si.qsys = qsys;
                    266:          si.fgot = FALSE;
                    267: 
                    268:          if (qsys->uuconf_qport != NULL)
                    269:            {
                    270:              printf (" The port is defined as:\n");
                    271:              (void) ikshow_port (qsys->uuconf_qport, (pointer) &si);
                    272:            }
                    273:          else
                    274:            {
                    275:              struct uuconf_port sdummy;
                    276: 
                    277:              printf (" The possible ports are:\n");
                    278:              iret = uuconf_find_port (puuconf, qsys->uuconf_zport,
                    279:                                       qsys->uuconf_ibaud,
                    280:                                       qsys->uuconf_ihighbaud,
                    281:                                       ikshow_port, (pointer) &si,
                    282:                                       &sdummy);
                    283:              if (iret != UUCONF_NOT_FOUND)
                    284:                ukuuconf_error (puuconf, iret);
                    285:              if (! si.fgot)
                    286:                printf (" *** There are no matching ports\n");
                    287:            }
                    288: 
                    289:          if (qsys->uuconf_zphone != NULL)
                    290:            {
                    291:              if ((qsys->uuconf_zport != NULL
                    292:                   && strcmp (qsys->uuconf_zport, "TCP") == 0)
                    293:                  || (qsys->uuconf_qport != NULL
                    294:                      && (qsys->uuconf_qport->uuconf_ttype
                    295:                          == UUCONF_PORTTYPE_TCP
                    296:                          || qsys->uuconf_qport->uuconf_ttype
                    297:                          == UUCONF_PORTTYPE_TLI)))
                    298:                printf (" Remote address %s\n", qsys->uuconf_zphone);
                    299:              else
                    300:                printf (" Phone number %s\n", qsys->uuconf_zphone);
                    301:            }
                    302: 
                    303:          ukshow_chat (&qsys->uuconf_schat, " Chat");
                    304: 
                    305:          if (qsys->uuconf_zcall_login != NULL
                    306:              || qsys->uuconf_zcall_password != NULL)
                    307:            {
                    308:              char *zlogin, *zpass;
                    309: 
                    310:              iret = uuconf_callout (puuconf, qsys, &zlogin, &zpass);
                    311:              if (iret == UUCONF_NOT_FOUND)
                    312:                printf (" Can not determine login name or password\n");
                    313:              else if (iret != UUCONF_SUCCESS)
                    314:                ukuuconf_error (puuconf, iret);
                    315:              else
                    316:                {
                    317:                  if (zlogin != NULL)
                    318:                    {
                    319:                      printf (" Login name %s\n", zlogin);
                    320:                      free ((pointer) zlogin);
                    321:                    }
                    322:                  if (zpass != NULL)
                    323:                    {
                    324:                      printf (" Password %s\n", zpass);
                    325:                      free ((pointer) zpass);
                    326:                    }
                    327:                }
                    328:            }
                    329: 
                    330:          qtime = qcompress_span (qsys->uuconf_qtimegrade);
                    331: 
                    332:          for (qspan = qtime; qspan != NULL; qspan = qspan->uuconf_qnext)
                    333:            {
                    334:              printf (" ");
                    335:              ukshow_time (qspan);
                    336:              printf (" may call if ");
                    337:              if ((char) qspan->uuconf_ival == UUCONF_GRADE_LOW)
                    338:                printf ("any work");
                    339:              else
                    340:                printf ("work grade %c or higher", (char) qspan->uuconf_ival);
                    341:              if (qspan->uuconf_cretry != 0)
                    342:                printf (" (retry %d)", qspan->uuconf_cretry);
                    343:              printf ("\n");
                    344:            }
                    345: 
                    346:          if (qsys->uuconf_qcalltimegrade != NULL)
                    347:            {
                    348:              boolean fprint, fother;
                    349: 
                    350:              qtime = qcompress_span (qsys->uuconf_qcalltimegrade);
                    351:              fprint = FALSE;
                    352:              fother = FALSE;
                    353:              if (qtime->uuconf_istart != 0)
                    354:                fother = TRUE;
                    355:              for (qspan = qtime; qspan != NULL; qspan = qspan->uuconf_qnext)
                    356:                {
                    357:                  if ((char) qspan->uuconf_ival == UUCONF_GRADE_LOW)
                    358:                    {
                    359:                      fother = TRUE;
                    360:                      continue;
                    361:                    }
                    362:                  fprint = TRUE;
                    363:                  printf (" ");
                    364:                  ukshow_time (qspan);
                    365:                  printf (" may accept work grade %c or higher\n",
                    366:                          (char) qspan->uuconf_ival);
                    367:                  if (qspan->uuconf_qnext == NULL)
                    368:                    {
                    369:                      if (qspan->uuconf_iend != 7 * 24 * 60)
                    370:                        fother = TRUE;
                    371:                    }
                    372:                  else
                    373:                    {
                    374:                      if (qspan->uuconf_iend
                    375:                          != qspan->uuconf_qnext->uuconf_istart)
                    376:                        fother = TRUE;
                    377:                    }
                    378:                }
                    379:              if (fprint && fother)
                    380:                printf (" (At other times may accept any work)\n");
                    381:            }
                    382:        }
                    383: 
                    384:       if (qsys->uuconf_fsequence)
                    385:        printf (" Sequence numbers are used\n");
                    386: 
                    387:       if (fcalled)
                    388:        ukshow_chat (&qsys->uuconf_scalled_chat, " When called, chat");
                    389: 
                    390:       if (qsys->uuconf_zdebug != NULL)
                    391:        printf (" Debugging level %s\n", qsys->uuconf_zdebug);
                    392:       if (qsys->uuconf_zmax_remote_debug != NULL)
                    393:        printf (" Max remote debugging level %s\n",
                    394:                qsys->uuconf_zmax_remote_debug);
                    395: 
                    396:       if (fcall)
                    397:        {
                    398:          ukshow_size (qsys->uuconf_qcall_local_size, TRUE, TRUE);
                    399:          ukshow_size (qsys->uuconf_qcall_remote_size, TRUE, FALSE);
                    400:        }
                    401:       if (fcalled)
                    402:        {
                    403:          ukshow_size (qsys->uuconf_qcalled_local_size, FALSE, TRUE);
                    404:          ukshow_size (qsys->uuconf_qcalled_remote_size, FALSE, TRUE);
                    405:        }
                    406: 
                    407:       if (fcall)
                    408:        printf (" May %smake local requests when calling\n",
                    409:                qsys->uuconf_fcall_transfer ? "" : "not ");
                    410: 
                    411:       if (fcalled)
                    412:        printf (" May %smake local requests when called\n",
                    413:                qsys->uuconf_fcalled_transfer ? "" : "not ");
                    414: 
                    415:       if (qsys->uuconf_fcall_transfer || qsys->uuconf_fcalled_transfer)
                    416:        {
                    417:          printf (" May send by local request:");
                    418:          for (pz = qsys->uuconf_pzlocal_send; *pz != NULL; pz++)
                    419:            printf (" %s", *pz);
                    420:          printf ("\n");
                    421:        }
                    422:       if (! qsys->uuconf_fsend_request)
                    423:        printf (" May not send files by remote request\n");
                    424:       else
                    425:        {
                    426:          printf (" May send by remote request:");
                    427:          for (pz = qsys->uuconf_pzremote_send; *pz != NULL; pz++)
                    428:            printf (" %s", *pz);
                    429:          printf ("\n");
                    430:        }
                    431:       if (qsys->uuconf_fcall_transfer || qsys->uuconf_fcalled_transfer)
                    432:        {
                    433:          printf (" May accept by local request:");
                    434:          for (pz = qsys->uuconf_pzlocal_receive; *pz != NULL; pz++)
                    435:            printf (" %s", *pz);
                    436:          printf ("\n");
                    437:        }
                    438:       if (! qsys->uuconf_frec_request)
                    439:        printf (" May not receive files by remote request\n");
                    440:       else
                    441:        {
                    442:          printf (" May receive by remote request:");
                    443:          for (pz = qsys->uuconf_pzremote_receive; *pz != NULL; pz++)
                    444:            printf (" %s", *pz);
                    445:          printf ("\n");
                    446:        }
                    447: 
                    448:       printf (" May execute");
                    449:       for (pz = qsys->uuconf_pzcmds; *pz != NULL; pz++)
                    450:        printf (" %s", *pz);
                    451:       printf ("\n");
                    452: 
                    453:       printf (" Execution path");
                    454:       for (pz = qsys->uuconf_pzpath; *pz != NULL; pz++)
                    455:        printf (" %s" , *pz);
                    456:       printf ("\n");
                    457: 
                    458:       if (qsys->uuconf_cfree_space != 0)
                    459:        printf (" Will leave %ld bytes available\n", qsys->uuconf_cfree_space);
                    460: 
                    461:       if (qsys->uuconf_zpubdir != NULL)
                    462:        printf (" Public directory is %s\n", qsys->uuconf_zpubdir);
                    463: 
                    464:       if (qsys->uuconf_pzforward_from != NULL)
                    465:        {
                    466:          printf (" May forward from");
                    467:          for (pz = qsys->uuconf_pzforward_from; *pz != NULL; pz++)
                    468:            printf (" %s", *pz);
                    469:          printf ("\n");
                    470:        }
                    471:          
                    472:       if (qsys->uuconf_pzforward_to != NULL)
                    473:        {
                    474:          printf (" May forward to");
                    475:          for (pz = qsys->uuconf_pzforward_to; *pz != NULL; pz++)
                    476:            printf (" %s", *pz);
                    477:          printf ("\n");
                    478:        }
                    479:          
                    480:       if (qsys->uuconf_zprotocols != NULL)
                    481:        printf (" Will use protocols %s\n", qsys->uuconf_zprotocols);
                    482:       else
                    483:        printf (" Will use any known protocol\n");
                    484: 
                    485:       if (qsys->uuconf_qproto_params != NULL)
                    486:        ukshow_proto_params (qsys->uuconf_qproto_params, 1);
                    487:     }
                    488: }
                    489: 
                    490: /* Show information about a port.  */
                    491: 
                    492: /*ARGSUSED*/
                    493: static int
                    494: ikshow_port (qport, pinfo)
                    495:      struct uuconf_port *qport;
                    496:      pointer pinfo;
                    497: {
                    498:   struct sinfo *qi = (struct sinfo *) pinfo;
                    499:   char **pz;
                    500:   struct uuconf_modem_port *qmodem;
                    501:   struct uuconf_tli_port *qtli;
                    502: 
                    503:   qi->fgot = TRUE;
                    504: 
                    505:   printf ("  Port name %s\n", qport->uuconf_zname);
                    506:   switch (qport->uuconf_ttype)
                    507:     {
                    508:     case UUCONF_PORTTYPE_STDIN:
                    509:       printf ("   Port type stdin\n");
                    510:       break;
                    511:     case UUCONF_PORTTYPE_DIRECT:
                    512:       printf ("   Port type direct\n");
                    513:       if (qport->uuconf_u.uuconf_sdirect.uuconf_zdevice != NULL)
                    514:        printf ("   Device %s\n",
                    515:                qport->uuconf_u.uuconf_sdirect.uuconf_zdevice);
                    516:       printf ("   Speed %ld\n", qport->uuconf_u.uuconf_sdirect.uuconf_ibaud);
                    517:       break;
                    518:     case UUCONF_PORTTYPE_MODEM:
                    519:       qmodem = &qport->uuconf_u.uuconf_smodem;
                    520:       printf ("   Port type modem\n");
                    521:       if (qmodem->uuconf_zdevice != NULL)
                    522:        printf ("   Device %s\n", qmodem->uuconf_zdevice);
                    523:       if (qmodem->uuconf_zdial_device != NULL)
                    524:        printf ("   Dial device %s\n", qmodem->uuconf_zdial_device);
                    525:       printf ("   Speed %ld\n", qmodem->uuconf_ibaud);
                    526:       if (qmodem->uuconf_ilowbaud != qmodem->uuconf_ihighbaud)
                    527:        printf ("   Speed range %ld to %ld\n", qmodem->uuconf_ilowbaud,
                    528:                qmodem->uuconf_ihighbaud);
                    529:       printf ("   Carrier %savailable\n",
                    530:              qmodem->uuconf_fcarrier ? "" : "not ");
                    531:       if (qmodem->uuconf_qdialer != NULL)
                    532:        {
                    533:          printf ("   Specially defined dialer\n");
                    534:          ukshow_dialer (qmodem->uuconf_qdialer);
                    535:        }
                    536:       else if (qmodem->uuconf_pzdialer != NULL
                    537:               && qmodem->uuconf_pzdialer[0] != NULL)
                    538:        {
                    539:          struct uuconf_dialer sdial;
                    540:          int iret;
                    541: 
                    542:          /* This might be a single dialer name, or it might be a
                    543:             sequence of dialer/token pairs.  */
                    544: 
                    545:          if (qmodem->uuconf_pzdialer[1] == NULL
                    546:              || qmodem->uuconf_pzdialer[2] == NULL)
                    547:            {
                    548:              iret = uuconf_dialer_info (qi->puuconf,
                    549:                                         qmodem->uuconf_pzdialer[0],
                    550:                                         &sdial);
                    551:              if (iret == UUCONF_NOT_FOUND)
                    552:                printf ("   *** No dialer %s\n", qmodem->uuconf_pzdialer[0]);
                    553:              else if (iret != UUCONF_SUCCESS)
                    554:                ukuuconf_error (qi->puuconf, iret);
                    555:              else
                    556:                {
                    557:                  printf ("   Dialer %s\n", qmodem->uuconf_pzdialer[0]);
                    558:                  ukshow_dialer (&sdial);
                    559:                  if (qmodem->uuconf_pzdialer[1] != NULL)
                    560:                    printf ("   Token %s\n", qmodem->uuconf_pzdialer[1]);
                    561:                }
                    562:            }
                    563:          else
                    564:            {
                    565:              pz = qmodem->uuconf_pzdialer;
                    566:              while (*pz != NULL)
                    567:                {
                    568:                  iret = uuconf_dialer_info (qi->puuconf, *pz, &sdial);
                    569:                  if (iret == UUCONF_NOT_FOUND)
                    570:                    printf ("   *** No dialer %s\n", *pz);
                    571:                  else if (iret != UUCONF_SUCCESS)
                    572:                    ukuuconf_error (qi->puuconf, iret);
                    573:                  else
                    574:                    {
                    575:                      printf ("   Dialer %s\n", *pz);
                    576:                      ukshow_dialer (&sdial);
                    577:                    }
                    578: 
                    579:                  ++pz;
                    580:                  if (*pz != NULL)
                    581:                    {
                    582:                      printf ("   Token %s\n", *pz);
                    583:                      ++pz;
                    584:                    }
                    585:                }
                    586:            }
                    587:        }
                    588:       else
                    589:        printf ("   *** No dialer information\n");
                    590:       break;
                    591:     case UUCONF_PORTTYPE_TCP:
                    592:       printf ("   Port type tcp\n");
                    593:       printf ("   TCP service %s\n",
                    594:              qport->uuconf_u.uuconf_stcp.uuconf_zport);
                    595:       break;
                    596:     case UUCONF_PORTTYPE_TLI:
                    597:       qtli = &qport->uuconf_u.uuconf_stli;
                    598:       printf ("   Port type TLI%s\n",
                    599:              qtli->uuconf_fstream ? "S" : "");
                    600:       if (qtli->uuconf_zdevice != NULL)
                    601:        printf ("   Device %s\n", qtli->uuconf_zdevice);
                    602:       if (qtli->uuconf_pzpush != NULL)
                    603:        {
                    604:          printf ("   Push");
                    605:          for (pz = qtli->uuconf_pzpush; *pz != NULL; pz++)
                    606:            printf (" %s", *pz);
                    607:          printf ("\n");
                    608:        }
                    609:       if (qtli->uuconf_pzdialer != NULL
                    610:          && qtli->uuconf_pzdialer[0] != NULL)
                    611:        {
                    612:          printf ("   Dialer sequence");
                    613:          for (pz = qtli->uuconf_pzdialer; *pz != NULL; pz++)
                    614:            printf (" %s", *pz);
                    615:          printf ("\n");
                    616:        }
                    617:       if (qtli->uuconf_zservaddr != NULL)
                    618:        printf ("   Server address %s\n", qtli->uuconf_zservaddr);
                    619:       break;
                    620:     default:
                    621:       fprintf (stderr, "   CAN'T HAPPEN\n");
                    622:       break;
                    623:     }
                    624: 
                    625:   if (qport->uuconf_zprotocols != NULL)
                    626:     printf ("   Will use protocols %s\n", qport->uuconf_zprotocols);
                    627: 
                    628:   if (qport->uuconf_zlockname != NULL)
                    629:     printf ("   Will use lockname %s\n", qport->uuconf_zlockname);
                    630: 
                    631:   if (qport->uuconf_qproto_params != NULL)
                    632:     ukshow_proto_params (qport->uuconf_qproto_params, 3);
                    633: 
                    634:   /* Return NOT_FOUND to force find_port to continue searching.  */
                    635:   return UUCONF_NOT_FOUND;
                    636: }
                    637: 
                    638: /* Show information about a dialer.  */
                    639: 
                    640: static void
                    641: ukshow_dialer (q)
                    642:      struct uuconf_dialer *q;
                    643: {
                    644:   ukshow_chat (&q->uuconf_schat, "    Chat");
                    645:   printf ("    Wait for dialtone %s\n", q->uuconf_zdialtone);
                    646:   printf ("    Pause while dialing %s\n", q->uuconf_zpause);
                    647:   printf ("    Carrier %savailable\n", q->uuconf_fcarrier ? "" : "not ");
                    648:   if (q->uuconf_fcarrier)
                    649:     printf ("    Wait %d seconds for carrier\n", q->uuconf_ccarrier_wait);
                    650:   if (q->uuconf_fdtr_toggle)
                    651:     {
                    652:       printf ("    Toggle DTR");
                    653:       if (q->uuconf_fdtr_toggle_wait)
                    654:        printf (" and wait");
                    655:       printf ("\n");
                    656:     }
                    657:   ukshow_chat (&q->uuconf_scomplete, "    When complete chat");
                    658:   ukshow_chat (&q->uuconf_sabort, "    When aborting chat");
                    659:   if (q->uuconf_qproto_params != NULL)
                    660:     ukshow_proto_params (q->uuconf_qproto_params, 4);
                    661: }
                    662: 
                    663: /* Show a chat script.  */
                    664: 
                    665: static void
                    666: ukshow_chat (qchat, zhdr)
                    667:      const struct uuconf_chat *qchat;
                    668:      const char *zhdr;
                    669: {
                    670:   char **pz;
                    671: 
                    672:   if (qchat->uuconf_pzprogram != NULL)
                    673:     {
                    674:       printf ("%s program", zhdr);
                    675:       for (pz = qchat->uuconf_pzprogram; *pz != NULL; pz++)
                    676:        printf (" %s", *pz);
                    677:       printf ("\n");
                    678:     }
                    679: 
                    680:   if (qchat->uuconf_pzchat != NULL)
                    681:     {
                    682: 
                    683:       printf ("%s script", zhdr);
                    684:       for (pz = qchat->uuconf_pzchat; *pz != NULL; pz++)
                    685:        {
                    686:          if ((*pz)[0] != '-' || pz == qchat->uuconf_pzchat)
                    687:            printf (" ");
                    688:          printf ("%s", *pz);
                    689:        }
                    690:       printf ("\n");
                    691:       printf ("%s script timeout %d\n", zhdr, qchat->uuconf_ctimeout);
                    692:       if (qchat->uuconf_pzfail != NULL)
                    693:        {
                    694:          printf ("%s failure strings", zhdr);
                    695:          for (pz = qchat->uuconf_pzfail; *pz != NULL; pz++)
                    696:            printf (" %s", *pz);
                    697:          printf ("\n");
                    698:        }
                    699:       if (qchat->uuconf_fstrip)
                    700:        printf ("%s script incoming bytes stripped to seven bits\n", zhdr);
                    701:     }
                    702: }
                    703: 
                    704: /* Show a size/time restriction.  */
                    705: 
                    706: static void
                    707: ukshow_size (qspan, fcall, flocal)
                    708:      struct uuconf_timespan *qspan;
                    709:      boolean fcall;
                    710:      boolean flocal;
                    711: {
                    712:   struct uuconf_timespan *q;
                    713:   boolean fother;
                    714: 
                    715:   qspan = qcompress_span (qspan);
                    716:   if (qspan == NULL)
                    717:     return;
                    718: 
                    719:   printf (" If call%s the following applies to a %s request:\n",
                    720:          fcall ? "ing" : "ed", flocal ? "local" : "remote");
                    721: 
                    722:   fother = FALSE;
                    723:   if (qspan->uuconf_istart >= 60)
                    724:     fother = TRUE;
                    725: 
                    726:   for (q = qspan; q != NULL; q = q->uuconf_qnext)
                    727:     {
                    728:       printf ("  ");
                    729:       ukshow_time (q);
                    730:       printf (" may transfer files %ld bytes or smaller\n", q->uuconf_ival);
                    731:       if (q->uuconf_qnext == NULL)
                    732:        {
                    733:          if (q->uuconf_iend <= 6 * 24 * 60 + 23 * 60)
                    734:            fother = TRUE;
                    735:        }
                    736:       else
                    737:        {
                    738:          if (q->uuconf_iend + 60 <= q->uuconf_qnext->uuconf_istart)
                    739:            fother = TRUE;
                    740:        }
                    741:     }
                    742: 
                    743:   if (fother)
                    744:     printf ("  (At other times may send files of any size)\n");
                    745: }
                    746: 
                    747: /* Show protocol parameters.  */
                    748: 
                    749: static void
                    750: ukshow_proto_params (pas, cindent)
                    751:      struct uuconf_proto_param *pas;
                    752:      int cindent;
                    753: {
                    754:   struct uuconf_proto_param *q;
                    755: 
                    756:   for (q = pas; q->uuconf_bproto != '\0'; q++)
                    757:     {
                    758:       int i;
                    759:       struct uuconf_proto_param_entry *qe;
                    760: 
                    761:       for (i = 0; i < cindent; i++)
                    762:        printf (" ");
                    763:       printf ("For protocol %c will use the following parameters\n",
                    764:              q->uuconf_bproto);
                    765:       for (qe = q->uuconf_qentries; qe->uuconf_cargs > 0; qe++)
                    766:        {
                    767:          int ia;
                    768: 
                    769:          for (i = 0; i < cindent; i++)
                    770:            printf (" ");
                    771:          for (ia = 0; ia < qe->uuconf_cargs; ia++)
                    772:            printf (" %s", qe->uuconf_pzargs[ia]);
                    773:          printf ("\n");
                    774:        }
                    775:     }
                    776: }
                    777: 
                    778: /* Display a time span.  */
                    779: 
                    780: static void
                    781: ukshow_time (q)
                    782:      const struct uuconf_timespan *q;
                    783: {
                    784:   int idaystart, idayend;
                    785:   int ihourstart, ihourend;
                    786:   int iminutestart, iminuteend;
                    787:   const char * const zdays = "Sun\0Mon\0Tue\0Wed\0Thu\0Fri\0Sat\0Sun";
                    788: 
                    789:   if (q->uuconf_istart == 0 && q->uuconf_iend == 7 * 24 * 60)
                    790:     {
                    791:       printf ("At any time");
                    792:       return;
                    793:     }
                    794: 
                    795:   idaystart = q->uuconf_istart / (24 * 60);
                    796:   ihourstart = (q->uuconf_istart % (24 * 60)) / 60;
                    797:   iminutestart = q->uuconf_istart % 60;
                    798:   idayend = q->uuconf_iend / (24 * 60);
                    799:   ihourend = (q->uuconf_iend % (24 * 60)) / 60;
                    800:   iminuteend = q->uuconf_iend % 60;
                    801: 
                    802:   if (idaystart == idayend)
                    803:     printf ("%s from %02d:%02d to %02d:%02d", zdays + idaystart * 4,
                    804:            ihourstart, iminutestart, ihourend, iminuteend);
                    805:   else
                    806:     printf ("From %s %02d:%02d to %s %02d:%02d",
                    807:            zdays + idaystart * 4, ihourstart, iminutestart,
                    808:            zdays + idayend * 4, ihourend, iminuteend);
                    809: }
                    810: 
                    811: /* Compress a time span by merging any two adjacent spans with
                    812:    identical values.  This isn't necessary for uucico, but it looks
                    813:    nicer when printed out.  */
                    814: 
                    815: static struct uuconf_timespan *
                    816: qcompress_span (qlist)
                    817:      struct uuconf_timespan *qlist;
                    818: {
                    819:   struct uuconf_timespan **pq;
                    820: 
                    821:   pq = &qlist;
                    822:   while (*pq != NULL)
                    823:     {
                    824:       if ((*pq)->uuconf_qnext != NULL
                    825:          && (*pq)->uuconf_iend == (*pq)->uuconf_qnext->uuconf_istart
                    826:          && (*pq)->uuconf_ival == (*pq)->uuconf_qnext->uuconf_ival)
                    827:        {
                    828:          struct uuconf_timespan *qnext;
                    829: 
                    830:          qnext = (*pq)->uuconf_qnext;
                    831:          (*pq)->uuconf_qnext = qnext->uuconf_qnext;
                    832:          (*pq)->uuconf_iend = qnext->uuconf_iend;
                    833:        }
                    834:       else
                    835:        pq = &(*pq)->uuconf_qnext;
                    836:     }
                    837: 
                    838:   return qlist;
                    839: }
                    840: 
                    841: /* Display a uuconf error and exit.  */
                    842: 
                    843: static void
                    844: ukuuconf_error (puuconf, iret)
                    845:      pointer puuconf;
                    846:      int iret;
                    847: {
                    848:   char ab[512];
                    849: 
                    850:   (void) uuconf_error_string (puuconf, iret, ab, sizeof ab);
                    851:   if ((iret & UUCONF_ERROR_FILENAME) == 0)
                    852:     fprintf (stderr, "uuchk: %s\n", ab);
                    853:   else
                    854:     fprintf (stderr, "uuchk:%s\n", ab);
                    855:   exit (EXIT_FAILURE);
                    856: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.