home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume03 / uuhosts4 < prev    next >
Encoding:
Internet Message Format  |  1988-09-11  |  29.6 KB

  1. From: talcott!ut-sally!jsq (John Quarterman)
  2. Subject: uuhosts 1.69
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 90
  7. Submitted by: talcott!ut-sally!jsq (John Quarterman)
  8.  
  9. This is uuhosts version 1.69   Improvements over the last release (1.59)
  10. include faster execution, compressed maps, multiple hosts in #N lines,
  11. and path.local
  12.  
  13.         John Quarterman
  14.         Department of Computer Sciences
  15.         University of Texas at Austin
  16.         Austin, Texas 78712 USA
  17.         jsq@sally.utexas.edu (formerly jsq@ut-sally.ARPA)
  18.         {ctvax,gatech,harvard,ihnp4,pyramid,seismo,topaz}!ut-sally!jsq
  19.  
  20. : This is a shar archive.  Extract with sh, not csh.
  21. echo x - README
  22. sed -e 's/^X//' > README << '!RoNnIe!RaYgUn!'
  23. XThis is the source directory for uuhosts, which may be used to display
  24. XUUCP mail and USENET news information previously extracted from the
  25. XUSENET newsgroup mod.map.  Mail routing information as produced by
  26. Xpathalias is also displayed.  Since uuhosts needs the map information
  27. Xfrom the USENET spool directory for mod.map extracted into a more
  28. Xaccessible (and permanent) location it can also be used to do that.
  29. X
  30. XThis version of uuhosts, 1.69, works with the latest (December 1985)
  31. Xmod.map postings.  Changes from the previous distributed version, 1.59,
  32. Xinclude faster display (sed is used in place of awk), and path.local is
  33. Xused (per mod.map's README) instead of Local for local path information.
  34. XThe maps may be kept compressed to save disk space.  Multiple host names
  35. Xmay appear (separated by white space or commas) in #N lines of map entries.
  36. X
  37. XIf you have a uuhosts of version 1.58 or previous, you will need to
  38. X*completely reinstall* uuhosts.  Even with a newer version, you
  39. Xshould still run "uuhosts -setup", and it wouldn't hurt to do it all.
  40. X
  41. X
  42. XIf you don't have a UNIX group named news in /etc/group, you should 
  43. Xcreate one, as uuhosts depends on it.
  44. X
  45. XTo install uuhosts, first look at the beginning of the Makefile and
  46. Xadjust any pathnames or other parameters which are incorrect for your
  47. Xsystem.  Then do "make" to be sure everything compiles correctly.
  48. XTo install the necessary shell script, C program, and manual entry,
  49. Xas well as creating all necessary new directories, do "make install"
  50. Xas root.
  51. X
  52. XOnce the program is installed, you will want to extract any existing
  53. Xmod.map articles so uuhosts can display their information.  To do
  54. Xthis, type "uuhosts -setup &".  Do not do it as root!  Do it as some
  55. Xuser in group news.  It will take a while:  display speed has been
  56. Xbought by slowness in extraction.  You should only need to do this
  57. Xonce, because of the last installation steps:
  58. X
  59. XFinally, modify NEWS/sys by hand so that inews will batch incoming
  60. Xmod.map articles, and also arrange for "uuhosts -unbatch" to
  61. Xbe called nightly by cron.  See the MAINTENANCE section of the uuhosts
  62. Xmanual entry for how to do this.  Do not call "uuhosts -unbatch" as root!
  63. XHave it called as some user in group news.
  64. X
  65. X
  66. XNeither pathalias nor compress are included here.  Both have been
  67. Xposted to mod.sources recently:  contact the moderator for copies.
  68. XIf you have uupath, you may want to use it to look up UUCP routing
  69. Xinformation instead of the method uuhosts uses by default.
  70. XJust look for uupath in uuhosts.sh and it's obvious what to change.
  71. X
  72. X
  73. XFor the mod.map extraction (and *only* that extraction), uuhosts
  74. Xdepends on a small setuid program called mapsh (included here) which
  75. Xuses chroot(2), which is in (at least) 4BSD, System N, and Version 7.
  76. XThe purpose of mapsh is to limit the commands which may be executed
  77. Xwhen found in a map article.  If you trust everyone who can post to
  78. XUSENET from any machine in the world, you can probably replace mapsh
  79. Xwith "cd $MAPS; sh".  Or you can use unmvax!lee's article parser in C,
  80. Xif you like.
  81. X
  82. X        John Quarterman
  83. X        Department of Computer Sciences
  84. X        University of Texas at Austin
  85. X        Austin, Texas 78712 USA
  86. X        jsq@sally.utexas.edu (formerly jsq@ut-sally.ARPA)
  87. X        {ctvax,gatech,harvard,ihnp4,pyramid,seismo,topaz}!ut-sally!jsq
  88. X
  89. XHere is an example of the most common use of uuhosts, which is to
  90. Xdisplay information about a particular host:
  91. X
  92. Xim4u% uuhosts nbires
  93. XUUCP mail path from im4u to nbires:
  94. Xnbires    ut-sally!nbires!%s
  95. XUUCP mail path for nbires annotated by location:
  96. Xnbires(usa.co)    ut-sally(usa.tx)!nbires(usa.co)!%s
  97. X
  98. XUUCP mail information for host nbires (#USENET lines show USENET news links):
  99. X#Name            nbires
  100. X#System-CPU-OS        VAX-11/750; UNIX BSD 4.2
  101. X#Organization        NBI, Inc.
  102. X#Contact        Kirk Webb
  103. X#Electronic-Address    postmaster@nbires.UUCP
  104. X#Telephone        (303) 444-5710
  105. X#Postal-Address        P.O. Box 9001, Boulder, CO 80301
  106. X#Latitude-Longitude    40 01 N / 105 17 W city
  107. X#Written-by        mccallum@nbires.UUCP (Doug McCallum); Mon Sep  9 13:27:28 MDT 1985
  108. X#USENET    cires opus stcvax gangue utopia hao isis bdaemon fred boulder
  109. Xnbires    allegra(EVENING+HIGH), amd(EVENING+HIGH), attunix(EVENING+HIGH),
  110. X    boulder(DEMAND), bdaemon(DEMAND), cbosgd(EVENING+HIGH), cires(DEMAND),
  111. X    cisden(DEMAND), cornell(EVENING), csu-cs(DEMAND), ctvax(DEMAND),
  112. X    cadnetix(DEMAND), 
  113. X    fred(DIRECT), gangue(DEMAND), galon(DEMAND), hao(DEMAND),
  114. X    isis(DIRECT), koala(DEMAND),
  115. X    lbl-csam(EVENING),
  116. X    onecom(DIRECT),
  117. X    princeton(WEEKLY/3), pyramid(EVENING+LOW),
  118. X    scgvaxd(EVENING), stcvax(DEMAND), ucbvax(EVENING+HIGH),
  119. X    udenva(DEMAND), uofm-cv(EVENING), usenix(EVENING+HIGH), usiiden(DEMAND),
  120. X    utah-cs(EVENING+LOW), ut-ngp(EVENING), ut-sally(EVENING),
  121. X    utopia(DAILY), unidot(DEMAND), vianet(POLLED)
  122. X# nbinet = @{nbires, binkley, opus, yaz, milo, oasys, boson}(LOCAL)
  123. X
  124. !RoNnIe!RaYgUn!
  125. echo x - uuhosts.sh
  126. sed -e 's/^X//' > uuhosts.sh << '!RoNnIe!RaYgUn!'
  127. X#!/bin/sh
  128. X# '@(#) uuhosts.sh 1.69 86/01/06'
  129. X# uuhosts - UUCP mail and USENET news information
  130. X
  131. XMAPS=/usr/spool/news/maps
  132. XUUCPMAPGROUP=mod.map
  133. XUUCPMAP=$UUCPMAPGROUP
  134. XRUUHOSTS=uuhosts
  135. XDEFPAGER=cat
  136. Xpager="${PAGER-$DEFPAGER}"
  137. X
  138. Xcase $RUUHOSTS in
  139. X"")
  140. X    ;;
  141. X*)
  142. X    if [ ! -d $MAPS/$UUCPMAP ]; then
  143. X        client $RUUHOSTS uuhosts $* | $pager
  144. X        exit
  145. X    fi
  146. X    ;;
  147. Xesac
  148. X
  149. XBIN=/usr/local
  150. XLIB=/usr/local/lib
  151. XNEWS=$LIB/news
  152. XMAPSH=$NEWS/mapsh
  153. XUUCPSPOOL=/usr/spool/news/mod/map
  154. XPATHS=$LIB/nmail.paths
  155. XWHERE=$LIB/nmail.where
  156. XLOOK=1
  157. XCOMPRESS=1
  158. Xcase $COMPRESS in
  159. X"")
  160. X    zcat=cat
  161. X    ;;
  162. X*)
  163. X    zcat=zcat
  164. X    ;;
  165. Xesac
  166. X
  167. Xcase $1 in
  168. X    -setup)
  169. X        # Initial setup.  Should only need to be done once.
  170. X        ls $UUCPSPOOL/[0-9]* > $MAPS/$UUCPMAP/Batch
  171. X        exec $BIN/uuhosts -unbatch
  172. X        exit 1
  173. X    ;;
  174. X
  175. X    -unbatch)
  176. X        # Unbatch map articles batched by inews.  Called from cron.
  177. X        cd $MAPS/$UUCPMAP
  178. X        if [ -f Batch ]; then
  179. X            :
  180. X        else
  181. X            exit 1
  182. X        fi
  183. X        mv Batch Batch.working
  184. X        for f in `cat Batch.working`
  185. X        do
  186. X            $BIN/uuhosts -x < $f
  187. X            sleep 60
  188. X        done
  189. X        rm Batch.working
  190. X        exec $BIN/uuhosts -i
  191. X        exit 1
  192. X    ;;
  193. X
  194. X    -x)
  195. X        # extract a new map piece into a map directory
  196. X        temphead=/tmp/maphead.$$
  197. X        temptext=/tmp/maptext.$$
  198. X        tempcomm=/tmp/mapcomm.$$
  199. X        cp /dev/null $temphead
  200. X        cp /dev/null $temptext
  201. X        echo 'exec /bin/mail postmaster' > $tempcomm
  202. X        echo 'Reply-To: postmaster' > $temphead
  203. X        awk '
  204. XBEGIN    {
  205. X    temphead = "'$temphead'"; tempcomm = "'$tempcomm'";
  206. X    isuucpmap = 1;    # Assume most postings are map entries.
  207. X    shead = 0; stext = 1; suucp = 2;
  208. X    state = shead;
  209. X}
  210. Xstate == shead && ($1 == "From:" || $1 == "Sender:" \
  211. X    || $1 == "Date:" || $1 == "Message-ID:" || $1 == "Message-Id:") {
  212. X    print "Original-" $0 >> temphead;
  213. X    next;
  214. X}
  215. Xstate == shead && $1 == "Newsgroups:" {    # no cross-postings allowed
  216. X     if ($2 != "'$UUCPMAPGROUP'") {
  217. X        isuucpmap = 0;
  218. X         print "Bad-Newsgroups: " $2 " (should be '"$UUCPMAPGROUP"')" \
  219. X             >> temphead;
  220. X         next;
  221. X    }
  222. X}
  223. Xstate == shead && $1 == "Subject:" {
  224. X    # the odd initial test is to avoid certain brain damaged awks
  225. X    if ("X" ~ /X/ \
  226. X    && $2 !~ /^UUCP/ && $2 !~ /^uucp/ && $2 !~ /^Uucp/) {
  227. X        print "Subject:  not a map update" >> temphead;
  228. X        print "Original-" $0 >> temphead;
  229. X        isuucpmap = 0;
  230. X    } else
  231. X        print $0 >> temphead;
  232. X    next;
  233. X}
  234. Xstate == shead && /^$/    {
  235. X    if (isuucpmap != 0) {
  236. X    print "PATH=/bin; umask 0002; cd '$UUCPMAP'" | "'$MAPSH'";
  237. X        state = suucp;
  238. X    } else
  239. X        state = stext;
  240. X}
  241. Xstate == shead {
  242. X        print $0 >> temphead;
  243. X}
  244. Xstate == suucp    {
  245. X    print | "'$MAPSH'";
  246. X}
  247. Xstate == stext    {
  248. X    print;
  249. X}
  250. X' > $temptext 2>&1
  251. X        cat $temphead $temptext | sh $tempcomm
  252. X        rm -f $temphead $temptext $tempcomm
  253. X        exit 0
  254. X    ;;
  255. X
  256. X    -compress)
  257. X        case $COMPRESS in
  258. X        "")
  259. X            exit
  260. X            ;;
  261. X        esac
  262. X        cd $MAPS/$UUCPMAP
  263. X        if [ -f README ]; then
  264. X            compress -f README
  265. X        fi
  266. X        compress -f [a-z]*.*[a-z0-9]
  267. X        exit 0
  268. X    ;;
  269. X
  270. X    -i)
  271. X        # Create the Index used for fast lookups.
  272. X        cd $MAPS/$UUCPMAP
  273. X        $BIN/uuhosts -compress
  274. X        for file in [a-z]*.*
  275. X        do
  276. X            f=`basename $file .Z`
  277. X            $zcat $f |
  278. X            sed -n -e "s/,/ /g" -e "/^#N/s/#N[     ]*//p" |
  279. X            awk 'BEGIN { filename = "'"$f"'" }
  280. X            {
  281. X                for (x=1; x<=NF; x++)
  282. X                    printf("%s\t%s\n", $x, filename);
  283. X            }'
  284. X        done | sort -f > Index.$$
  285. X         mv Index.$$ Index
  286. X        if [ -f $LIB/uuwhere ]; then
  287. X            $LIB/uuwhere
  288. X        fi
  289. X        exit 0
  290. X    ;;
  291. X
  292. X    -r)
  293. X        # by region
  294. X        cd $MAPS/$UUCPMAP
  295. X        shift
  296. X        case $# in
  297. X        0)
  298. X            exec ls
  299. X            exit 1
  300. X        ;;
  301. X        esac
  302. X        case $COMPRESS in
  303. X        "")
  304. X            exec $pager $*
  305. X            exit 1
  306. X            ;;
  307. X        *)
  308. X            zcat $* | $pager
  309. X            exit 0
  310. X            ;;
  311. X        esac
  312. X        exit 1
  313. X    ;;
  314. X
  315. X    -u)
  316. X        exec $BIN/uuhosts -r
  317. X        exit 1
  318. X    ;;
  319. X
  320. X    -n)
  321. X        exec $BIN/uuhosts -r
  322. X        exit 1
  323. X    ;;
  324. X
  325. X    -k)
  326. X        # by keyword
  327. X        cd $MAPS/$UUCPMAP
  328. X        shift
  329. X        $zcat [a-z]*.* | awk '
  330. XBEGIN        { inside = 1; outside = 0; state = outside; }
  331. X/^#N/ && state == inside    {
  332. X    if (useit == 1) {
  333. X        for (i = 0; i < count; i++) {
  334. X            print block[i];
  335. X        }
  336. X    }
  337. X    state = outside;
  338. X}
  339. X/^#N/    { state = inside; count = 0; useit = 0; }
  340. Xstate == inside    { block[count++] = $0; }
  341. X/'"$*"'/    { useit = 1; }
  342. XEND {
  343. X    if (useit == 1) {
  344. X        for (i = 0; i < count; i++) {
  345. X            print block[i];
  346. X        }
  347. X    }
  348. X}
  349. X' | $pager
  350. X        exit 0
  351. X    ;;
  352. X
  353. X    -*)
  354. X        # unknown option
  355. X    ;;
  356. X
  357. X    "")
  358. X        # no arguments
  359. X    ;;
  360. X
  361. X    *)
  362. X        # by host name
  363. X        case $LOOK in
  364. X        "")
  365. X            look=grep
  366. X            lookopt="^"
  367. X            ;;
  368. X        *)
  369. X            look=look
  370. X            lookopt="-f "
  371. X            ;;
  372. X        esac
  373. X        for arg in $*
  374. X        do
  375. X            echo "UUCP mail path from `uuname -l` to $arg:"
  376. X            $look $lookopt$arg $PATHS
  377. X#             uupath $arg
  378. X            case $WHERE in
  379. X            "")
  380. X                ;;
  381. X            *)
  382. X            if [ -f $WHERE ]; then
  383. X            echo "UUCP mail path for $arg annotated by location:"
  384. X                $look $lookopt$arg $WHERE
  385. X            fi
  386. X                ;;
  387. X            esac
  388. X            echo "
  389. XUUCP mail information for host $arg (#USENET lines show USENET news links):"
  390. X            cd $MAPS/$UUCPMAP
  391. X# Find the Index entry for the host with look or sed.
  392. X# Select the file name(s) with sed.
  393. X# Uncompress the file and select the appropriate lines with sed.
  394. X            case $look in
  395. X            *look*)
  396. X                files=`$look $lookopt$arg Index |
  397. X                sed -n -e "/^$arg/s%.*    %%p"`
  398. X                ;;
  399. X            *)
  400. X                files=`
  401. X                sed -n -e "/^$arg/s%.*    %%p" Index`
  402. X                ;;
  403. X            esac
  404. X            case $files in
  405. X            "")
  406. X                continue
  407. X                ;;
  408. X            esac
  409. X            $zcat $files | sed -n -e ":toss
  410. X/#N.*[     ]*$arg/bcopy
  411. Xd
  412. Xbtoss
  413. X:copy
  414. Xs/^#N/#Name        /
  415. Xp
  416. Xn
  417. X:copy2
  418. X/^#N/btoss
  419. Xs/^#S/#System-CPU-OS    /
  420. Xs/^#O/#Organization    /
  421. Xs/^#C/#Contact    /
  422. Xs/^#E/#Electronic-Address/
  423. Xs/^#T/#Telephone    /
  424. Xs/^#P/#Postal-Address    /
  425. Xs/^#L/#Latitude-Longitude/
  426. Xs/^#R/#Remarks    /
  427. Xs/^#W/#Written-by    /
  428. Xs/^#U/#USENET/
  429. Xp
  430. Xn
  431. Xbcopy2"
  432. X        done | $pager
  433. X        exit 0
  434. X    ;;
  435. Xesac
  436. X
  437. Xecho 'Usage:    uuhosts hostname ...
  438. Xfor information about a particular UUCP or USENET host or hosts, or
  439. X
  440. X    uuhosts -r region
  441. Xfor information about hosts in a region of the UUCP or USENET networks, or
  442. X
  443. X    uuhosts -r
  444. Xfor a list of known regions.
  445. X
  446. XSee uuhosts(1) or "uuhosts -r README" for further details.
  447. X'
  448. Xexit 1
  449. !RoNnIe!RaYgUn!
  450. echo x - mapsh.c
  451. sed -e 's/^X//' > mapsh.c << '!RoNnIe!RaYgUn!'
  452. X#include <stdio.h>
  453. X/*
  454. X    This command depends on chroot(2), which exists in 4BSD, System V,
  455. X    Version 7, and probably all related systems.
  456. X */
  457. X
  458. X#ifndef MAPS
  459. X#define MAPS "/usr/local/lib/news/maps"
  460. X#endif
  461. X
  462. Xmain(argc,argv)
  463. Xint argc;
  464. Xchar **argv;
  465. X{
  466. X    char *rootdir = MAPS;
  467. X    char *command = "/bin/sh";
  468. X
  469. X    if (geteuid() != 0) {
  470. X        fprintf (stderr, "mapsh must be setuid to root\n");
  471. X        exit(1);
  472. X    }
  473. X    if (chroot(rootdir) == -1) {
  474. X        fprintf (stderr, "mapsh:  chroot(%s) failed\n", rootdir);
  475. X        perror ("");
  476. X        exit(1);
  477. X    }
  478. X    if (setuid(getuid()) == -1) {
  479. X        perror ("mapsh:  setuid(getuid()) failed");
  480. X        exit(1);
  481. X    }
  482. X    if (chdir("/") == -1) {
  483. X        fprintf (stderr, "mapsh:  chdir(%s) failed\n", "/");
  484. X        perror ("");
  485. X        exit(1);
  486. X    }
  487. X    execvp (command, argv);
  488. X    fprintf (stderr, "mapsh:  %s not found\n", command);
  489. X    perror ("mapsh:  execvp(2) failed");
  490. X    exit(1);
  491. X}
  492. !RoNnIe!RaYgUn!
  493. echo x - uuwhere.c
  494. sed -e 's/^X//' > uuwhere.c << '!RoNnIe!RaYgUn!'
  495. X#ifndef lint
  496. Xchar sccsid[] = "@(#) uuwhere.c 1.12 85/11/29";
  497. X#endif
  498. X/*
  499. X * uuwhere:
  500. X * This is a frill which may be called by uuhosts to annotate routing
  501. X * information produced by pathalias(1L) with the location of each host.
  502. X * It takes the ASCII UUCP routing database PATHS on standard input,
  503. X * and produces the annnotated version on standard output, to be put
  504. X * in WHERE.  It gets the location information from the UUCP map directory
  505. X * produced by uuhosts from the map posted to the USENET newsgroup
  506. X * mod.map.uucp by the UUCP Project.
  507. X *
  508. X * Uuwhere is usually called by uuhosts, and most of the time just
  509. X * checks to see if WHERE needs to be updated.  Uuhosts itself
  510. X * displays the annotated routing information to the user.
  511. X *
  512. X * The host location information is first put into a dbm(3x)
  513. X * database so that generating the final output will not take forever.
  514. X * If you don't have dbm, this won't work.
  515. X */
  516. X
  517. X#include <stdio.h>
  518. X#include <ctype.h>
  519. X#include <dbm.h>
  520. X#include <sys/types.h>
  521. X#include <sys/stat.h>
  522. X
  523. X#ifndef UUCPINDEX
  524. X#define UUCPINDEX "/usr/local/lib/news/maps/mod.map.uucp/Index"
  525. X#endif
  526. X#ifndef TMP
  527. X#define TMP "/usr/local/lib/nmail.tmp"
  528. X#endif
  529. X#ifndef PATHS
  530. X#define PATHS "/usr/local/lib/nmail.paths"
  531. X#endif
  532. X#ifndef WHERE
  533. X#define WHERE "/usr/local/lib/nmail.where"
  534. X#endif
  535. X#ifndef DATABASE
  536. X#define DATABASE    "/usr/local/lib/uuindex"
  537. X#endif
  538. X
  539. Xstatic int verbose, flagcreat, flagupdate, flaginput;
  540. X
  541. Xmain(argc, argv)
  542. Xint argc;
  543. Xregister char **argv;
  544. X{
  545. X    register FILE *fin;
  546. X    flagcreat = 0;
  547. X    flagupdate = 1;
  548. X    flaginput = 0;
  549. X
  550. X    (void) umask(0);
  551. X    while (*++argv != NULL) {
  552. X        if (**argv != '-') {
  553. X            flaginput = 1;
  554. X            flagupdate = 0;
  555. X        } else
  556. X        switch (argv[0][1]) {
  557. X            case '\0':
  558. X                flaginput = 1;
  559. X                flagupdate = 0;
  560. X                break;
  561. X            case 'c':
  562. X                flagcreat = 1;
  563. X                flagupdate = 0;
  564. X                break;
  565. X            case 'v':
  566. X                verbose = 1;
  567. X                break;
  568. X            default:
  569. X                usage();
  570. X                break;
  571. X        }
  572. X        if (flaginput)
  573. X            break;
  574. X    }
  575. X    if (verbose) {
  576. X        if (flagcreat)
  577. X            fprintf(stderr, "Force creation of database %s.\n",
  578. X                DATABASE);
  579. X        if (flagupdate)
  580. X            fprintf(stderr, "Attempt update of %s.\n",
  581. X                WHERE);
  582. X        if (flaginput)
  583. X            fprintf(stderr, "Input files (%s ...) specified.\n",
  584. X                *argv);
  585. X    }
  586. X    if (!flaginput) {
  587. X        (void)fclose(stdout);
  588. X        (void)fclose(stdin);
  589. X    }
  590. X    init(flagcreat, flagupdate, flaginput);
  591. X    if (!flaginput) {
  592. X        char tmpbuf[64];
  593. X
  594. X         if ((fin = fopen(PATHS, "r")) == (FILE *)NULL) {
  595. X            perror (PATHS);
  596. X            exit (1);
  597. X        }
  598. X        (void)sprintf(tmpbuf, "%s.%d", TMP, getpid());
  599. X        if (freopen(tmpbuf, "w", stdout) == (FILE *)NULL) {
  600. X            perror (tmpbuf);
  601. X            exit (1);
  602. X        }
  603. X        parsefile(fin, PATHS);
  604. X        (void)fclose(stdout);
  605. X        if (unlink (WHERE) == -1 || link(tmpbuf, WHERE) == -1) {
  606. X            perror(WHERE);
  607. X            exit(1);
  608. X        }
  609. X        (void)unlink(tmpbuf);
  610. X        exit (0);
  611. X    }
  612. X    for (; *argv != NULL; argv++) {
  613. X        if (strcmp (*argv, "-") == 0) {
  614. X            parsefile(stdin, "stdin");
  615. X            continue;
  616. X        }
  617. X        if ((fin = fopen(*argv, "r")) != (FILE *)NULL) {
  618. X            parsefile(fin, *argv);
  619. X            continue;
  620. X        }
  621. X        perror (*argv);
  622. X    }
  623. X    exit(0);
  624. X}
  625. X
  626. Xusage()
  627. X{
  628. X    fprintf (stderr, "usage:  uuwhere [-c] [-v] [infiles]\n");
  629. X    exit (1);
  630. X}
  631. X
  632. Xinit(flagcreat, flagupdate, flaginput)
  633. Xint flagcreat, flagupdate, flaginput;
  634. X{
  635. X    char datadir[512], datapag[512];
  636. X    struct stat statuucp, statpaths, statwhere;
  637. X    int fd;
  638. X    char c;
  639. X
  640. X/*
  641. X * If any of the stats fail,
  642. X * an open will fail later and produce a diagnostic.
  643. X */
  644. X    if (flagupdate
  645. X    && stat(WHERE, &statwhere) != -1
  646. X    && stat(PATHS, &statpaths) != -1
  647. X    && stat(UUCPINDEX, &statuucp) != -1) {
  648. X        if (statwhere.st_mtime > statpaths.st_mtime
  649. X        && statwhere.st_mtime > statuucp.st_mtime) {
  650. X            if (verbose)
  651. X                fprintf (stderr, "%s up to date\n", WHERE);
  652. X            exit(0);
  653. X        }
  654. X        if (statuucp.st_mtime > statwhere.st_mtime
  655. X        || statuucp.st_mtime > statpaths.st_mtime)
  656. X            flagcreat = 1;
  657. X    }
  658. X    if (!flaginput) {
  659. X        /* touch WHERE to forestall duplicate uuwheres */
  660. X        if ((fd = open(WHERE, 2)) < 0) {
  661. X            perror(WHERE);
  662. X            exit(1);
  663. X        }
  664. X        if (read (fd, &c, 1) == 1)
  665. X            (void) write (fd, &c, 1);
  666. X        (void) close (fd);
  667. X    }
  668. X    (void) sprintf (datadir, "%s.dir", DATABASE);
  669. X    (void) sprintf (datapag, "%s.pag", DATABASE);
  670. X    if (flagcreat || access(datadir, 0) == -1 || access(datapag, 0) == -1) {
  671. X        flagcreat = 1;
  672. X        if (verbose)
  673. X            fprintf (stderr, "Creating database %s...\n", DATABASE);
  674. X        if (makefile(datadir) == -1 || makefile(datapag) == -1)
  675. X            exit(1);
  676. X    }
  677. X    if (dbminit(DATABASE) < 0)
  678. X        exit(1);
  679. X    if (!flagcreat)
  680. X        return;
  681. X    if (!initit(UUCPINDEX))
  682. X        exit(1);
  683. X    if (verbose)
  684. X        fprintf (stderr, "...database %s created.\n", DATABASE);
  685. X}
  686. X
  687. Xmakefile(name)
  688. Xchar *name;
  689. X{
  690. X    register int fd;
  691. X
  692. X    if ((fd = creat(name, 0666)) == -1) {
  693. X        perror(name);
  694. X        return(-1);
  695. X    }
  696. X    (void) close(fd);
  697. X    return (0);
  698. X}
  699. X
  700. Xinitit(name)
  701. Xchar *name;
  702. X{
  703. X    register FILE *fp;
  704. X    char buffer[1024], site[128], where[128];
  705. X    datum key, data;
  706. X
  707. X    if (verbose)
  708. X        fprintf(stderr, "Reading %s...", name);
  709. X    if ((fp = fopen(name, "r")) == (FILE *)NULL) {
  710. X        perror(name);
  711. X        return (0);
  712. X    }
  713. X     while (fgets(buffer, sizeof(buffer), fp) != NULL) {
  714. X        if (sscanf(buffer, "%s%s", site, where) != 2) {
  715. X            fprintf (stderr, "Can't parse:  %s\n", buffer);
  716. X            continue;
  717. X        }
  718. X        key.dptr = site;
  719. X        key.dsize = strlen(key.dptr) + 1;
  720. X        data.dptr = where;
  721. X        data.dsize = strlen(data.dptr) + 1;
  722. X        store (key, data);
  723. X    }
  724. X    (void)fclose(fp);
  725. X    if (verbose)
  726. X        fprintf(stderr, ".\n");
  727. X    return(1);
  728. X}
  729. X
  730. Xparsefile(fin, name)
  731. Xregister FILE *fin;
  732. Xchar *name;
  733. X{
  734. X    char buffer[128];
  735. X    register char *cp;
  736. X    register int c;
  737. X    register int inside;
  738. X    register int last = 0;
  739. X
  740. X    if (verbose)
  741. X        fprintf(stderr, "%s\n", name);
  742. X    for (inside = 0; (c = getc(fin)) != EOF; putchar(c)) {
  743. X        if (isalnum(c) || c == '.' || c == '-' || c == '_') {
  744. X            if (!inside) {
  745. X                cp = buffer;
  746. X                inside = 1;
  747. X            }
  748. X            *cp++ = c;
  749. X            continue;
  750. X        }
  751. X        if (inside) {
  752. X            *cp = '\0';
  753. X            if (cp != buffer
  754. X/* %s */    && !((cp - buffer) == 1 && last == '%' && buffer[0] == 's'))
  755. X                doit(buffer);
  756. X            inside = 0;
  757. X        }
  758. X        last = c;
  759. X    }
  760. X}
  761. X
  762. Xdoit (site)
  763. Xchar *site;
  764. X{
  765. X    datum key, data;
  766. X
  767. X    key.dptr = site;
  768. X    key.dsize = strlen(key.dptr) + 1;
  769. X    data = fetch(key);
  770. X    if (data.dptr != NULL)
  771. X        printf ("(%s)", data.dptr);
  772. X}
  773. !RoNnIe!RaYgUn!
  774. echo x - uuhosts.man
  775. sed -e 's/^X//' > uuhosts.man << '!RoNnIe!RaYgUn!'
  776. X.TH UUHOSTS 1L 85/11/04
  777. X.SH NAME
  778. Xuuhosts \- UUCP mail and USENET news information.
  779. X.SH SYNOPSIS
  780. X.B
  781. Xuuhosts
  782. Xhostname ...
  783. X.br
  784. X.B
  785. Xuuhosts
  786. X-r [ region ]
  787. X.SH DESCRIPTION
  788. XThe \fIuuhosts\fP command is used to look up information about
  789. Xthe configurations of the UUCP mail network and the USENET news network.
  790. X.TP
  791. Xuuhosts \fIhostname\fP ...
  792. Xfor information about a particular UUCP or USENET host or hosts.
  793. XThe UUCP mail path is given first, followed by the map information.
  794. XThe USENET map is carried as notations in entries in the UUCP map,
  795. Xin the lines starting with ``#USENET''.
  796. XAny hosts with names for which the argument is a prefix are shown, e.g.:
  797. X.TP
  798. Xuuhosts ut
  799. Xgets information about all hosts whose names start with ``ut''.
  800. X.TP
  801. Xuuhosts \-r \fIregion\fP
  802. Xfor information about hosts in a (usually geographical) region.
  803. X.TP
  804. Xuuhosts \-r README
  805. Xgets an introduction to the map.
  806. X.TP
  807. Xuuhosts \-r path.local
  808. Xgets map information known only locally.
  809. X.TP
  810. Xuuhosts \-r
  811. Xfor a list of known regions.
  812. X.TP
  813. Xuuhosts
  814. Xwith no arguments gets a short usage message.
  815. X.PP
  816. XOutput is broken into pages by the program named in the PAGER environment
  817. Xvariable, or by a default pager set at compile time,
  818. Xwhich is usually one of more, pg, or cat,
  819. Xas appropriate for the host system.
  820. X.SH MAINTENANCE
  821. XNone of these options should be used by the super-user (root).
  822. X.TP
  823. Xuuhosts \-setup
  824. XOnce "make\ install" has been done for the initial installation,
  825. Xthis option may be used to extract any backlog of \fBUUCPMAPGROUP\fP articles.
  826. XDo not run it as root!
  827. XRun it as some user in group news.
  828. X.TP
  829. Xmaps:UUCPMAPGROUP:F:UUCPMAP/Batch
  830. XThis line should go in \fBNEWS/sys\fP.
  831. XIt causes \fIinews\fP(1L) to list the pathnames of incoming articles of
  832. X\fBUUCPMAPGROUP\fP in the \fBBatch\fP file.
  833. X.TP
  834. Xuuhosts \-unbatch
  835. XThis should be called nightly by \fIcron\fP(8) or whatever mechanism is
  836. Xused to call the USENET \fIexpire\fP(8) command.
  837. XIt extracts articles from \fBUUCPMAPGROUP\fP which have
  838. Xcome in since the last time it was run.
  839. XDo not run it as root!
  840. XRun it as some user in group news.
  841. X.TP
  842. Xuuhosts \-x
  843. XExtract an individual \fBUUCPMAPGROUP\fP article.
  844. XOrdinarily called from \fIuuhosts\fP\ \-\fBunbatch\fP.
  845. X.TP
  846. Xuuhosts \-i
  847. XRebuild the Index file (see below).
  848. XOrdinarily called from \fIuuhosts\fP\ \-\fBunbatch\fP.
  849. X.SH FILES
  850. X.TP
  851. XPATHS
  852. XUUCP mail path database as produced by \fIpathalias\fP and used by \fInmail\fP
  853. X(which is called automatically from \fIsendmail\fP on \fIut\-sally\fP)
  854. XIt is searched by \fIlook\fP(1), if present, else \fIgrep\fP(1).
  855. XThe file WHERE is similarly searched, if present:
  856. Xsee \fIuuwhere\fP(1).
  857. X.TP
  858. XUUCPMAP
  859. XUUCP and USENET map information taken from newsgroup \fBUUCPMAPGROUP\fP
  860. X(thanks to the UUCP mapping project).
  861. XNotices of updates are mailed to \fBpostmaster\fP, which should be an alias
  862. Xredistributing to the local mail and UUCP administrators.
  863. X.TP
  864. XUUCPMAP/Index
  865. XThis index is used to decrease search time on the map about an order
  866. Xof magnitude.
  867. XThe search is done by either \fIlook\fP(1) or \fIgrep\fP(1), as above.
  868. X.SH SEE ALSO
  869. Xvnews(1), readnews(1), mail(1), sendmail(8), look(1)
  870. !RoNnIe!RaYgUn!
  871. echo x - uuwhere.man
  872. sed -e 's/^X//' > uuwhere.man << '!RoNnIe!RaYgUn!'
  873. X.TH UUW\HERE 1L 85/08/11
  874. X.SH NAME
  875. Xuuwhere \- annotate UUCP mail routes by host location
  876. X.SH SYNOPSIS
  877. X.B
  878. XLIB/uuwhere
  879. X[ -c ]
  880. X[ infile ]
  881. X.SH DESCRIPTION
  882. XThe \fIuuwhere\fP command is used take a list of UUCP routes,
  883. Xsuch as produced by \fIpathalias\fP, and make a similar list,
  884. Xannotated by the geographical location of each host as found
  885. Xin the UUCP map posted to USENET newsgroup mod.map.uucp.
  886. XIt is ordinarily called with no arguments by \fIuuhosts\fP(1L),
  887. Xand will update \fBWHERE\fP, taking routes from \fBPATHS\fP and locations
  888. Xfrom \fBUUCPMAP/Index\fP, if either
  889. X\fBPATHS\fP or \fBUUCPMAP/Index\fP is newer than \fBWHERE\fP.
  890. XThe information in \fBWHERE\fP is displayed by \fIuuhosts\fP itself.
  891. X.PP
  892. XInput file names may be specified as arguments.
  893. XThis also causes output to go to standard output instead of directly to
  894. XInput file name \fI-\fP is taken to be standard input.
  895. X\fBWHERE\fP.
  896. X.TP
  897. X\-\fBc
  898. X\fIUuwhere\fP uses a \fIdbm\fP(3) database to store the location information
  899. Xfrom \fBUUCPMAP/Index\fP before creating output.
  900. XThis option causes \fIuuwhere\fP to recreate the database regardless
  901. Xof the state of any input files.
  902. X.SH FILES
  903. X.TP
  904. XWHERE
  905. XThe place where the output of \fIuuwhere\fP is usually kept for use
  906. Xby \fIuuhosts\fP.
  907. X.TP
  908. XPATHS
  909. XThe default route list used as input by \fIuuwhere\fP.
  910. XProduced by \fIuuhosts\fP.
  911. X.TP
  912. XUUCPMAP/Index
  913. XThe source of the location information used by \fIuuwhere\fP.
  914. XProduced by \fIpathalias\fP.
  915. X.SH SEE ALSO
  916. Xuuhosts(1), pathalias(1), dbm(3).
  917. !RoNnIe!RaYgUn!
  918. echo x - maps.ls
  919. sed -e 's/^X//' > maps.ls << '!RoNnIe!RaYgUn!'
  920. X/usr/spool/news/maps:
  921. Xtotal 9
  922. Xdr-xr-xr-x  5 root     news          512 Sep 17 09:10 .
  923. Xdrwxrwxrwx 20 news     news         1024 Jan  6 10:06 ..
  924. Xdr-xr-xr-x  2 root     news          512 Aug 10 11:07 bin
  925. Xdrwxrwxr-x  2 root     news         4608 Jan  4 09:57 mod.map
  926. Xdrwxrwxrwx  2 root     news         1024 Dec  6 18:12 tmp
  927. X/usr/spool/news/maps/bin:
  928. Xtotal 75
  929. Xdr-xr-xr-x  2 root     news          512 Aug 10 11:07 .
  930. Xdr-xr-xr-x  5 root     news          512 Sep 17 09:10 ..
  931. X-r-xr-xr-x  1 root     news        16384 Jan  2 12:20 cat
  932. X-r-xr-xr-x  1 root     news         8192 Jan  2 12:20 echo
  933. X-r-xr-xr-x  1 root     news        23552 Jan  2 12:20 sed
  934. X-r-xr-xr-x  1 root     news        26624 Jan  2 12:20 sh
  935. !RoNnIe!RaYgUn!
  936. echo x - Makefile
  937. sed -e 's/^X//' > Makefile << '!RoNnIe!RaYgUn!'
  938. X# @(#) Makefile 1.33 85/12/09
  939. XSHELL=/bin/sh
  940. X
  941. X# Settable parameters.
  942. X
  943. X# Default pager for use if PAGER environment variable is not set.
  944. XDEFPAGER=more    # BSD systems
  945. X#DEFPAGER=pg    # AT&T systems
  946. X#DEFPAGER=cat    # systems with paging in the kernel
  947. X# Set this if you have look(1).
  948. XLOOK=1
  949. X# Set this to compress the map files.
  950. XCOMPRESS=yes
  951. X#COMPRESS=
  952. X
  953. X# BIN should be either /usr/local or /usr/local/bin
  954. XBIN=/usr/local
  955. XLIB=/usr/local/lib
  956. X
  957. X# Routing information produced by pathalias.
  958. XPATHS=$(LIB)/nmail.paths
  959. X
  960. X# If you do not have dbm(3), i.e., -ldbm, set UUWHERE to nothing.
  961. XUUWHERE=uuwhere
  962. X# UUWHERE=
  963. X# Munged by uuwhere for location information.
  964. XWHERE=$(LIB)/nmail.where
  965. X# TMP should be in the same directory as WHERE.
  966. XTMP=$(LIB)/nmail.tmp
  967. X# -ldbm DATABASE used by uuwhere.
  968. XDATABASE=$(LIB)/uuindex
  969. X
  970. X# Most of the news parameter files and mapsh are in this directory.
  971. XNEWS=$(LIB)/news
  972. X# The maps from mod.map are under this directory.
  973. XMAPS=/usr/spool/news/maps
  974. X#MAPS=$(NEWS)/maps    # another possibility
  975. X
  976. X# The filename of the manual entry.
  977. XUUHOSTSMAN=uuhosts.1
  978. XUUWHEREMAN=uuwhere.1
  979. XMAN=$(UUHOSTSMAN) $(UUWHEREMAN)
  980. XMANSOURCES=uuhosts.man uuwhere.man
  981. X# The manual directory for local entries.
  982. XMANDIR=/usr/man/manl
  983. X
  984. X# This is a very local UT hack which is meaningless on your system.
  985. XRUUHOSTS=uuhosts.CS.UTEXAS.EDU
  986. X
  987. X# The rest of the Makefile shouldn't need to be changed.
  988. X
  989. XUUCPMAPGROUP=mod.map
  990. X# This can't be the same as UUCPMAPGROUP
  991. XOLDUUCPMAPGROUP=mod.map.uucp
  992. X# USENET spool directory containing articles from newsgroup $(UUCPMAPGROUP).
  993. X# Must match $(UUCPMAPGROUP)!
  994. XUUCPSPOOL=/usr/spool/news/mod/map
  995. X# The place uuhosts stores the $(UUCPMAPGROUP) information for later retrieval.
  996. XUUCPMAP=$(MAPS)/$(UUCPMAPGROUP)
  997. X
  998. XSOURCES=uuhosts.sh mapsh.c uuwhere.c $(MANSOURCES) maps.ls
  999. XALL= uuhosts mapsh $(UUWHERE) $(MAN)
  1000. X
  1001. Xall: $(ALL)
  1002. X
  1003. Xuuhosts: Makefile uuhosts.sh
  1004. X    sed -e '/^DEFPAGER=/s%=.*%=$(DEFPAGER)%' \
  1005. X        -e '/^LOOK=/s%=.*%=$(LOOK)%' \
  1006. X        -e '/^COMPRESS=/s%=.*%=$(COMPRESS)%' \
  1007. X        -e '/^RUUHOSTS=/s%=.*%=$(RUUHOSTS)%' \
  1008. X        -e '/^UUCPMAPGROUP=/s%=.*%=$(UUCPMAPGROUP)%' \
  1009. X        -e '/^UUCPSPOOL=/s%=.*%=$(UUCPSPOOL)%' \
  1010. X        -e '/^BIN=/s%=.*%=$(BIN)%' \
  1011. X        -e '/^LIB=/s%=.*%=$(LIB)%' \
  1012. X        -e '/^PATHS=/s%=.*%=$(PATHS)%' \
  1013. X        -e '/^WHERE=/s%=.*%=$(WHERE)%'\
  1014. X        -e '/^NEWS=/s%=.*%=$(NEWS)%' \
  1015. X        -e '/^MAPS=/s%=.*%=$(MAPS)%'\
  1016. X        uuhosts.sh > uuhosts
  1017. X    chmod +x uuhosts
  1018. X
  1019. Xmapsh: Makefile mapsh.c
  1020. X    $(CC) -o mapsh -DMAPS=\"$(MAPS)\" mapsh.c
  1021. X
  1022. Xuuwhere: Makefile uuwhere.c
  1023. X    $(CC) -DUUCPINDEX=\"$(UUCPMAP)/Index\" \
  1024. X        -DPATHS=\"$(PATHS)\" \
  1025. X        -DWHERE=\"$(WHERE)\" \
  1026. X        -DTMP=\"$(TMP)\" \
  1027. X        -DDATABASE=\"$(DATABASE)\" \
  1028. X        uuwhere.c -ldbm -o uuwhere
  1029. X
  1030. Xwhere:    $(LIB)/uuwhere
  1031. X
  1032. X$(UUHOSTSMAN):    Makefile uuhosts.man
  1033. X    sed -e 's%UUCPMAPGROUP%$(UUCPMAPGROUP)%' \
  1034. X        -e 's%UUCPMAP%$(UUCPMAP)%' \
  1035. X        -e 's%DEFPAGER%$(DEFPAGER)%' \
  1036. X        -e 's%BIN%$(BIN)%' \
  1037. X        -e 's%LIB%$(LIB)%' \
  1038. X        -e 's%PATHS%$(PATHS)%' \
  1039. X        -e 's%WHERE%$(WHERE)%' \
  1040. X        -e 's%TMP%$(TMP)%' \
  1041. X        -e 's%DATABASE%$(DATABASE)%' \
  1042. X        -e 's%NEWS%$(NEWS)%' \
  1043. X        -e 's%MAPS%$(MAPS)%'\
  1044. X        uuhosts.man > $(UUHOSTSMAN)
  1045. X
  1046. X$(UUWHEREMAN):    Makefile uuwhere.man
  1047. X    sed -e 's%UUCPMAP%$(UUCPMAP)%' \
  1048. X        -e 's%BIN%$(BIN)%' \
  1049. X        -e 's%LIB%$(LIB)%' \
  1050. X        -e 's%PATHS%$(PATHS)%' \
  1051. X        -e 's%WHERE%$(WHERE)%' \
  1052. X        -e 's%TMP%$(TMP)%' \
  1053. X        -e 's%DATABASE%$(DATABASE)%' \
  1054. X        -e 's%NEWS%$(NEWS)%' \
  1055. X        -e 's%MAPS%$(MAPS)%'\
  1056. X        uuwhere.man > $(UUWHEREMAN)
  1057. X
  1058. Xinst_:
  1059. X
  1060. Xinst_uuwhere: $(UUWHERE)
  1061. X    -rm -f $(LIB)/uuwhere
  1062. X    cp uuwhere $(LIB)/uuwhere
  1063. X    chmod 555 $(LIB)/uuwhere
  1064. X    cp /dev/null $(WHERE)
  1065. X    -chmod 666 $(WHERE)
  1066. X    -rm -f $(MANDIR)/$(UUWHEREMAN)
  1067. X    -cp $(UUWHEREMAN) $(MANDIR)
  1068. X    -chmod 444 $(MANDIR)/$(UUWHEREMAN)
  1069. X
  1070. Xinstall: $(ALL) inst_$(UUWHERE) inst_most $(UUCPMAP)/path.local recover
  1071. X
  1072. Xinst_most:
  1073. X    -rm -f $(BIN)/uuhosts
  1074. X    cp uuhosts $(BIN)/uuhosts
  1075. X    chmod 555 $(BIN)/uuhosts
  1076. X    -rm -f $(MANDIR)/$(UUHOSTSMAN)
  1077. X    -cp $(UUHOSTSMAN) $(MANDIR)
  1078. X    -chmod 444 $(MANDIR)/$(UUHOSTSMAN)
  1079. X    @echo "Rest of installation has to be done as root."
  1080. X    cp mapsh $(NEWS)/mapsh
  1081. X    -strip $(NEWS)/mapsh
  1082. X    chown root $(NEWS)/mapsh
  1083. X    chgrp news $(NEWS)/mapsh
  1084. X    chmod 4750 $(NEWS)/mapsh
  1085. X    ls -lg $(NEWS)/mapsh
  1086. X    -mkdir $(MAPS)
  1087. X    -mkdir $(MAPS)/bin $(MAPS)/tmp $(UUCPMAP)
  1088. X    chgrp news $(MAPS) $(MAPS)/*
  1089. X    chmod 555 $(MAPS)
  1090. X    chmod 775 $(UUCPMAP)
  1091. X    chmod 777 $(MAPS)/tmp
  1092. X    chmod 555 $(MAPS)/bin
  1093. X    cp /bin/cat $(MAPS)/bin
  1094. X    cp /bin/echo $(MAPS)/bin
  1095. X    cp /bin/sed $(MAPS)/bin
  1096. X    cp /bin/sh $(MAPS)/bin
  1097. X    -strip $(MAPS)/bin/*
  1098. X    chgrp news $(MAPS)/bin/*
  1099. X    chmod 555 $(MAPS)/bin/*
  1100. X    @echo ''
  1101. X    @echo 'This is what the things just installed *should* look like:'
  1102. X    @cat maps.ls
  1103. X    @echo ''
  1104. X    @echo 'And here is what they actually *do* look like:'
  1105. X    ls -lga $(MAPS)
  1106. X    ls -lga $(MAPS)/bin
  1107. X    @echo ''
  1108. X
  1109. Xmaps.ls: Makefile uuhosts
  1110. X    rsh im4u echo $(MAPS): ';' ls -lga $(MAPS) ';' \
  1111. X        echo $(MAPS)/bin: ';' ls -lga $(MAPS)/bin \
  1112. X        < /dev/null > maps.ls
  1113. X
  1114. X$(UUCPMAP)/path.local:
  1115. X    -cd $(UUCPMAP); umask 002; \
  1116. X        cp /dev/null path.local; chgrp news path.local; \
  1117. X        cp Local path.local
  1118. X    @echo 'See "uuhosts -r README" about path.local.'
  1119. X
  1120. Xrecover:
  1121. X    @echo "Attempt to recover map data from a previous newsgroup ("$(OLDUUCPMAPGROUP)")."
  1122. X    @echo "If it fails, you probably don't have any old map data."
  1123. X    mkdir /tmp/$(OLDUUCPMAPGROUP)
  1124. X    -cd /tmp/$(OLDUUCPMAPGROUP); cd $(MAPS)/$(OLDUUCPMAPGROUP); \
  1125. X        mv * ../$(UUCPMAPGROUP); cd ..;  rmdir $(OLDUUCPMAPGROUP)
  1126. X    rmdir /tmp/$(OLDUUCPMAPGROUP)
  1127. X
  1128. Xclean:
  1129. X    rm -f $(ALL)
  1130. X    rm -f *.pag *.dir
  1131. X    rm -f *.o
  1132. X    rm -f *.shar
  1133. X
  1134. Xshar: uuhosts.shar
  1135. X
  1136. Xuuhosts.shar: README $(SOURCES) Makefile
  1137. X    shar README* $(SOURCES) Makefile > uuhosts.shar
  1138. !RoNnIe!RaYgUn!
  1139. exit
  1140.  
  1141.