home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume34 / unpckmps / part02 < prev    next >
Encoding:
Text File  |  1992-11-28  |  30.6 KB  |  1,405 lines

  1. Newsgroups: comp.sources.misc
  2. From: clewis@ferret.ocunix.on.ca (Chris Lewis)
  3. Subject:  v34i002:  unpackmaps - A secure comp.mail.maps unpacker, Part02/02
  4. Message-ID: <1992Nov29.202143.15872@sparky.imd.sterling.com>
  5. X-Md4-Signature: 3ad0492fa994dcb97ee9d546b2c83303
  6. Date: Sun, 29 Nov 1992 20:21:43 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: clewis@ferret.ocunix.on.ca (Chris Lewis)
  10. Posting-number: Volume 34, Issue 2
  11. Archive-name: unpackmaps/part02
  12. Environment: Pathalias, Cnews, UNIX
  13. Supersedes: unpackmaps: Volume 22, Issue 69
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  Make.proto deletelist display.c docomp.c dointer.c dopath
  22. #   fatal.c fileinit.c getmaps.c getpath.c lock.c savestr.c unpack.h
  23. #   uuwhere.M
  24. # Wrapped by clewis@ecicrl on Sat Nov 28 02:12:46 1992
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 2 (of 2)."'
  28. if test -f 'Make.proto' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Make.proto'\"
  30. else
  31.   echo shar: Extracting \"'Make.proto'\" \(1964 characters\)
  32.   sed "s/^X//" >'Make.proto' <<'END_OF_FILE'
  33. X#   Copyright 1992, Chris Lewis.  All Rights Reserved
  34. X#   Please see the README for the terms of the copyright.
  35. X#   1.2 92/06/10
  36. X
  37. X# @(#)Make.P 1.2 92/06/10 01:45:13
  38. X
  39. X#    Compilation options.  The defines are actually in config.proto/config.h
  40. XCFLAGS = -O
  41. X
  42. X#    Sometimes necessary to pick up getopt:
  43. X#        Dynix UCB universe: -lseq
  44. X#    If you have added on directory routines, list the archive here:
  45. X
  46. XLIBS    =
  47. X
  48. X#    Where you want to install the binaries for unpackmaps and uuwhere
  49. XBINDIR    = /usr/local/bin
  50. X
  51. X#    Manual page directory:
  52. XMANDIR    = /usr/man/man1
  53. X#    Suffix.  Usually 1 or 1L
  54. XMANEXT    = 1
  55. X
  56. X#    Don't touch from here on.
  57. X
  58. XPACKEROBJ    = unpacker.o uncomp.o docomp.o runpath.o sortwdb.o unpack.o \
  59. X          fatal.o savestr.o dointer.o fileinit.o lock.o getmaps.o
  60. XPACKERSRC    = unpacker.c uncomp.c docomp.c runpath.c sortwdb.c unpack.c \
  61. X          fatal.c savestr.c dointer.c fileinit.c lock.c getmaps.c
  62. XWHEREOBJ    = uuwhere.o getpath.o display.o uncomp.o fileinit.o getmaps.o \
  63. X          savestr.o
  64. XWHERESRC    = uuwhere.c getpath.c display.c uncomp.c fileinit.c getmaps.c \
  65. X          savestr.c
  66. X
  67. Xall:    unpackmaps uuwhere
  68. X
  69. Xunpackmaps:    $(PACKEROBJ)
  70. X    $(CC) $(CFLAGS) -o unpackmaps $(PACKEROBJ) $(LIBS)
  71. X
  72. Xuuwhere:    $(WHEREOBJ)
  73. X    $(CC) $(CFLAGS) -o uuwhere $(WHEREOBJ) $(LIBS)
  74. X
  75. X$(WHEREOBJ):    unpack.h config.h
  76. X
  77. X$(PACKEROBJ):    unpack.h config.h
  78. X
  79. Xclean:
  80. X    rm -fr unpackmaps uuwhere core *.o
  81. X
  82. Xlint:    uuwhere.li unpackmaps.li
  83. X
  84. Xunpackmaps.li:
  85. X    lint -Dlint $(CFLAGS) $(PACKERSRC) > unpackmaps.lin
  86. X    
  87. Xuuwhere.li:
  88. X    lint -Dlint $(CFLAGS) $(WHERESRC) > uuwhere.lin
  89. X
  90. Xmakekit:
  91. X    makekit -m
  92. X    
  93. Xinstall:    all
  94. X    rm -f $(BINDIR)/unpackmaps
  95. X    cp unpackmaps $(BINDIR)/unpackmaps
  96. X    chmod 755 $(BINDIR)/unpackmaps
  97. X    rm -f $(BINDIR)/uuwhere
  98. X    cp uuwhere $(BINDIR)/uuwhere
  99. X    chmod 755 $(BINDIR)/uuwhere
  100. X
  101. X    rm -f $(MANDIR)/unpackmaps.$(MANEXT)
  102. X    -cp unpackmaps.M $(MANDIR)/unpackmaps.$(MANEXT)
  103. X    -chmod 755 $(MANDIR)/unpackmaps.$(MANEXT)
  104. X    rm -f $(MANDIR)/uuwhere.$(MANEXT)
  105. X    -cp uuwhere.M $(MANDIR)/uuwhere.$(MANEXT)
  106. X    -chmod 755 $(MANDIR)/uuwhere.$(MANEXT)
  107. X
  108. END_OF_FILE
  109.   if test 1964 -ne `wc -c <'Make.proto'`; then
  110.     echo shar: \"'Make.proto'\" unpacked with wrong size!
  111.   fi
  112.   # end of 'Make.proto'
  113. fi
  114. if test -f 'deletelist' -a "${1}" != "-c" ; then 
  115.   echo shar: Will not clobber existing file \"'deletelist'\"
  116. else
  117.   echo shar: Extracting \"'deletelist'\" \(2310 characters\)
  118.   sed "s/^X//" >'deletelist' <<'END_OF_FILE'
  119. Xu.arg.1
  120. Xu.arg.ba.1
  121. Xu.arg.ba.2
  122. Xu.arg.cb.1
  123. Xu.arg.cc.1
  124. Xu.arg.ch.1
  125. Xu.arg.cn.1
  126. Xu.arg.ct.1
  127. Xu.arg.er.1
  128. Xu.arg.fm.1
  129. Xu.arg.lr.1
  130. Xu.arg.mn.1
  131. Xu.arg.mz.1
  132. Xu.arg.nq.1
  133. Xu.arg.rn.1
  134. Xu.arg.sa.1
  135. Xu.arg.se.1
  136. Xu.arg.sf.1
  137. Xu.arg.sj.1
  138. Xu.arg.sl.1
  139. Xu.arg.tf.1
  140. Xu.arg.tm.1
  141. Xu.aus.act.1
  142. Xu.aus.dom.1
  143. Xu.aus.nsw.1
  144. Xu.aus.nt.1
  145. Xu.aus.qld.1
  146. Xu.aus.sa.1
  147. Xu.aus.tas.1
  148. Xu.aus.vic.1
  149. Xu.aus.wa.1
  150. Xu.aut.1
  151. Xu.bel.0
  152. Xu.bel.1
  153. Xu.bgr.0
  154. Xu.bgr.1
  155. Xu.bys.1
  156. Xu.che.0
  157. Xu.che.1
  158. Xu.che.10
  159. Xu.che.100
  160. Xu.chl.1
  161. Xu.col.1
  162. Xu.cri.1
  163. Xu.csk.0
  164. Xu.csk.1
  165. Xu.deu.0
  166. Xu.deu.1
  167. Xu.deu.100
  168. Xu.deu.101
  169. Xu.deu.102
  170. Xu.deu.2
  171. Xu.deu.3
  172. Xu.deu.4
  173. Xu.deu.5
  174. Xu.deu.6
  175. Xu.deu.7
  176. Xu.deu.8
  177. Xu.deu.9
  178. Xu.dmk.1
  179. Xu.dnk.0
  180. Xu.dnk.1
  181. Xu.dom.1
  182. Xu.edu.102
  183. Xu.egy.1
  184. Xu.esp.0
  185. Xu.esp.1
  186. Xu.eur.0
  187. Xu.eur.fra.1
  188. Xu.eur.ita.1
  189. Xu.fin.0
  190. Xu.fin.1
  191. Xu.fin.2
  192. Xu.fin.3
  193. Xu.fin.4
  194. Xu.fin.5
  195. Xu.fra.0
  196. Xu.fra.1
  197. Xu.fra.2
  198. Xu.gbr.0
  199. Xu.gbr.1
  200. Xu.gbr.2
  201. Xu.gbr.3
  202. Xu.gbr.4
  203. Xu.gbr.5
  204. Xu.gbr.6
  205. Xu.gbr.7
  206. Xu.gbr.8
  207. Xu.grc.0
  208. Xu.grc.1
  209. Xu.gtm.1
  210. Xu.hkg.1
  211. Xu.hun.1
  212. Xu.hun.100
  213. Xu.idn.1
  214. Xu.ind.1
  215. Xu.irl.0
  216. Xu.irl.1
  217. Xu.isl.0
  218. Xu.isl.1
  219. Xu.isr.1
  220. Xu.ita.0
  221. Xu.ita.1
  222. Xu.jpn.1
  223. Xu.jpn.2
  224. Xu.jpn.3
  225. Xu.jpn.4
  226. Xu.kor.1
  227. Xu.lka.1
  228. Xu.lux.1
  229. Xu.mex.1
  230. Xu.mys.1
  231. Xu.nic.1
  232. Xu.nld.0
  233. Xu.nld.1
  234. Xu.nld.100
  235. Xu.nld.2
  236. Xu.nld.3
  237. Xu.nld.4
  238. Xu.nor.1
  239. Xu.nzl.1
  240. Xu.prt.0
  241. Xu.prt.1
  242. Xu.prt.100
  243. Xu.sgp.1
  244. Xu.sun.0
  245. Xu.sun.1
  246. Xu.sun.100
  247. Xu.sun.2
  248. Xu.sun.3
  249. Xu.sun.4
  250. Xu.swe.0
  251. Xu.swe.1
  252. Xu.swe.2
  253. Xu.tha.1
  254. Xu.tun.0
  255. Xu.tun.1
  256. Xu.twn.1
  257. Xu.ukr.1
  258. Xu.usa.ak.1
  259. Xu.usa.al.1
  260. Xu.usa.ar.1
  261. Xu.usa.az.1
  262. Xu.usa.ca.1
  263. Xu.usa.ca.10
  264. Xu.usa.ca.11
  265. Xu.usa.ca.12
  266. Xu.usa.ca.14
  267. Xu.usa.ca.16
  268. Xu.usa.ca.18
  269. Xu.usa.ca.2
  270. Xu.usa.ca.3
  271. Xu.usa.ca.4
  272. Xu.usa.ca.5
  273. Xu.usa.ca.6
  274. Xu.usa.ca.7
  275. Xu.usa.ca.8
  276. Xu.usa.ca.9
  277. Xu.usa.co.1
  278. Xu.usa.co.2
  279. Xu.usa.ct.1
  280. Xu.usa.ct.2
  281. Xu.usa.dc.1
  282. Xu.usa.de.1
  283. Xu.usa.fl.1
  284. Xu.usa.ga.1
  285. Xu.usa.ga.2
  286. Xu.usa.hi.1
  287. Xu.usa.ia.1
  288. Xu.usa.id.1
  289. Xu.usa.il.1
  290. Xu.usa.il.2
  291. Xu.usa.il.3
  292. Xu.usa.in.1
  293. Xu.usa.is.1
  294. Xu.usa.ks.1
  295. Xu.usa.ky.1
  296. Xu.usa.la.1
  297. Xu.usa.ma.1
  298. Xu.usa.ma.2
  299. Xu.usa.ma.3
  300. Xu.usa.ma.4
  301. Xu.usa.ma.5
  302. Xu.usa.ma.6
  303. Xu.usa.md.1
  304. Xu.usa.md.2
  305. Xu.usa.me.1
  306. Xu.usa.mi.1
  307. Xu.usa.mi.2
  308. Xu.usa.mi.3
  309. Xu.usa.mn.1
  310. Xu.usa.mn.2
  311. Xu.usa.mo.1
  312. Xu.usa.ms.1
  313. Xu.usa.mt.1
  314. Xu.usa.nc.1
  315. Xu.usa.nd.1
  316. Xu.usa.ne.1
  317. Xu.usa.nh.1
  318. Xu.usa.nh.2
  319. Xu.usa.nj.1
  320. Xu.usa.nj.2
  321. Xu.usa.nj.3
  322. Xu.usa.nm.1
  323. Xu.usa.nv.1
  324. Xu.usa.ny.1
  325. Xu.usa.ny.2
  326. Xu.usa.ny.3
  327. Xu.usa.ny.4
  328. Xu.usa.ny.5
  329. Xu.usa.oh.1
  330. Xu.usa.oh.2
  331. Xu.usa.ok.1
  332. Xu.usa.or.1
  333. Xu.usa.or.2
  334. Xu.usa.pa.1
  335. Xu.usa.pa.2
  336. Xu.usa.pa.3
  337. Xu.usa.ri.1
  338. Xu.usa.sc.1
  339. Xu.usa.sd.1
  340. Xu.usa.tn.1
  341. Xu.usa.tx.1
  342. Xu.usa.tx.2
  343. Xu.usa.tx.3
  344. Xu.usa.tx.4
  345. Xu.usa.ut.1
  346. Xu.usa.vi.1
  347. Xu.usa.vt.1
  348. Xu.usa.wa.1
  349. Xu.usa.wa.2
  350. Xu.usa.wi.1
  351. Xu.usa.wv.1
  352. Xu.usa.wy.1
  353. Xu.yug.0
  354. Xu.yug.1
  355. Xu.zaf.1
  356. END_OF_FILE
  357.   if test 2310 -ne `wc -c <'deletelist'`; then
  358.     echo shar: \"'deletelist'\" unpacked with wrong size!
  359.   fi
  360.   # end of 'deletelist'
  361. fi
  362. if test -f 'display.c' -a "${1}" != "-c" ; then 
  363.   echo shar: Will not clobber existing file \"'display.c'\"
  364. else
  365.   echo shar: Extracting \"'display.c'\" \(2951 characters\)
  366.   sed "s/^X//" >'display.c' <<'END_OF_FILE'
  367. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  368. X   Please see the README for the terms of the copyright.
  369. X   1.3 92/08/15
  370. X */
  371. X
  372. X#ifndef lint
  373. Xstatic char SCCSid[] = "@(#)display.c 1.3 92/08/15 22:31:35";
  374. X#endif
  375. X#include "unpack.h"
  376. X
  377. Xextern long pathlength;
  378. Xextern char *gpathdata;
  379. Xextern int verbose;
  380. X
  381. Xdumpmap(site)
  382. Xregister char *site; {
  383. X    char buf[BUFSIZ];
  384. X    register char *s,*e;
  385. X    int cost;
  386. X
  387. X    pathlength = 0;
  388. X    gpathdata = wheredb;
  389. X
  390. X    if (getpath(site, buf, &cost))
  391. X    return(1);
  392. X
  393. X    s = buf;
  394. X    while(*s) {
  395. X    e = strchr(s, ':');
  396. X    if (e)
  397. X        *e++ = '\0';
  398. X    (void) dumpit(s);
  399. X    if (e)
  400. X        s = e;
  401. X    else
  402. X        break;
  403. X    }
  404. X    return(0);
  405. X}
  406. X
  407. Xdumpit(mapfn)
  408. Xchar *mapfn; {
  409. X
  410. X    char *p, *e;
  411. X    int offsets[20], *op = offsets;
  412. X
  413. X    p = strchr(mapfn, ',');
  414. X    if (!p)
  415. X    return(1);
  416. X    *p++ = '\0';    /* mapfn now is map file name */
  417. X    while(*p) {
  418. X    e = strchr(p, ',');
  419. X    if (e)
  420. X        *e = '\0';
  421. X    *op++ = atoi(p);
  422. X    if (e)
  423. X        p = e + 1;
  424. X    else
  425. X        break;
  426. X    }
  427. X    *op = 0;
  428. X    for (op = offsets; *op; op++)
  429. X    (void) printf("%s: %d\n", mapfn, *op);
  430. X    return(dumpfile(mapfn, offsets, 1));
  431. X}
  432. X
  433. Xdumpfile(mapfn, offsets, nterm)
  434. Xchar *mapfn;
  435. Xint *offsets, nterm; {
  436. X
  437. X    int compressed = 0, printing = 0;
  438. X    FILE *fin = (FILE *) NULL;
  439. X    register int *op = offsets;
  440. X    register int recno;
  441. X    char *((*rdfcn)());
  442. X    char *p;
  443. X    extern int rc;
  444. X
  445. X    extern FILE *zfopen();
  446. X    extern char *zfgets();
  447. X    
  448. X    if (debug)
  449. X    (void) fprintf(stderr, "mapfn: %s\n", mapfn);
  450. X
  451. X    if ((fin = fopen(mapfn, "r")) != NULL)
  452. X    rdfcn = fgets;
  453. X    else {
  454. X    (void) sprintf(tempbuf, "%s.Z", mapfn);
  455. X    fin = zfopen(tempbuf, "r");
  456. X    compressed = 1;
  457. X    rdfcn = zfgets;
  458. X    }
  459. X
  460. X    if (!fin) {
  461. X    (void) fprintf(stderr, "%s: Can't open %s\n", progname, mapfn);
  462. X    rc |= 1;
  463. X    return(1);
  464. X    }
  465. X
  466. X    recno = 0;
  467. X    while(rdfcn(tempbuf, sizeof(tempbuf), fin)) {
  468. X    recno++;
  469. X
  470. X    if (!printing && recno == *op) {
  471. X        printing = 1;
  472. X    }
  473. X    if (recno > *op && nterm && strncmp(tempbuf, "#N", 2) == 0) {
  474. X        op++;
  475. X        if (!*op)
  476. X        break;
  477. X        if (recno < *op)
  478. X        printing = 0;
  479. X    }
  480. X    if (printing) {
  481. X        if (verbose && tempbuf[0] == '#' &&
  482. X               isupper(tempbuf[1]) &&
  483. X               isspace(tempbuf[2])) {
  484. X        register char *str;
  485. X        str = "";
  486. X        switch(tempbuf[1]) {
  487. X            case 'N': str = "Name:"; break;
  488. X            case 'S': str = "System:"; break;
  489. X            case 'O': str = "Organization:"; break;
  490. X            case 'C': str = "Contacts:"; break;
  491. X            case 'E': str = "Email:"; break;
  492. X            case 'T': str = "Telephone:"; break;
  493. X            case 'P': str = "Postal:"; break;
  494. X            case 'L': str = "Lat/Long:"; break;
  495. X            case 'R': str = "Remarks:"; break;
  496. X            case 'U': str = "USENET links:"; break;
  497. X            case 'W': str = "Who:"; break;
  498. X        }
  499. X
  500. X        p = &tempbuf[1];
  501. X
  502. X        if (!isspace(tempbuf[1]))
  503. X            p++;
  504. X
  505. X        while(*p && (*p == ' ' || *p == '\t')) p++;
  506. X        (void) printf("#%-15s%s", str, p);
  507. X        } else
  508. X        (void) fputs(tempbuf, stdout);
  509. X    }
  510. X    }
  511. X
  512. X    if (compressed)
  513. X    (void) zfclose(fin);
  514. X    else
  515. X    (void) fclose(fin);
  516. X    return(0);
  517. X}
  518. END_OF_FILE
  519.   if test 2951 -ne `wc -c <'display.c'`; then
  520.     echo shar: \"'display.c'\" unpacked with wrong size!
  521.   fi
  522.   # end of 'display.c'
  523. fi
  524. if test -f 'docomp.c' -a "${1}" != "-c" ; then 
  525.   echo shar: Will not clobber existing file \"'docomp.c'\"
  526. else
  527.   echo shar: Extracting \"'docomp.c'\" \(2733 characters\)
  528.   sed "s/^X//" >'docomp.c' <<'END_OF_FILE'
  529. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  530. X   Please see the README for the terms of the copyright.
  531. X   1.2 92/08/14
  532. X */
  533. X
  534. X#ifndef lint
  535. Xstatic char SCCSid[] = "@(#)docomp.c 1.2 92/08/14 20:48:28";
  536. X#endif
  537. X#define    UNPACKMAPS
  538. X#include "unpack.h"
  539. X#define    ARMAX    10
  540. X
  541. X#ifdef    COMPFLAG
  542. X#define    FF    2
  543. X#else
  544. X#define    FF    1
  545. X#endif
  546. X
  547. X/*    Buffers up files to compress in big chunks */
  548. Xdocompress(file)
  549. Xregister char *file; {
  550. X    char tb[16];
  551. X    static char *arglist[ARMAX + 3] = {"COMPRESS"
  552. X#ifdef    COMPFLAG
  553. X    , COMPFLAG
  554. X#endif
  555. X    };
  556. X    static char **ap = &arglist[FF];
  557. X
  558. X    /* If maps are coming in two different newsgroups (not x-posted),
  559. X       it is possible that you'll get the same name twice.  If you
  560. X       don't ignore the duplicates, compress will complain that it
  561. X       couldn't find the subsequent instances.  While this is harmless,
  562. X       it is somewhat disturbing.  We simply ignore the
  563. X       second or subsequent mention of the same file name.
  564. X
  565. X       [The scenario happens with the Canadian maps.  Both Rutgers and
  566. X       the Canadian map authority post the Canadian maps simultaneously.
  567. X       The former in comp.mail.maps, the latter in can.uucp.maps.
  568. X       The logic behind this is relatively sound, but too long to reproduce
  569. X       here.  They're not cross-posted because it breaks uuhosts (but not
  570. X       unpackmaps! ;-).]
  571. X     */
  572. X
  573. X    if (file && ap > &arglist[FF]) {
  574. X    char **p;
  575. X    
  576. X    for (p = &arglist[FF]; p < ap; p++)
  577. X        if (strcmp(file, *p) == 0)
  578. X        return;
  579. X    }
  580. X
  581. X#if    (FILELENGTH == 0) || (FILELENGTH == 1)
  582. X# define MAXCOMPLEN 12
  583. X#else
  584. X# define MAXCOMPLEN (FILELENGTH - 2)
  585. X#endif
  586. X
  587. X    /* To avoid compress complaints on systems with file name restrictions */
  588. X    if (file && strlen(file) > MAXCOMPLEN)
  589. X    return;
  590. X
  591. X    if (file) {
  592. X    (void) strcpy(tb, file);
  593. X    (void) strcat(tb, ".Z");
  594. X    (void) unlink(tb);
  595. X    }
  596. X
  597. X    if (!compflag)
  598. X    return;
  599. X
  600. X    if (debug)
  601. X    (void) fprintf(stderr, "docompress %s (%d)\n", file, ap - arglist);
  602. X
  603. X    if ((!file || ap > &arglist[ARMAX]) && ap > &arglist[FF]) {
  604. X    int pid, wpid, waitloc;
  605. X    if (debug)
  606. X        (void) fprintf(stderr, "Firing off compress (fc = %d)\n",
  607. X        ap - arglist);
  608. X
  609. X    if (debug)
  610. X        for (ap = arglist; *ap; ap++)
  611. X        (void) fprintf(stderr, "%d: %s\n", ap-arglist, *ap);
  612. X
  613. X    fflush(stderr);
  614. X    if ((pid = fork()) == 0) {
  615. X        (void) execv(compress, arglist);
  616. X        fatal(1, "Can't exec compress");
  617. X    }
  618. X    while((wpid = wait(&waitloc)) != pid && wpid > 0)
  619. X        continue;
  620. X    if (waitloc) {
  621. X        (void) fprintf(stderr, "%s: compress failed, returned 0x%x (pid: %d)\n",
  622. X        progname, waitloc, wpid);
  623. X    }
  624. X    for (ap = &arglist[FF]; *ap; ap++)
  625. X        free(*ap);
  626. X    ap = &arglist[FF];
  627. X    }
  628. X    if (file) {
  629. X    *ap = (char *) malloc(strlen(file)+1);
  630. X    (void) strcpy(*ap++, file);
  631. X    *ap = (char *) NULL;
  632. X    }
  633. X}
  634. END_OF_FILE
  635.   if test 2733 -ne `wc -c <'docomp.c'`; then
  636.     echo shar: \"'docomp.c'\" unpacked with wrong size!
  637.   fi
  638.   # end of 'docomp.c'
  639. fi
  640. if test -f 'dointer.c' -a "${1}" != "-c" ; then 
  641.   echo shar: Will not clobber existing file \"'dointer.c'\"
  642. else
  643.   echo shar: Extracting \"'dointer.c'\" \(1322 characters\)
  644.   sed "s/^X//" >'dointer.c' <<'END_OF_FILE'
  645. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  646. X   Please see the README for the terms of the copyright.
  647. X   1.2 92/11/28
  648. X */
  649. X
  650. X#ifndef lint
  651. Xstatic char SCCSid[] = "@(#)dointer.c 1.2 92/11/28 00:44:13";
  652. X#endif
  653. X#define    UNPACKMAPS
  654. X#include "unpack.h"
  655. X
  656. Xint
  657. Xcountbang(path)
  658. Xregister char *path; {
  659. X    register int i;
  660. X    for (i = 0; *path; path++)
  661. X    if (*path == '!')
  662. X        i++;
  663. X    return(i);
  664. X}
  665. X
  666. Xdointernet(site, route)
  667. Xregister char *site, **route; {
  668. X    static int intbangcount = -1;
  669. X    register char *p;
  670. X    
  671. X    if (intbangcount == -1)
  672. X    intbangcount = countbang(internet);
  673. X
  674. X    if (*site == '.') {
  675. X    /* .domain longpath!%s -> .domain internet!%s */
  676. X    if (intbangcount + 2 < countbang(*route)) {
  677. X        (void) sprintf(tempbuf, "%s!%%s", internet);
  678. X        *route = tempbuf;
  679. X    }
  680. X    } else if (strchr(site, '.')) {
  681. X    /* domain longpath!%s -> domain internet!domain!%s */
  682. X    if (intbangcount + 2 < countbang(*route)) {
  683. X        (void) sprintf(tempbuf, "%s!%s!%%s", internet, site);
  684. X        *route = tempbuf;
  685. X    }
  686. X    } else if (p = strrchr(*route, '.')) {
  687. X    /* any longpath!domain!path!%s -> any internet!domain!path!%s */
  688. X    while(p > *route && *p != '!') p--;
  689. X    if (*p == '!') {
  690. X        *p = '\0';
  691. X        if (intbangcount < countbang(*route)) {
  692. X        (void) sprintf(tempbuf, "%s!%s", internet, p+1);
  693. X        *route = tempbuf;
  694. X        }
  695. X        *p = '!';
  696. X    }
  697. X    }
  698. X}
  699. END_OF_FILE
  700.   if test 1322 -ne `wc -c <'dointer.c'`; then
  701.     echo shar: \"'dointer.c'\" unpacked with wrong size!
  702.   fi
  703.   # end of 'dointer.c'
  704. fi
  705. if test -f 'dopath' -a "${1}" != "-c" ; then 
  706.   echo shar: Will not clobber existing file \"'dopath'\"
  707. else
  708.   echo shar: Extracting \"'dopath'\" \(203 characters\)
  709.   sed "s/^X//" >'dopath' <<'END_OF_FILE'
  710. XPATH=.:/usr/local/bin:$PATH export PATH
  711. XLD=/u/clewis/maps
  712. Xcd /u/clewis/src/unpackmaps
  713. Xunpackmaps -cup -Iuunet.ca -f $LD/path.local \
  714. X    -f $LD/path.private -ldeletelist -U
  715. Xunpackmaps -cud /usr/spool/pmaps
  716. END_OF_FILE
  717.   if test 203 -ne `wc -c <'dopath'`; then
  718.     echo shar: \"'dopath'\" unpacked with wrong size!
  719.   fi
  720.   # end of 'dopath'
  721. fi
  722. if test -f 'fatal.c' -a "${1}" != "-c" ; then 
  723.   echo shar: Will not clobber existing file \"'fatal.c'\"
  724. else
  725.   echo shar: Extracting \"'fatal.c'\" \(1487 characters\)
  726.   sed "s/^X//" >'fatal.c' <<'END_OF_FILE'
  727. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  728. X   Please see the README for the terms of the copyright.
  729. X   1.3 92/08/14
  730. X */
  731. X
  732. X#ifndef lint
  733. Xstatic char SCCSid[] = "@(#)fatal.c 1.3 92/08/14 20:48:32";
  734. X#endif
  735. X#define    UNPACKMAPS
  736. X#include "unpack.h"
  737. X
  738. Xfatal(code, msg)
  739. Xint code;
  740. Xchar *msg; {
  741. X
  742. X    if (code) {
  743. X    (void) fprintf(stderr, "%s: %s\n", progname, msg);
  744. X    (void) myexit(code);
  745. X    }
  746. X}
  747. X
  748. Xstatic char errlog[] = "/tmp/unpXXXXXX";
  749. Xextern char *mktemp();
  750. Xstartlog() {
  751. X    if (!(freopen(mktemp(errlog), "w", stderr))) {
  752. X    (void) printf("%s: Can't open temporary file %s for errors!\n",
  753. X        progname, errlog);
  754. X    exit(1);
  755. X    }
  756. X}
  757. X
  758. Xmyexit(code)
  759. Xint code; {
  760. X    struct stat stb;
  761. X    FILE *diag;
  762. X    FILE *notifyfp;
  763. X
  764. X    (void) unlink(pathtmp);
  765. X    (void) unlink(pathtmp2);
  766. X    (void) unlink(wheretmp);
  767. X    (void) fclose(stderr);
  768. X
  769. X    if (batchlock)
  770. X    setbatch(0);
  771. X
  772. X    if (!notify)
  773. X    exit(code);
  774. X
  775. X    if (stat(errlog, &stb) == 0 && stb.st_size > 0) {
  776. X
  777. X    if (!(notifyfp = popen(notify, "w"))) {
  778. X        (void) printf("%s: Can't open mail pipeline ``%s''\n", progname, notify);
  779. X        (void) exit(1);
  780. X    }
  781. X
  782. X    (void) fputs("Subject: Map Unpacking Report\n\n", notifyfp);
  783. X
  784. X    if (!(diag = fopen(errlog, "r"))) {
  785. X        (void) printf("%s: Can't open error log %s\n",
  786. X         progname, errlog);
  787. X        (void) exit(1);
  788. X    }
  789. X
  790. X    while(fgets(spooldir, sizeof(spooldir), diag)) {
  791. X        (void) fputs(spooldir, notifyfp);
  792. X    }
  793. X    (void) fclose(diag);
  794. X    (void) pclose(notifyfp);
  795. X    } 
  796. X    (void) unlink(errlog);
  797. X    (void) exit(code);
  798. X}
  799. END_OF_FILE
  800.   if test 1487 -ne `wc -c <'fatal.c'`; then
  801.     echo shar: \"'fatal.c'\" unpacked with wrong size!
  802.   fi
  803.   # end of 'fatal.c'
  804. fi
  805. if test -f 'fileinit.c' -a "${1}" != "-c" ; then 
  806.   echo shar: Will not clobber existing file \"'fileinit.c'\"
  807. else
  808.   echo shar: Extracting \"'fileinit.c'\" \(634 characters\)
  809.   sed "s/^X//" >'fileinit.c' <<'END_OF_FILE'
  810. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  811. X   Please see the README for the terms of the copyright.
  812. X   1.1 92/06/10
  813. X */
  814. X
  815. X#ifndef lint
  816. Xstatic char SCCSid[] = "@(#)fileinit.c 1.1 92/06/10 01:16:15";
  817. X#endif
  818. X
  819. X#include "unpack.h"
  820. X
  821. Xchar *
  822. Xmakepath(dir, file)
  823. Xchar *dir, *file; {
  824. X    register char *p = (char *) malloc(strlen(dir) + strlen(file) + 10);
  825. X    char numbuf[10];
  826. X    fatal(!p, "Can't allocate temporary file names");
  827. X    (void) strcpy(p, dir);
  828. X    (void) strcat(p, "/");
  829. X    if (*file == '.') {
  830. X    (void) sprintf(numbuf, "%d", (int) getpid());
  831. X    (void) strcat(p, numbuf);
  832. X    }
  833. X    (void) strcat(p, file);
  834. X    return(p);
  835. X}
  836. END_OF_FILE
  837.   if test 634 -ne `wc -c <'fileinit.c'`; then
  838.     echo shar: \"'fileinit.c'\" unpacked with wrong size!
  839.   fi
  840.   # end of 'fileinit.c'
  841. fi
  842. if test -f 'getmaps.c' -a "${1}" != "-c" ; then 
  843.   echo shar: Will not clobber existing file \"'getmaps.c'\"
  844. else
  845.   echo shar: Extracting \"'getmaps.c'\" \(1622 characters\)
  846.   sed "s/^X//" >'getmaps.c' <<'END_OF_FILE'
  847. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  848. X   Please see the README for the terms of the copyright.
  849. X   1.1 92/06/10
  850. X */
  851. X
  852. X#ifndef lint
  853. Xstatic char SCCSid[] = "@(#)getmaps.c 1.1 92/06/10 01:16:16";
  854. X#endif
  855. X
  856. X#include "unpack.h"
  857. X
  858. X#if defined(USGDIR) || defined(BERKDIR)
  859. Xint
  860. Xfilesort(a, b)
  861. Xchar **a, **b; {
  862. X    return(strcmp(*a, *b));
  863. X}
  864. X
  865. Xvoid
  866. Xgetmaps(sl, flag)
  867. Xint flag;
  868. Xstruct stringlist *sl; {
  869. X    DIR *dirp;
  870. X    struct dirent *dp;
  871. X    struct stat stb;
  872. X
  873. X    dirp = opendir(".");
  874. X    while((dp = readdir(dirp)) != NULL) {
  875. X    if (dp->d_name[0] == '.')
  876. X        continue;
  877. X    if (flag && ((dp->d_name[0] != 'd' && dp->d_name[0] != 'u') ||
  878. X        dp->d_name[1] != '.'))
  879. X        continue;
  880. X    if (debug)
  881. X        (void) fprintf(stderr, "Adding %s\n", dp->d_name);
  882. X    if (stat(dp->d_name, &stb))
  883. X        (void) fprintf(stderr, "Can't stat %s\n", dp->d_name);
  884. X    else
  885. X        (void) savestr(sl, dp->d_name);
  886. X    }
  887. X    (void) closedir(dirp);
  888. X    (void) qsort(sl->list, sl->curptr - sl->list, sizeof(char **), filesort);
  889. X}
  890. X#else
  891. Xvoid
  892. Xgetmaps(sl, flag)
  893. Xstruct stringlist *sl;
  894. Xint flag; {
  895. X    char buf[40];
  896. X    register char *p;
  897. X    FILE *list;
  898. X    struct stat stb;
  899. X
  900. X    /* first, collect the files from the directory */
  901. X    fatal(!(list = popen("/bin/ls * 2>/dev/null", "r")), "can't popen map list");
  902. X
  903. X    while(fgets(buf, sizeof(buf), list)) {
  904. X    if ((p = strchr(buf, '\n')) != NULL)
  905. X        *p = '\0';
  906. X    if (flag && ((buf[0] != 'd' && buf[0] != 'u') || buf[1] != '.'))
  907. X        continue;
  908. X    if (stat(buf, &stb))
  909. X        (void) fprintf(stderr, "Can't stat %s\n", buf);
  910. X    else
  911. X        (void) savestr(sl, buf);
  912. X    }
  913. X
  914. X    fatal(pclose(list), "Spool area ls failed");
  915. X}
  916. X#endif
  917. END_OF_FILE
  918.   if test 1622 -ne `wc -c <'getmaps.c'`; then
  919.     echo shar: \"'getmaps.c'\" unpacked with wrong size!
  920.   fi
  921.   # end of 'getmaps.c'
  922. fi
  923. if test -f 'getpath.c' -a "${1}" != "-c" ; then 
  924.   echo shar: Will not clobber existing file \"'getpath.c'\"
  925. else
  926.   echo shar: Extracting \"'getpath.c'\" \(2330 characters\)
  927.   sed "s/^X//" >'getpath.c' <<'END_OF_FILE'
  928. X/* taken from: *sccsid="@(#)getpath.c    2.5 (smail) 9/15/87";
  929. X   Permission pending
  930. X */
  931. X
  932. X#ifndef lint
  933. Xstatic char SCCSid[] = "@(#)getpath.c 1.1 92/06/10 01:16:17";
  934. X#endif
  935. X
  936. X#include "unpack.h"
  937. X
  938. X#define DEBUG    if (debug) (void) printf
  939. Xchar *gpathdata;
  940. X#define    lower(x)    (isupper(x)? x-'A'+'a' : x)
  941. X
  942. X/*
  943. X**
  944. X** getpath(): look up key in ascii sorted path database.
  945. X**
  946. X*/
  947. X
  948. X/*    Every time reset to zero, path file is reopened */
  949. Xlong pathlength = 0;
  950. X
  951. Xgetpath( key, path, cost)
  952. Xchar *key;        /* what we are looking for */
  953. Xchar *path;        /* where the path results go */
  954. Xint *cost;        /* where the cost results go */
  955. X{
  956. X    long pos, middle, hi, lo;
  957. X    register char *s;
  958. X    int c;
  959. X    int flag;
  960. X    static FILE *file = (FILE *) NULL;
  961. X
  962. X    DEBUG("getpath: looking for '%s'\n", key);
  963. X
  964. X    if(pathlength == 0) {    /* open file on first use */
  965. X        if (file)
  966. X            (void) fclose(file);
  967. X        if((file = fopen(gpathdata, "r")) == NULL) {
  968. X            (void) printf("Can't access %s.\n", gpathdata);
  969. X            pathlength = -1;
  970. X        } else {
  971. X            (void) fseek(file, 0L, 2);    /* find length */
  972. X            pathlength = ftell(file);
  973. X        }
  974. X    }
  975. X    if( pathlength == -1 )
  976. X        return( 1 );
  977. X
  978. X    lo = 0;
  979. X    hi = pathlength;
  980. X    (void) strcpy( path, key );
  981. X    (void) strcat( path, "\t" );
  982. X/*
  983. X** "Binary search routines are never written right the first time around."
  984. X** - Robert G. Sheldon.
  985. X*/
  986. X    for( ;; ) {
  987. X        pos = middle = ( hi+lo+1 )/2;
  988. X        (void) fseek(file, pos, 0);    /* find midpoint */
  989. X        if(pos != 0)
  990. X            while(((c = getc(file)) != EOF) && (c != '\n'))
  991. X                continue;    /* go to beginning of next line */
  992. X        if(c == EOF) {
  993. X            return(1);
  994. X        }
  995. X        for( flag = 0, s = path; flag == 0; s++ ) { /* match??? */
  996. X            if( *s == '\0' ) {
  997. X                goto solved;
  998. X            }
  999. X            if((c = getc(file)) == EOF) {
  1000. X                return(1);
  1001. X            }
  1002. X            flag = lower(c) - lower(*s);
  1003. X        } 
  1004. X        if(lo >= middle) {        /* failure? */
  1005. X            return(1);
  1006. X        }
  1007. X        if((c != EOF) && (flag < 0)) {    /* close window */
  1008. X            lo = middle;
  1009. X        } else {
  1010. X            hi = middle - 1;
  1011. X        }
  1012. X    }
  1013. X/* 
  1014. X** Now just copy the result.
  1015. X*/
  1016. Xsolved:
  1017. X    while(((c  = getc(file)) != EOF) && (c != '\t') && (c != '\n')) {
  1018. X        *path++ = c;
  1019. X    }
  1020. X    *path = '\0';
  1021. X/*
  1022. X** See if the next field on the line is numeric.
  1023. X** If so, use it as the cost for the route.
  1024. X*/
  1025. X    if(c == '\t') {
  1026. X        int tcost = -1;
  1027. X        while(((c = getc(file)) != EOF) && isdigit(c)) {
  1028. X            if(tcost < 0) tcost = 0;
  1029. X            tcost *= 10;
  1030. X            tcost += c - '0';
  1031. X        }
  1032. X        if(tcost >= 0) *cost = tcost;
  1033. X    }
  1034. X    return (0);
  1035. X}
  1036. X
  1037. END_OF_FILE
  1038.   if test 2330 -ne `wc -c <'getpath.c'`; then
  1039.     echo shar: \"'getpath.c'\" unpacked with wrong size!
  1040.   fi
  1041.   # end of 'getpath.c'
  1042. fi
  1043. if test -f 'lock.c' -a "${1}" != "-c" ; then 
  1044.   echo shar: Will not clobber existing file \"'lock.c'\"
  1045. else
  1046.   echo shar: Extracting \"'lock.c'\" \(1199 characters\)
  1047.   sed "s/^X//" >'lock.c' <<'END_OF_FILE'
  1048. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  1049. X   Please see the README for the terms of the copyright.
  1050. X   1.1 92/06/10
  1051. X */
  1052. X
  1053. X#ifndef lint
  1054. Xstatic char SCCSid[] = "@(#)lock.c 1.1 92/06/10 01:16:19";
  1055. X#endif
  1056. X
  1057. X#define UNPACKMAPS
  1058. X#include "unpack.h"
  1059. X
  1060. X#define    TRYTIME
  1061. X
  1062. Xint
  1063. Xsetbatch(on)
  1064. Xint on; {
  1065. X#ifdef    LOCKBATCH
  1066. X    batchlock = 1;
  1067. X    return(mylock(LOCKBATCH, on));
  1068. X#else
  1069. X    return(0);
  1070. X#endif
  1071. X}
  1072. X
  1073. X#define INTERVAL    25
  1074. Xint
  1075. Xmylock(lockfile, on)
  1076. Xchar *lockfile;
  1077. Xint on; {
  1078. X    if (!on) {
  1079. X    (void) unlink(lockfile);
  1080. X    } else {
  1081. X    register char *tempnm, *p;
  1082. X    FILE *tempfp;
  1083. X    int locktries = 10;
  1084. X
  1085. X    fatal(!(tempnm = (char *) malloc(strlen(lockfile) + 15)),
  1086. X        "allocate temp lock");
  1087. X    (void) strcpy(tempnm, lockfile);
  1088. X    fatal(!(p = strrchr(tempnm, '/')), "Lock isn't full path");
  1089. X    *p = '\0';
  1090. X    (void) strcat(tempnm, "/LCKXXXXXX");
  1091. X    (void) mktemp(tempnm);
  1092. X
  1093. X    fatal(!(tempfp = fopen(tempnm, "w")), "Can't create temp lock");
  1094. X    (void) fprintf(tempfp, "%d\n", getpid());
  1095. X    (void) fclose(tempfp);
  1096. X
  1097. X    while (link(tempnm, lockfile) < 0) {
  1098. X        fatal(errno != EEXIST, "Can't link locks");
  1099. X        fatal(!(locktries--), "Couldn't get lock");
  1100. X        (void) sleep(INTERVAL);
  1101. X    }
  1102. X    (void) unlink(tempnm);
  1103. X    free(tempnm);
  1104. X    }
  1105. X    return(0);
  1106. X}
  1107. END_OF_FILE
  1108.   if test 1199 -ne `wc -c <'lock.c'`; then
  1109.     echo shar: \"'lock.c'\" unpacked with wrong size!
  1110.   fi
  1111.   # end of 'lock.c'
  1112. fi
  1113. if test -f 'savestr.c' -a "${1}" != "-c" ; then 
  1114.   echo shar: Will not clobber existing file \"'savestr.c'\"
  1115. else
  1116.   echo shar: Extracting \"'savestr.c'\" \(1002 characters\)
  1117.   sed "s/^X//" >'savestr.c' <<'END_OF_FILE'
  1118. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  1119. X   Please see the README for the terms of the copyright.
  1120. X   1.2 92/08/14
  1121. X */
  1122. X
  1123. X#ifndef lint
  1124. Xstatic char SCCSid[] = "@(#)savestr.c 1.2 92/08/14 20:48:38";
  1125. X#endif
  1126. X#define    UNPACKMAPS
  1127. X#include "unpack.h"
  1128. X
  1129. X#define    INCR    5
  1130. X
  1131. Xsavestr(l, s)
  1132. Xstruct stringlist *l;
  1133. Xchar *s; {
  1134. X    int count;
  1135. X    char **save;
  1136. X
  1137. X    if (!l->list || l->curptr >= l->lastalloc) {
  1138. X    count = (l->lastalloc - l->list) + 1 + INCR;
  1139. X    save = l->list;
  1140. X    if (l->list) {
  1141. X        l->list = (char **) realloc((char *)l->list, sizeof(char **) * count);
  1142. X        l->curptr = (l->curptr - save) + l->list;
  1143. X    } else {
  1144. X        l->list = (char **) malloc(sizeof(char **) * count);
  1145. X        l->curptr = l->list;
  1146. X    }
  1147. X    fatal(!l->list, "string list allocate - out of memory");
  1148. X    l->lastalloc = l->list + count - 1;
  1149. X    }
  1150. X
  1151. X    *l->curptr = (char *) malloc(strlen(s)+1);
  1152. X    fatal(!*l->curptr, "string list string allocate - out of memory");
  1153. X    (void) strcpy(*l->curptr, s);
  1154. X    l->curptr++;
  1155. X    *l->curptr = (char *) NULL;
  1156. X}
  1157. END_OF_FILE
  1158.   if test 1002 -ne `wc -c <'savestr.c'`; then
  1159.     echo shar: \"'savestr.c'\" unpacked with wrong size!
  1160.   fi
  1161.   # end of 'savestr.c'
  1162. fi
  1163. if test -f 'unpack.h' -a "${1}" != "-c" ; then 
  1164.   echo shar: Will not clobber existing file \"'unpack.h'\"
  1165. else
  1166.   echo shar: Extracting \"'unpack.h'\" \(1964 characters\)
  1167.   sed "s/^X//" >'unpack.h' <<'END_OF_FILE'
  1168. X/* Copyright 1992, Chris Lewis.  All Rights Reserved
  1169. X   Please see the README for the terms of the copyright.
  1170. X   1.5 92/11/28
  1171. X */
  1172. X
  1173. X#ifndef lint
  1174. X#ifdef INIT
  1175. Xstatic char head_SCCSid[] = "@(#)unpack.h 1.5 92/11/28 02:09:22";
  1176. X#endif
  1177. X#endif
  1178. X
  1179. X#define VERSION "unpackmaps 4.1"
  1180. X
  1181. X#include "config.h"
  1182. X#include <stdio.h>
  1183. X#include <errno.h>
  1184. X
  1185. Xextern int errno;
  1186. X
  1187. X
  1188. X#ifdef    NEEDTYPES_H
  1189. X#include <sys/types.h>
  1190. X#endif
  1191. X
  1192. X#include <sys/stat.h>
  1193. X
  1194. X#ifdef    BSD
  1195. X# include <strings.h>
  1196. X# define strchr    index
  1197. X# define strrchr rindex
  1198. X# include <sys/file.h>
  1199. X
  1200. X#else
  1201. X# include <string.h>
  1202. X
  1203. X# include <unistd.h>
  1204. X#endif
  1205. X
  1206. X#include <ctype.h>
  1207. X
  1208. X#ifndef    F_OK
  1209. X# define F_OK    0
  1210. X# define X_OK    1
  1211. X# define W_OK    2
  1212. X# define R_OK    4
  1213. X#endif
  1214. X
  1215. X#ifndef    INIT
  1216. X# define INIT(x)
  1217. X# define EXTERN extern
  1218. X#else
  1219. X# define EXTERN
  1220. X#endif
  1221. X
  1222. Xextern MALLRET *malloc();
  1223. Xextern MALLRET *realloc();
  1224. X
  1225. XEXTERN char
  1226. X    tempbuf[BUFSIZ],
  1227. X    unpackdir[BUFSIZ]    INIT(MAPDIR),
  1228. X    pathfile[BUFSIZ]    INIT(PATHFILE),
  1229. X    *wheredb;
  1230. X
  1231. X#ifdef    UNPACKMAPS
  1232. XEXTERN char
  1233. X    *togofile,
  1234. X    *workfile,
  1235. X    *tempfile,
  1236. X    *wheretmp,
  1237. X    *pathtmp,
  1238. X    *pathtmp2,
  1239. X    *notify            INIT((char *) NULL),
  1240. X    *pathalias        INIT(PATHALIAS),
  1241. X    compress[BUFSIZ]    INIT(COMPRESS),
  1242. X    spooldir[BUFSIZ]    INIT(SPOOLDIR);
  1243. X#endif    /* UNPACKMAPS */
  1244. X
  1245. X
  1246. Xstruct stringlist {
  1247. X    char **list;
  1248. X    char **curptr;
  1249. X    char **lastalloc;
  1250. X};
  1251. X
  1252. X#ifdef    UNPACKMAPS
  1253. X
  1254. XEXTERN struct stringlist
  1255. X            mapfiles,
  1256. X            lmapfiles,
  1257. X            localmaps;
  1258. X
  1259. XEXTERN char *internet        INIT((char*) NULL);
  1260. XEXTERN int verbose;
  1261. X
  1262. X
  1263. X#endif    /* UNPACKMAPS */
  1264. X
  1265. XEXTERN int
  1266. X    debug        INIT(0),
  1267. X    usage        INIT(0);
  1268. X
  1269. X#ifdef    UNPACKMAPS
  1270. XEXTERN int
  1271. X    runpath        INIT(0),
  1272. X    forcepath    INIT(0),
  1273. X    initialize    INIT(0),
  1274. X    compflag    INIT(0),
  1275. X    anyunpacked    INIT(0),
  1276. X    whereonly    INIT(0),
  1277. X    unlinkskip    INIT(0),
  1278. X    unlinkflag    INIT(0),
  1279. X    dontunpack    INIT(0),
  1280. X    batchlock    INIT(0);
  1281. X#endif    /* UNPACKMAPS */
  1282. X
  1283. Xextern FILE *popen();
  1284. X
  1285. XEXTERN char *progname;
  1286. X
  1287. XEXTERN char *makepath();
  1288. XEXTERN int setbatch();
  1289. X#ifdef USGDIR
  1290. X#include <dirent.h>
  1291. X#endif
  1292. X
  1293. X#ifdef BERKDIR
  1294. X#define    direct dirent
  1295. X#include <sys/dir.h>
  1296. X#endif
  1297. END_OF_FILE
  1298.   if test 1964 -ne `wc -c <'unpack.h'`; then
  1299.     echo shar: \"'unpack.h'\" unpacked with wrong size!
  1300.   fi
  1301.   # end of 'unpack.h'
  1302. fi
  1303. if test -f 'uuwhere.M' -a "${1}" != "-c" ; then 
  1304.   echo shar: Will not clobber existing file \"'uuwhere.M'\"
  1305. else
  1306.   echo shar: Extracting \"'uuwhere.M'\" \(1536 characters\)
  1307.   sed "s/^X//" >'uuwhere.M' <<'END_OF_FILE'
  1308. X.\"Copyright 1992 by Chris Lewis 1.1 92/06/10
  1309. X.TH UUWHERE 1 "Chris Lewis"
  1310. Xuuwhere \- USENET UUCP map viewer and path search
  1311. X.SH SYNOPSIS
  1312. X.B uuwhere
  1313. X.RB [ \-l ]
  1314. X.RB [ \-rregion ]
  1315. X.RB [ \-v ]
  1316. X.RB [ \-e ]
  1317. X.RI [ hosts ]
  1318. X.SH DESCRIPTION
  1319. XWithout any options
  1320. X.B uuwhere
  1321. Xwill search the UUCP routing database for the sites mentioned
  1322. Xand will display the UUCP route to them.
  1323. X.P
  1324. XIf the
  1325. X.B \-e
  1326. Xoption is also specified the map entries for the requested sites
  1327. Xwill also be displayed.
  1328. X.P
  1329. XIf the
  1330. X.B \-v
  1331. Xoption is specified, the output of both the path search and
  1332. Xmap entry search (if requested) will be more explanatory,
  1333. Xand the map keywords will be expanded.
  1334. X.P
  1335. XThe
  1336. X.B \-l
  1337. Xoption merely lists all of the files in the map database.
  1338. XIf any file has a
  1339. X.B .Z
  1340. Xsuffix (compressed), it is removed before display.
  1341. XAll other options are ignored.
  1342. X.P
  1343. XThe
  1344. X.BI \-r region
  1345. Xoption displays the map file
  1346. X.IR region .
  1347. XIf the
  1348. X.B \-v
  1349. Xoption is also specified, the keywords are expanded.
  1350. XAll other options are ignored.
  1351. X.P
  1352. XThere are two extra options to change the operation
  1353. Xof
  1354. X.BR uuwhere .
  1355. X.BI \-d mapdir
  1356. Xchanges the map directory to
  1357. X.IR mapdir .
  1358. X.BI \-m pathfile
  1359. Xchanges the path file for searching to
  1360. X.IR pathfile .
  1361. X.SH FILES
  1362. X.br
  1363. X.if t .ta 2.5i
  1364. X.if n .ta 3.5i
  1365. X/usr/spool/maps    Default map directory
  1366. X"/where.db    Where database
  1367. X"/maps    Where the unpacked maps are kept
  1368. X/usr/lib/uucp/paths    Default paths file
  1369. X.SH AUTHOR
  1370. X.B Uuwhere
  1371. Xwas written by Chris Lewis.
  1372. XThe binary search algorithm used for searching the path file
  1373. Xand
  1374. X.B uuwhere
  1375. Xdatabase is borrowed from Smail 2.5.
  1376. END_OF_FILE
  1377.   if test 1536 -ne `wc -c <'uuwhere.M'`; then
  1378.     echo shar: \"'uuwhere.M'\" unpacked with wrong size!
  1379.   fi
  1380.   # end of 'uuwhere.M'
  1381. fi
  1382. echo shar: End of archive 2 \(of 2\).
  1383. cp /dev/null ark2isdone
  1384. MISSING=""
  1385. for I in 1 2 ; do
  1386.     if test ! -f ark${I}isdone ; then
  1387.     MISSING="${MISSING} ${I}"
  1388.     fi
  1389. done
  1390. if test "${MISSING}" = "" ; then
  1391.     echo You have unpacked both archives.
  1392.     rm -f ark[1-9]isdone
  1393. else
  1394.     echo You still must unpack the following archives:
  1395.     echo "        " ${MISSING}
  1396. fi
  1397. exit 0
  1398.  
  1399. -- 
  1400. Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
  1401. Psroff 3.0 info: psroff-request@ferret.ocunix.on.ca
  1402. Ferret list: ferret-request@ferret.ocunix.on.ca
  1403.  
  1404. exit 0 # Just in case...
  1405.