home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume13 / process-uucp < prev    next >
Text File  |  1988-01-31  |  19KB  |  674 lines

  1. Subject:  v13i036:  Tools for pathalias with MMDF
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: David Herron E-Mail Hack <david@E.MS.UKY.EDU>
  7. Posting-number: Volume 13, Issue 36
  8. Archive-name: process-uucp
  9.  
  10. Enclosed is a program to process pathalias output for MMDF use.
  11. It's real short and sweet.  There's a complete description enclosed
  12. with the package.
  13.  
  14.         -- David
  15.  
  16. #! /bin/sh
  17. : This is a shell archive, meaning:
  18. : 1. Remove everything above the '#! /bin/sh' line.
  19. : 2. Save the resulting text in a file.
  20. : 3. Execute the file with /bin/sh '(not csh)' to create the files:
  21. :    'process-uucp'
  22. : By:    'David Herron -- Resident E-mail Hack ()'
  23. export PATH; PATH=/bin:$PATH
  24. if test ! -d 'process-uucp'
  25. then
  26.     echo shar: creating directory "'process-uucp'"
  27.     mkdir 'process-uucp'
  28. fi
  29. echo shar: entering directory "'process-uucp'"
  30. cd 'process-uucp'
  31. echo shar: extracting "'Makefile'" '(703 characters)'
  32. if test -f 'Makefile'
  33. then
  34.     echo shar: will not over-write existing file "'Makefile'"
  35. else
  36. sed 's/^X//'  >'Makefile' <<'SHAR_EOF'
  37. X# Makefile for "process-uucp"
  38. X#
  39. X# A lot of these tags are for our internal use.  Especially "addman"
  40. X# which basically copies the named manual page to /usr/man/manx ...
  41. X
  42. XDESTDIR=/usr/mmdf
  43. XCC=cc
  44. XCFLAGS=-O
  45. X
  46. Xnotes:
  47. X    @echo Package: process-uucp
  48. X    @echo Process output from pathalias to make channel and domain
  49. X    @echo tables for MMDF.  Locally written by David Herron.
  50. X
  51. Xclean:
  52. X    -rm -f *.o core a.out process-uucp
  53. X
  54. Xall:    process-uucp
  55. X
  56. Xinstall: $(DESTDIR)/process-uucp
  57. X
  58. X$(DESTDIR)/process-uucp: process-uucp
  59. X    cp process-uucp $(DESTDIR)/process-uucp
  60. X
  61. Xuninstall:
  62. X    rm -f $(DESTDIR)/process-uucp
  63. X
  64. Xdoc:
  65. X    addman process-uucp.8 8
  66. X
  67. Xprocess-uucp: process-uucp.o
  68. X    $(CC) process-uucp.o $(CFLAGS) $(LDFLAGS) -o process-uucp
  69. SHAR_EOF
  70. if test 703 -ne "`wc -c < 'Makefile'`"
  71. then
  72.     echo shar: error transmitting "'Makefile'" '(should have been 703 characters)'
  73. fi
  74. fi # end of overwriting check
  75. echo shar: extracting "'PROCESS'" '(58 characters)'
  76. if test -f 'PROCESS'
  77. then
  78.     echo shar: will not over-write existing file "'PROCESS'"
  79. else
  80. sed 's/^X//'  >'PROCESS' <<'SHAR_EOF'
  81. X#! /bin/sh
  82. X
  83. Xprocess-uucp -r g.ms.uky.edu -d uucp ukma.new
  84. SHAR_EOF
  85. if test 58 -ne "`wc -c < 'PROCESS'`"
  86. then
  87.     echo shar: error transmitting "'PROCESS'" '(should have been 58 characters)'
  88. fi
  89. chmod +x 'PROCESS'
  90. fi # end of overwriting check
  91. echo shar: extracting "'README'" '(862 characters)'
  92. if test -f 'README'
  93. then
  94.     echo shar: will not over-write existing file "'README'"
  95. else
  96. sed 's/^X//'  >'README' <<'SHAR_EOF'
  97. XThese files make up the do-whickies which I use to generate tables for
  98. XMMDF from the comp.mail.maps information.  The files are as follows:
  99. X
  100. XMakefile, README
  101. XRUN            The shell script I use to run pathalias
  102. XPROCESS            The shell script run from RUN to do process-uucp.
  103. Xprocess-uucp.c        The program
  104. Xprocess-uucp.8        The manual page
  105. X
  106. XIf you have any problems, send me some mail.  The addresses are listed
  107. Xon the manual page.
  108. X
  109. XSorry, I don't run sendmail here.  I have no idea how useful this stuff
  110. Xwould be to anybody who doesn't run MMDF.  It is possible that PMDF people
  111. Xmight find this useful if the table formats are the same.
  112. X
  113. XI don't see any point in copyrighting this program.  But please leave
  114. Xmy name intact and mark your own changes as such.  If anybody wishes
  115. Xto discuss additions, please do it directly with me.
  116. X
  117. X        David Herron
  118. X        Mon Nov 16 17:38:53 EST 1987
  119. SHAR_EOF
  120. if test 862 -ne "`wc -c < 'README'`"
  121. then
  122.     echo shar: error transmitting "'README'" '(should have been 862 characters)'
  123. fi
  124. fi # end of overwriting check
  125. echo shar: extracting "'RUN'" '(150 characters)'
  126. if test -f 'RUN'
  127. then
  128.     echo shar: will not over-write existing file "'RUN'"
  129. else
  130. sed 's/^X//'  >'RUN' <<'SHAR_EOF'
  131. X#! /bin/sh
  132. X
  133. Xpathalias \
  134. X    -d cbatt -d vax135 -d ihnp4 -d cbosgd!ihnp4 -d ihnp4!cbosgd \
  135. X    -v -l ukma \
  136. X    d.* u.* \
  137. X    2>ERRORS >ukma.new
  138. X
  139. XPROCESS ukma.new
  140. SHAR_EOF
  141. if test 150 -ne "`wc -c < 'RUN'`"
  142. then
  143.     echo shar: error transmitting "'RUN'" '(should have been 150 characters)'
  144. fi
  145. chmod +x 'RUN'
  146. fi # end of overwriting check
  147. echo shar: extracting "'process-uucp.8'" '(2819 characters)'
  148. if test -f 'process-uucp.8'
  149. then
  150.     echo shar: will not over-write existing file "'process-uucp.8'"
  151. else
  152. sed 's/^X//'  >'process-uucp.8' <<'SHAR_EOF'
  153. X.TH PROCESS-UUCP 8 "November 11, 1987" "U of Kentucky" "Brand X Programmer's Manual"
  154. X.SH NAME
  155. Xprocess-uucp \- generate MMDF mail style domain and channel tables from pathalias output
  156. X.SH SYNOPSIS
  157. X.B process-uucp
  158. X[
  159. X.B \-r
  160. Xrelay-host ] [
  161. X.B \-c
  162. Xhost ... ] [
  163. X.B \-d
  164. Xdomain ... ] file ... 
  165. X.SH DESCRIPTION
  166. X.B Process-uucp(8)
  167. Xtakes output from pathalias and generates tables one would want to use
  168. Xwithin MMDF for routing UUCP based mail.
  169. XThe two type of tables which can be generated are channel tables
  170. Xand domain tables.
  171. X.PP
  172. XBy default, the domain tables contain entries of the form:
  173. X.nf
  174. X
  175. X    domain: domain.upper.domain
  176. X
  177. X.fi
  178. XAnd channel table entries are of the form:
  179. X.nf
  180. X
  181. X    domain.upper.domain: path!path!path!%s
  182. X
  183. X.fi
  184. XThese tables can be modified by the following options:
  185. X.IP -r
  186. XThis option causes domain entries to be changed to have the form:
  187. X.nf
  188. X
  189. X    domain: domain.upper.domain, relay-host
  190. X
  191. X.nf
  192. XLocally I use this option in generating the original table, then
  193. Xwhen installing the table I run the following sed command:
  194. X.nf
  195. X
  196. X    sed "s/, *`hostname`.*$//" <table.new >table
  197. X
  198. X.fi
  199. Xwhich will remove the ", relay-host" stuff when we're installing
  200. Xthe table on "relay-host".
  201. XWe have one host here which interfaces us to the UUCP network,
  202. Xand that host is what is listed as relay-host.
  203. X.IP -c
  204. XThis option causes there to be generated many channel tables
  205. Xdepending on the first host of the path.
  206. XThe intention is to have authorization set up so that channels
  207. Xwhere we pay out money to make the UUCP connection can be restricted
  208. Xfrom people as necessary.
  209. XHowever, I have not managed to understand authorization as yet
  210. Xand this is not used.
  211. X.IP -d
  212. XThis option selects domains for which to make extra domain tables.
  213. XDomain entries for domains not listed in a -d option are
  214. Xput into wrkdmn.uucp-top with an entry like:
  215. X.nf
  216. X
  217. X    domain.upper.domain: domain.upper.domain
  218. X
  219. X.fi
  220. XSometimes it is desired to have other domains seperated out into
  221. Xtheir own tables.
  222. XIf -d is used, entries in these tables will be as described earlier.
  223. X.PP
  224. XNOTE that a wrkdmn.uucp-uucp file is not automatically created.
  225. X.SH FILES
  226. Xwrkchn.uucp-uucp, wrkchn.uucp-<host>, wrkdmn.uucp-top, wrkdmn.uucp-<domain>
  227. X.SH SEE ALSO
  228. Xpathalias(1), the MMDF manual pages and installation documents
  229. X.SH AUTHOR
  230. XDavid Herron -- Resident E-Mail Hack
  231. X.br
  232. XUniversity of Kentucky
  233. X.br
  234. XMathematical Sciences
  235. X.br
  236. XPatterson Office Tower rm 907
  237. X.br
  238. XLexington, KY  40506
  239. X.br
  240. X.sp 2
  241. Xdavid@ms.uky.edu, {rutgers,uunet,cbosgd}!ukma!david, david@ukma.bitnet
  242. X.SH BUGS
  243. XWhen writing records to files, all opens are done in "append" mode.
  244. XThis means that if you do not remove the files before you run process-uucp
  245. Xthen you probably won't get what you really want.
  246. X.PP
  247. XThe file names chosen are arguably silly.
  248. XHowever for my justification of the file names,
  249. Xsee the comments in the source.
  250. SHAR_EOF
  251. if test 2819 -ne "`wc -c < 'process-uucp.8'`"
  252. then
  253.     echo shar: error transmitting "'process-uucp.8'" '(should have been 2819 characters)'
  254. fi
  255. fi # end of overwriting check
  256. echo shar: extracting "'process-uucp.c'" '(10182 characters)'
  257. if test -f 'process-uucp.c'
  258. then
  259.     echo shar: will not over-write existing file "'process-uucp.c'"
  260. else
  261. sed 's/^X//'  >'process-uucp.c' <<'SHAR_EOF'
  262. X/*
  263. X * process-uucp.c -- Make mmdf tables from uucp project derived information.
  264. X *
  265. X * USAGE: process-uucp [ -d domain ... ] [ -r relay-host ] 
  266. X *            [ -c host ... ] file ...
  267. X *
  268. X * -d domain        generate a domain table for the domain.
  269. X *            The file name is "wrkdmn.uucp-dom.ain", and
  270. X *            the entries are like:
  271. X *
  272. X *    dom: dom.ain
  273. X *
  274. X * -r relay-host     have the entries in the domain file be
  275. X *            routed through "relay-host". i.e.
  276. X *
  277. X *    dom: dom.ain, relay-host
  278. X *
  279. X * -c host        This causes the wrkchn.uucp-uucp file to be split into
  280. X *            multiple files.  If a path has its' first component
  281. X *            as the named host, then the entry will be put
  282. X *            into a seperate file named "wrkchn.uucp-host".
  283. X *
  284. X * The input file is the output of pathalias.  The format is:
  285. X *
  286. X * {host,domain}    a!b!c!...%s...
  287. X *
  288. X * From this we make both domain tables and channel tables.
  289. X *
  290. X * There are a couple of files which are automatically created:
  291. X *
  292. X * wrkchn.uucp-uucp    This contains domain:path entries for any paths
  293. X *            which did not match hosts given in the -c list.
  294. X * wrkdmn.uucp-top    This domains dom:dom.ain entries for domains
  295. X *            which did not match domains given in -d's.
  296. X *
  297. X * A word about the file naming scheme.  The general format of file
  298. X * names which I use on tables is "<type>.<source>-<subtype>".
  299. X * "<type>" is something like domain, chan, or alias.  "<source>"
  300. X * is some identifier saying where the information came from, like
  301. X * uucp or bitnet.  "<subtype>" is something like domain for domain
  302. X * tables, channel name for channel tables, or some other sort of
  303. X * identifier depending on what the table is for.  (For instance,
  304. X * I also have alias-global, alias-forward, and alias-local tables).
  305. X *
  306. X * Suggested use is something like:
  307. X *
  308. X * process-uucp -d uucp -d edu -d arpa pathalias-output-file
  309. X *
  310. X * AUTHOR:
  311. X * 
  312. X * David Herron, University of Kentucky Mathematical Sciences
  313. X * Mon Nov 16 17:39:18 EST 1987
  314. X */
  315. X
  316. X#include <stdio.h>
  317. X#include <ctype.h>
  318. X
  319. Xstruct namelist {
  320. X    char *name;
  321. X    char *fname;
  322. X    /* FILE *ofile; */
  323. X};
  324. X
  325. X/* File name prefixes */
  326. X#define WRK_CHAN    "wrkchn.uucp"
  327. X#define WRK_DMN        "wrkdmn.uucp"
  328. X
  329. Xvoid process();
  330. Xchar buf[BUFSIZ];
  331. X
  332. X
  333. Xvoid addfile();
  334. Xchar *files[BUFSIZ];
  335. Xint numfiles = 0;
  336. X
  337. X
  338. Xvoid addomain();
  339. Xstruct namelist domains[BUFSIZ];
  340. Xint numdomains = 0;
  341. X
  342. X
  343. Xvoid addhost();
  344. Xstruct namelist hosts[BUFSIZ];
  345. Xint numhosts = 0;
  346. X
  347. X
  348. Xchar *lowerify();
  349. Xchar *RelayHost = (char *)0;
  350. X
  351. Xextern char *malloc();
  352. X
  353. Xmain(argc, argv)
  354. Xint argc;
  355. Xchar **argv;
  356. X{
  357. X    int i;
  358. X
  359. X    if (argc <= 1) {
  360. X        fprintf(stderr, "Usage: %s file ...\n", argv[0]);
  361. X        exit(1);
  362. X    }
  363. X    sprintf(buf, "%s-uucp", WRK_CHAN);
  364. X    close(creat(buf, 0644));
  365. X    for (i=1; i < argc; i++) {
  366. X        if (argv[i][0] == '-') {
  367. X            switch(argv[i][1]) {
  368. X            case 'd':
  369. X                i++;
  370. X                printf("addomain(%s);\n", argv[i]);
  371. X                addomain(argv[i]);
  372. X                break;
  373. X            case 'c':
  374. X                i++;
  375. X                printf("addhost(%s);\n", argv[i]);
  376. X                addhost(argv[i]);
  377. X                break;
  378. X            case 'r':
  379. X                i++;
  380. X                RelayHost = lowerify(argv[i]);
  381. X                printf("relay-host: %s\n", RelayHost);
  382. X                break;
  383. X            default:
  384. X                break;
  385. X            }
  386. X        }
  387. X        else {
  388. X            addfile(argv[i]);
  389. X        }
  390. X    }
  391. X    for (i=0; i<numfiles; i++) {
  392. X        /* printf("process(%s);\n", files[i]); */
  393. X        process(files[i]);
  394. X    }
  395. X    exit(0);
  396. X}
  397. X
  398. Xvoid
  399. Xaddomain(s)
  400. Xchar *s;
  401. X{
  402. X    int slen;
  403. X
  404. X    domains[numdomains].name = s;
  405. X    slen = strlen(WRK_DMN) + 1 + strlen(s) + 1;
  406. X    domains[numdomains].fname = malloc(slen);
  407. X    sprintf(domains[numdomains].fname, "%s-%s", WRK_DMN, s);
  408. X    numdomains++;
  409. X}
  410. X
  411. Xvoid
  412. Xaddhost(s)
  413. Xchar *s;
  414. X{
  415. X    int slen;
  416. X
  417. X    hosts[numhosts].name = s;
  418. X    slen = strlen(WRK_DMN) + 1 + strlen(s) + 1;
  419. X    hosts[numhosts].fname = malloc(slen);
  420. X    sprintf(hosts[numhosts].fname, "%s-%s", WRK_CHAN, s);
  421. X    numhosts++;
  422. X}
  423. X
  424. Xvoid
  425. Xaddfile(s)
  426. Xchar *s;
  427. X{
  428. X    files[numfiles++] = s;
  429. X}
  430. X
  431. Xchar *
  432. Xlowerify(s)
  433. Xchar *s;
  434. X{
  435. X    register char *sp = s;
  436. X
  437. X    while (*sp != '\0') {
  438. X        if (isupper(*sp))
  439. X            *sp = tolower(*sp);
  440. X        sp++;
  441. X    }
  442. X    return(s);
  443. X}
  444. X
  445. X/*
  446. X * indomain(name, domain) -- Test to see if the given name is 
  447. X * within a domain ... we do this as a sort of reverse-strcmp().
  448. X *
  449. X * The return value is NULL if it is not, and a pointer within the
  450. X * tested name if it is.
  451. X */
  452. Xchar *
  453. Xindomain(name, domain)
  454. Xchar *name, *domain;
  455. X{
  456. X    register char *namp, *domp;
  457. X
  458. X    namp = name; domp = domain;
  459. X    if (!namp || !domp)
  460. X        return(NULL);
  461. X    /* printf("indomain(%s, %s); -- ", name, domain); */
  462. X    /* Find the end of the strings */
  463. X    namp = &(name[strlen(name)-1]);
  464. X    domp = &(domain[strlen(domain)-1]);
  465. X    /* printf("start at namp=<%s> domp=<%s> -- ", namp, domp); */
  466. X    for (; namp>=name && domp>=domain; namp--, domp--)
  467. X        if (namp[0] != domp[0])
  468. X            break;
  469. X    namp++; domp++;
  470. X    /* printf("match at namp=<%s> domp=<%s>\n", namp, domp); */
  471. X    if (
  472. X           (namp>name && domp==domain && namp[-1]=='.') 
  473. X        || namp == name
  474. X       )
  475. X        return(namp);
  476. X    else
  477. X        return(NULL);
  478. X}
  479. X
  480. X/* These have to be here because the compiler chokes if they're
  481. X * inside process().
  482. X */
  483. Xchar pathbuf[BUFSIZ], dmnbuf[BUFSIZ], bf2[BUFSIZ];
  484. X
  485. X/*
  486. X * process(file) -- Process the file making all the tables which 
  487. X * which we were told to make on the command line.
  488. X *
  489. X * A note about the algorithm.  If you read the code below you will
  490. X * notice that I am constantly open()ing and close()ing files to
  491. X * append records to the end of the files.  This is because, in
  492. X * theory at least, someone could have 50 domain files that they
  493. X * generate from this program.  
  494. X *
  495. X * Maybe in practice one will never have more than 10 (to pick a number 
  496. X * out of the air).  If you really want to "fix" this, be my guest.  It 
  497. X * should be a fairly trivial re-write.  The "fix" I have in mind is to
  498. X * change "domains[]" into an array of structures remembering the domain
  499. X * name, the file name for the domain, and the FILE * pointing to that
  500. X * file.  Then there are a few places below where one looks up the
  501. X * file name, fopen()s the file in "a" mode, write the record, and close
  502. X * the file.  One would need to change those places to merely write the 
  503. X * record after looking up the FILE * in the struct namelist.
  504. X *
  505. X * NOTE NOTE NOTE ... The procedure as it is opens files in append mode
  506. X * and there's no automatic truncation of any files.  You will have to
  507. X * do this by hand.  (Well, engrave it in your shell script which processes
  508. X * the pathalias output).
  509. X */
  510. Xvoid
  511. Xprocess(file)
  512. Xchar *file;
  513. X{
  514. X    register char *sp, *sp2;
  515. X    register int i;
  516. X    FILE *ifile, *cfile, *tcfile, *dfile, *topfile;
  517. X    int hlen;
  518. X    char *index(), *strcpy(), *strcat();
  519. X
  520. X    ifile = fopen(file, "r");
  521. X    if (ifile == NULL) {
  522. X        /* printf("Open of %s failed with errno=%d\n", file, errno); */
  523. X        perror(file);
  524. X        return;
  525. X    }
  526. X    sprintf(buf, "%s-uucp", WRK_CHAN);
  527. X    cfile = fopen(buf, "a");
  528. X    if (cfile == NULL) {
  529. X        /* printf("Open of %s failed with errno=%d\n", buf, errno); */
  530. X        perror(buf);
  531. X        fclose(ifile);
  532. X        return;
  533. X    }
  534. X    sprintf(buf, "%s-top", WRK_DMN);
  535. X    topfile = fopen(buf, "a");
  536. X    if (topfile == NULL) {
  537. X        /* printf("Open of %s failed with errno=%d\n", buf, errno); */
  538. X        perror(buf);
  539. X        fclose(ifile);
  540. X        fclose(cfile);
  541. X        return;
  542. X    }
  543. X    while (fgets(buf, BUFSIZ, ifile) != NULL) {
  544. X        if ((sp = index(buf, '\n')) != NULL)
  545. X            *sp = '\0';
  546. X        /* copy the domain part */
  547. X        for (sp=buf, sp2=dmnbuf;
  548. X             *sp!='\0' && *sp!=' ' && *sp!='\t';
  549. X             sp++, sp2++)
  550. X            *sp2 = *sp;
  551. X        *sp2 = '\0';
  552. X        /* Then the path part */
  553. X        if (*sp != '\0') {
  554. X            while (*sp==' ' || *sp=='\t')
  555. X                 sp++;
  556. X            for (sp2=pathbuf;
  557. X                 *sp!='\0' && *sp!=' ' && *sp!='\t';
  558. X                 sp++, sp2++)
  559. X                *sp2 = *sp;
  560. X            *sp2 = '\0';
  561. X        }
  562. X        if (pathbuf[0] == '\0')
  563. X            strcpy(pathbuf, "NO-PATH-GIVEN!%s");
  564. X        /* printf("before = %s\n", dmnbuf); */
  565. X        (void) lowerify(dmnbuf);
  566. X        /* printf("after = %s\n", dmnbuf); */
  567. X        if ((sp = index(dmnbuf, '.')) == NULL)
  568. X            strcat(dmnbuf, ".uucp");
  569. X        if (dmnbuf[0] == '.')
  570. X            for (sp = dmnbuf; *sp != '\0'; sp++)
  571. X                *sp = *(sp+1);
  572. X        /*
  573. X         * If the given domain name is within one of those for which
  574. X         * we have a domain table, output it into the domain table
  575. X         * and into the channel table.
  576. X         */
  577. X        for (i=0; i<numdomains; i++) {
  578. X            if ((sp2=indomain(dmnbuf, domains[i].name)) != NULL) {
  579. X                if (sp2 > dmnbuf) {
  580. X                    dfile = fopen(domains[i].fname, "a");
  581. X                    /* write out first part of dom.ain */
  582. X                    for (sp=dmnbuf; sp < (sp2-1); sp++)
  583. X                        fputc(*sp, dfile);
  584. X                    if (RelayHost)
  585. X                        fprintf(dfile, ":\t%s, %s\n", 
  586. X                            dmnbuf, RelayHost);
  587. X                    else
  588. X                        fprintf(dfile, ":\t%s\n", dmnbuf);
  589. X                    fclose(dfile);
  590. X                    break;
  591. X                }
  592. X                else {
  593. X                    /*
  594. X                     * This case is for when the name we're
  595. X                     * testing fully matches the domain name
  596. X                     * for one of the tables.  We aren't 
  597. X                     * supposed to make an entry for him
  598. X                     * in this table, but in the table for
  599. X                     * the parent domain.  But we don't
  600. X                     * know here whether we are keeping
  601. X                     * a table for that domain ... HOWEVER,
  602. X                     * if we keep looping through the rest of
  603. X                     * the table names we will eventually 
  604. X                     * find out.
  605. X                     */
  606. X                    continue;
  607. X                }
  608. X            }
  609. X        }
  610. X        /*
  611. X         * This case is for when we've run through the entire list 
  612. X         * of domains for which we have tables and the name we
  613. X         * have does not fit with any of those.  So, we insert
  614. X         * it into the top-level table.
  615. X         */
  616. X        if (i == numdomains) {
  617. X            if (RelayHost)
  618. X                fprintf(topfile, "%s:\t%s, %s\n", 
  619. X                    dmnbuf, dmnbuf, RelayHost);
  620. X            else
  621. X                fprintf(topfile, "%s:\t%s\n", dmnbuf, dmnbuf);
  622. X        }
  623. X        /*
  624. X         * This section handles making entries in the channel table.
  625. X         */
  626. X        if (numhosts > 0) {
  627. X            for (i=0; i<numhosts; i++) {
  628. X                hlen = strlen(hosts[i].name);
  629. X                /* This shortcuts if we already know that
  630. X                 * the names CANNOT match. i.e. if the next
  631. X                 * character is not '!', then the lengths
  632. X                 * of the two names are not the same.
  633. X                 */
  634. X                if (pathbuf[hlen] != '!')
  635. X                    continue;
  636. X                if (strncmp(pathbuf, hosts[i].name, hlen) != 0)
  637. X                    continue;
  638. X                tcfile = fopen(hosts[i].fname, "a");
  639. X                fprintf(tcfile, "%s:\t%s\n", dmnbuf, pathbuf);
  640. X                fclose(tcfile);
  641. X                break;
  642. X            }
  643. X            /* If we make it all the way through the list, then
  644. X             * we didn't write out the record to a file.  Put
  645. X             * the record out into the default file.
  646. X             */
  647. X            if (i == numhosts)
  648. X                fprintf(cfile, "%s:\t%s\n", dmnbuf, pathbuf);
  649. X        }
  650. X        else
  651. X            fprintf(cfile, "%s:\t%s\n", dmnbuf, pathbuf);
  652. X    }
  653. X    /* printf("done with %s\n", file); */
  654. X    fclose(cfile);
  655. X    fclose(ifile);
  656. X    fclose(topfile);
  657. X}
  658. SHAR_EOF
  659. if test 10182 -ne "`wc -c < 'process-uucp.c'`"
  660. then
  661.     echo shar: error transmitting "'process-uucp.c'" '(should have been 10182 characters)'
  662. fi
  663. fi # end of overwriting check
  664. echo shar: done with directory "'process-uucp'"
  665. cd ..
  666. :    End of shell archive
  667. exit 0
  668. --
  669. <---- David Herron -- Resident E-Mail Hack     <david@ms.uky.edu>
  670. <---- or:                {rutgers,uunet,cbosgd}!ukma!david, david@UKMA.BITNET
  671. <---- "The market doesn't drop hundreds of points on a normal day..." --
  672. <----         Fidelity Investments Corporation
  673.  
  674.