home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume26 / archie / part04 < prev    next >
Encoding:
Text File  |  1991-11-23  |  54.2 KB  |  1,862 lines

  1. Newsgroups: comp.sources.misc
  2. From: brendan@cs.widener.edu (Brendan Kehoe)
  3. Subject:  v26i049:  archie - A Prospero client for Archie, v1.2, Part04/05
  4. Message-ID: <1991Nov24.045445.4873@sparky.imd.sterling.com>
  5. X-Md4-Signature: 77ec069d95ef7e14b644842dd2751dcb
  6. Date: Sun, 24 Nov 1991 04:54:45 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: brendan@cs.widener.edu (Brendan Kehoe)
  10. Posting-number: Volume 26, Issue 49
  11. Archive-name: archie/part04
  12. Environment: UNIX, VMS
  13. Supersedes: archie: Volume 22, Issue 35-39
  14.  
  15. #! /bin/sh
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  19. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  20. # Contents:  ./INSTALL ./Makefile ./README ./archie.c ./archie.doc
  21. #   ./archie.man ./get_pauth.c ./perrno.h ./procquery.c ./stcopy.c
  22. #   ./udp.c ./vlalloc.c ./vms/fd.h
  23. # Wrapped by kent@sparky on Wed Nov 20 18:23:44 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 4 (of 5)."'
  27. if test -f './INSTALL' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'./INSTALL'\"
  29. else
  30.   echo shar: Extracting \"'./INSTALL'\" \(2345 characters\)
  31.   sed "s/^X//" >'./INSTALL' <<'END_OF_FILE'
  32. X[Last changed: 11/20/91 v1.2]
  33. X
  34. X This is the minimal set of things you need to build an Archie client
  35. Xthat takes advantage of the Prospero system.  It is derived from the
  36. X4.2beta version of Prospero, currently available as the file prospero.tar.Z
  37. Xon the host cs.washington.edu.
  38. X
  39. X * To make the client under Unix:
  40. X
  41. X    - edit the Makefile, changing CC, OPTIONS, LDFLAGS, and RM if
  42. X      necessary (odds are you won't have to do this..see below)
  43. X    - edit the DEFINEs as necessary
  44. X    - if you're in Finland, Australia, the UK, or Canada, please edit
  45. X      archie.h and change ARCHIE_HOST appropriately (the US is set).
  46. X    - type `make'
  47. X
  48. X I've tried to make this as portable as possible.  I'd encourage you
  49. Xto try doing a "make" without any changes to the Makefile, and see how
  50. Xit goes.  If it pukes, and you have to define something, please drop
  51. Xme a line---my goal is for anybody to just type "make" and not have to
  52. Xworry about things like what functions their system supports.
  53. X
  54. X * To make the client under VMS, you should edit MAKE.COM and select
  55. Xthe appropriate define for your version of TCP/IP (currently either
  56. XMultinet or Wallongong).  It will sense if you're using Gnu C or not.
  57. XIt's currently only been ported to VMS 5.4-2 -- I can't guarantee
  58. Xit'll work with older versions.
  59. X
  60. X * To make the client under MSDOS or OS/2, presently the only PC
  61. XTCP/IP package archie has been modified for is FTP Software's PC/TCP
  62. Xfor MSDOS (version 2.1 or higher) and OS/2 (version 1.1 and higher).
  63. X
  64. X It's been successfully built on:
  65. X
  66. X  Machine            OS
  67. X
  68. X* Apollo            Domain/OS 10.3
  69. X* Apple Mac IIsomething        A/UX v2.01
  70. X* CDC Mips systems, all sorts    EP/IX 1.2.3 and 1.3.1
  71. X* Convex c210 & others        ConvexOS 9.0
  72. X* DecStations -- all sorts    Ultrix 4.1 and 4.2
  73. X* Encore Multimax 520 (XPC)    Encore UMAX 4.3
  74. X* Encore Multimax 520        Encore Mach 1.1alpha
  75. X* Harris HCX-9 (tahoe)        CX/UX 5.1
  76. X* HP 9000/s300            MORE/bsd-4.3
  77. X* HP 9000/s834            HP/UX 7.0
  78. X* IBM PC            MSDOS and OS/2
  79. X* IBM RS/6000            AIX
  80. X* IBM RT            4.3BSD, and AIX
  81. X* NeXT                NeXT OS 2.1
  82. X* Sequent Symmetry        Dynix 3.1.1
  83. X* SGI 4D/220GTX            SGI Irix 3.3.2
  84. X* Solbourne Series 5/600    OS/MP 4.0Da
  85. X* Stardent 3030            SysV Rel 3.0.1
  86. X* Suns -- all sorts        SunOS 4.0.3, 4.1, and 4.1.1
  87. X* Vax 8600            MORE/bsd-4.3
  88. X* Vax 6000/310            VMS 5.4/Wallongong 5.1
  89. X* MicroVax 3400            VMS 5.4-2/Multinet 2.2 and Multinet 3.0
  90. X
  91. X-- Brendan Kehoe (brendan@cs.widener.edu)
  92. END_OF_FILE
  93.   if test 2345 -ne `wc -c <'./INSTALL'`; then
  94.     echo shar: \"'./INSTALL'\" unpacked with wrong size!
  95.   fi
  96.   # end of './INSTALL'
  97. fi
  98. if test -f './Makefile' -a "${1}" != "-c" ; then 
  99.   echo shar: Will not clobber existing file \"'./Makefile'\"
  100. else
  101.   echo shar: Extracting \"'./Makefile'\" \(3798 characters\)
  102.   sed "s/^X//" >'./Makefile' <<'END_OF_FILE'
  103. X#
  104. X# Last changed: 11/20/91, v1.2
  105. X#
  106. X# Makefile for the minimal build for an archie Prospero client.
  107. X
  108. X# Your C compiler:
  109. XCC=cc
  110. X
  111. X# For most systems, these OPTIONS will suffice.  Exceptions:
  112. X#
  113. X#    * If you're on a Stardent, add -43
  114. X#    * If you're running EP/IX, you may need to add -systype bsd43 ..try
  115. X#      it without it first, though.
  116. X
  117. XOPTIONS= -O -I. # -43    -systype bsd43
  118. X
  119. X# For this, DEFINES is usually ok as-is.  Try it without any of these
  120. X# first; if some stuff fails or shows up undefined, then come back and
  121. X# add 'em.
  122. X#
  123. X#     * if you're on an Apple running A/UX, add              -DAUX
  124. X#     * if you're using a BULL system (Bull DPX/2), add       -DBULL
  125. X#     * if you want to include the debugging code (so you
  126. X#       can help with problem-solving if any crop up), add    -DDEBUG
  127. X#     * if you're running System V, add                  -DSYSV
  128. X#     * if you're running a USG (System V.2) system, add      -DUSG
  129. X#     * if you're running UTS, add                  -DUTS
  130. X#     * if your system doesn't have the functions index(),
  131. X#       rindex(), bcopy(), or bzero(), add                    -DFUNCS
  132. X#     * if your system doesn't have the re_comp/regcmp or re_exec/regex
  133. X#       routines (no regex(3)/regcmp(3X) library), then add   -DNOREGEX
  134. X#     * if your system is lacking strspn(), add               -DSTRSPN
  135. XDEFINES= -DDEBUG
  136. X
  137. X#    Usually LDFLAGS is empty; if, after you build this, archie
  138. X#     complains that it can't resolve ARCHIE.SURA.NET, you need
  139. X#     to add `-lresolv'.
  140. X#    * If you need the PW library (e.g. A/UX), add -lPW
  141. XLDFLAGS= # -lresolv        -lPW
  142. X
  143. X# Change this if necessary.
  144. XRM=/bin/rm
  145. X
  146. X# =========================
  147. X# Yer' done....make archie.
  148. X# =========================
  149. X#
  150. XCFLAGS=$(OPTIONS) $(DEFINES)
  151. X#
  152. XOBJS=    aquery.o archie.o atalloc.o dirsend.o get_pauth.o get_vdir.o \
  153. X    perrmesg.o procquery.o ptalloc.o regex.o stcopy.o support.o \
  154. X    vlalloc.o vl_comp.o
  155. X#
  156. Xall: archie
  157. X
  158. Xarchie: $(OBJS)
  159. X    $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
  160. X
  161. X$(OBJS): archie.h pmachine.h pcompat.h Makefile
  162. X
  163. Xprocquery.o: copyright.h
  164. X
  165. Xclean:
  166. X    $(RM) -f *.o archie
  167. X
  168. Xgclean: clean
  169. X    $(RM) -f *~ archie.0* archie.com archie.tar* gmon.out archie.doc
  170. X
  171. Xunx-deadly:
  172. X    unifdef -UXARCHIE xprocquery.c > procquery.c
  173. X
  174. Xudp: udp.o
  175. X    $(CC) -o $@ udp.o
  176. X
  177. Xudptest: udp
  178. X    @echo "This should print the date, if UDP's enabled, or hang if not:"
  179. X    @./udp
  180. X
  181. XFILES=    INSTALL Makefile Prospero README archie.c archie.h archie.lnk \
  182. X    archie.doc archie.man aquery.c atalloc.c dirsend.c get_pauth.c \
  183. X    get_vdir.c make.com makefile.dos makefile.os2 perrmesg.c \
  184. X    patchlevel.h pauthent.h pcompat.h perrno.h pfs.h pmachine.h pprot.h \
  185. X    procquery.c ptalloc.c rdgram.h regex.c regex.h stcopy.c support.c \
  186. X    copyright.h udp.c vl_comp.c vlalloc.c vms.h vms_support.c vms/fd.h \
  187. X    vms/in.h vms/pseudos.h vms/signal.h vms/socket.h vms/time.h \
  188. X    vms/types.h vms/network.h vms/multi.opt vms/wall.opt
  189. X
  190. XBFILES= $(FILES) xprocquery.c
  191. X
  192. Xdist: tar shar dcl
  193. X
  194. Xshar: archie.doc
  195. X    makekit -narchie. $(FILES) vms > Manifest
  196. X
  197. Xarchie.doc: archie.man
  198. X    nroff -man archie.man | tr '\010' _ | sed -e s/__//g > archie.doc
  199. X
  200. Xdcl: archie.doc
  201. X    echo '$$ write sys$$output "Unpacking..."' > archie.com
  202. X    echo '$$ if f$$search("archie.dir") .eqs. "" then create/dir [.ARCHIE]' >> archie.com
  203. X    echo '$$ if f$$search("[.ARCHIE]vms.dir") .eqs. "" then create/dir [.ARCHIE.VMS]' >> archie.com
  204. X    echo '$$ set noverify' >> archie.com
  205. X    (cd .. ; dclshar `echo $(FILES) | tr ' ' '\012' |\
  206. X     sed -e "s/^/archie\//g"` >> archie/archie.com )
  207. X    echo '$$ write sys$$output "Ok, now enter the ARCHIE directory and type @MAKE ."' >> archie.com
  208. X
  209. Xtar: archie.doc
  210. X    ( cd .. ; tar cvf archie/archie.tar `echo $(FILES) |\
  211. X     tr ' ' '\012' | sed -e "s/^/archie\//g"` )
  212. X    compress -f archie.tar
  213. X
  214. Xatest: archie.doc
  215. X    ( cd .. ; tar cvf archie/atest.tar `echo $(BFILES) |\
  216. X     tr ' ' '\012' | sed -e "s/^/archie\//g"` )
  217. X    compress -f atest.tar
  218. END_OF_FILE
  219.   if test 3798 -ne `wc -c <'./Makefile'`; then
  220.     echo shar: \"'./Makefile'\" unpacked with wrong size!
  221.   fi
  222.   # end of './Makefile'
  223. fi
  224. if test -f './README' -a "${1}" != "-c" ; then 
  225.   echo shar: Will not clobber existing file \"'./README'\"
  226. else
  227.   echo shar: Extracting \"'./README'\" \(2329 characters\)
  228.   sed "s/^X//" >'./README' <<'END_OF_FILE'
  229. X[Last changed 11/20/91 v1.2]
  230. X
  231. X Enclosed you'll find a Prospero client for the archie service.  It'll
  232. Xlet you query the archie databases without actually using an
  233. Xinteractive process on the remote server's machine (e.g. archie.sura.net),
  234. Xresulting in a MUCH better response time.  It also helps lessen the
  235. Xload on the archie server itself.
  236. X
  237. X This is a third child of Clifford Neuman's Prospero project.  It's really
  238. Xthe Archie client that's included in the prospero stuff, but I've taken out
  239. Xeverything that's unnecessary for this client to work.  (Aka, you don't
  240. Xhave to build all of Prospero to get the Archie client.)  Khun Yee Fung
  241. Xwrote an archie client in Perl, and George Ferguson has written a client
  242. Xfor use with XWindows, based in part upon this code.  A curses version is
  243. Xcurrently being developed to mimic the X client's look and feel.
  244. X
  245. X Using the Archie Prospero interface in its true form will probably be of
  246. Xinterest---check out the file `Prospero' for an example of its interface.
  247. XIf you find it intriguing, you should probably get the full prospero kit
  248. Xfrom the University of Washington on cs.washington.edu in pub/prospero.tar.Z.
  249. X
  250. X Suffice to say, there are now a number of ways to query Archie without
  251. Xbogging a server down with your logins.
  252. X
  253. X Check out the man page (or archie.doc, if you're using VMS or DOS)
  254. Xfor instructions on how to use this archie client.
  255. X
  256. X Please check to make sure you don't have "archie" aliased or modified
  257. Xin some way to do a telnet or rlogin (which you may've done before
  258. Xthis command-line ability came into being).
  259. X
  260. X If Archie consistently hangs (at different times of day with
  261. Xdifferent queries), it's possible that your site has UDP traffic on
  262. Xports > 1000 blocked, for security reasons.  Type `make udptest' to
  263. Xcheck---if it prints out the date, the Archie server is probably down;
  264. Xif it doesn't print out the date, either Widener's computer is down
  265. X(God forbid ;-) ) or you do indeed have UDP blocked.  See your system
  266. Xadministrator in this case.  If the problem persists and haven't the
  267. Xvaguest, then write me describing the situation and what machine/OS
  268. Xyou're using.
  269. X
  270. X Write to archie-l@cs.mcgill.ca with questions about Archie itself.
  271. X Write to info-prospero@isi.edu about the Prospero protocol.
  272. X Write to brendan@cs.widener.edu with questions about this specific package.
  273. END_OF_FILE
  274.   if test 2329 -ne `wc -c <'./README'`; then
  275.     echo shar: \"'./README'\" unpacked with wrong size!
  276.   fi
  277.   # end of './README'
  278. fi
  279. if test -f './archie.c' -a "${1}" != "-c" ; then 
  280.   echo shar: Will not clobber existing file \"'./archie.c'\"
  281. else
  282.   echo shar: Extracting \"'./archie.c'\" \(5837 characters\)
  283.   sed "s/^X//" >'./archie.c' <<'END_OF_FILE'
  284. X/*
  285. X * Copyright (c) 1991 by the University of Washington
  286. X *
  287. X * For copying and distribution information, please see the file
  288. X * <copyright.h>.
  289. X *
  290. X * v1.2.0 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  291. X * v1.1.2 - 08/27/91 (bpk) - added <pmachine.h> for index()
  292. X * v1.1.1 - 08/22/91 (bpk) - added 0-9 as arguments
  293. X */
  294. X
  295. X#include <copyright.h>
  296. X
  297. X/*
  298. X * Archie client using the Prospero protocol.
  299. X *
  300. X * Suggestions and improvements to Brendan Kehoe (brendan@cs.widener.edu).
  301. X */
  302. X
  303. X#include <stdio.h>
  304. X#if defined(OS2)
  305. X# include <pctcp.h>
  306. X#endif
  307. X#if defined(MSDOS)
  308. X# include <string.h>
  309. X# include <stdlib.h>
  310. X#endif
  311. X
  312. X#include <pfs.h>
  313. X#include <rdgram.h>
  314. X#include <archie.h>
  315. X#include <pmachine.h>
  316. X
  317. Xint        listflag = 0;
  318. Xint        sortflag = 0;   /* 1 = by date                    */
  319. Xchar        *progname;
  320. X#ifdef DEBUG
  321. Xint        pfs_debug = 0;
  322. X#endif
  323. Xextern int    rdgram_priority;
  324. X
  325. Xmain(argc,argv)
  326. X    int        argc;
  327. X    char    *argv[];
  328. X    {
  329. X    char        *cur_arg;
  330. X    char        qtype = '=';    /* Default to exact string match  */
  331. X    char        etype = '=';    /* Type if only -e is specified   */
  332. X    int        eflag = 0;    /* Exact flag specified          */
  333. X    int        max_hits = MAX_HITS;
  334. X    int        offset = 0;
  335. X    int        exitflag = 0;    /* Display release identifier     */
  336. X    int        tmp;
  337. X    char        *host = ARCHIE_HOST;
  338. X    static char *archies[] = { ARCHIES };
  339. X
  340. X    progname = *argv;
  341. X    argc--; argv++;
  342. X
  343. X    while (argc > 0 && **argv == '-') {
  344. X        cur_arg = argv[0]+1;
  345. X
  346. X        /* If a - by itself, or --, then no more arguments */
  347. X        if(!*cur_arg || ((*cur_arg == '-') && (!*(cur_arg+1)))) {
  348. X            argc--, argv++;
  349. X        goto scandone;
  350. X        }
  351. X
  352. X        while (*cur_arg) {
  353. X        switch (*cur_arg++) {
  354. X#ifdef DEBUG        
  355. X        case 'D':  /* Debug level */
  356. X            pfs_debug = 1; /* Default debug level */
  357. X            if(*cur_arg && index("0123456789",*cur_arg)) {
  358. X            sscanf(cur_arg,"%d",&pfs_debug);
  359. X            cur_arg += strspn(cur_arg,"0123456789");
  360. X            }
  361. X            else if(argc > 2) {
  362. X                tmp = sscanf(argv[1],"%d",&pfs_debug);
  363. X            if (tmp == 1) {argc--;argv++;}
  364. X            }
  365. X            break;
  366. X#endif
  367. X#ifndef XARCHIE
  368. X        case 'L':
  369. X            printf("Known archie servers:\n");
  370. X            for (tmp = 0; tmp < NARCHIES; tmp++)
  371. X            printf("\t%s\n", archies[tmp]);
  372. X            printf("For the most up-to-date list, log into an Archie server & type `servers'.\n");
  373. X            exitflag = 1;
  374. X            break;
  375. X#endif
  376. X
  377. X        case 'N':  /* Priority (nice) */
  378. X            rdgram_priority = RDGRAM_MAX_PRI; /* Use this if no # */
  379. X            if(*cur_arg && index("-0123456789",*cur_arg)) {
  380. X            sscanf(cur_arg,"%d",&rdgram_priority);
  381. X            cur_arg += strspn(cur_arg,"-0123456789");
  382. X            }
  383. X            else if(argc > 2) {
  384. X                tmp = sscanf(argv[1],"%d",&rdgram_priority);
  385. X            if (tmp == 1) {argc--;argv++;}
  386. X            }
  387. X            if(rdgram_priority > RDGRAM_MAX_SPRI) 
  388. X            rdgram_priority = RDGRAM_MAX_PRI;
  389. X            if(rdgram_priority < RDGRAM_MIN_PRI) 
  390. X            rdgram_priority = RDGRAM_MIN_PRI;
  391. X              break;
  392. X
  393. X        case 'c':  /* substring (case sensitive) */
  394. X            qtype = 'C';
  395. X            etype = 'c';
  396. X            break;
  397. X
  398. X        case 'e':  /* Exact match */
  399. X            /* If -e specified by itself, then we use the  */
  400. X            /* default value of etype which must be '='    */
  401. X            eflag++;
  402. X            break;
  403. X
  404. X        case 'h':  /* Host */
  405. X            host = argv[1];
  406. X            argc--; argv++;
  407. X            break;
  408. X
  409. X        case 'l':  /* List one match per line */
  410. X            listflag++;
  411. X            break;
  412. X
  413. X        case '0': case '1': case '2': case '3': case '4':
  414. X        case '5': case '6': case '7': case '8': case '9':
  415. X            cur_arg--;
  416. X        case 'm':  /* Max hits */
  417. X            max_hits = -1;  
  418. X            if(*cur_arg && index("0123456789",*cur_arg)) {
  419. X            sscanf(cur_arg,"%d",&max_hits);
  420. X            cur_arg += strspn(cur_arg,"0123456789");
  421. X            }
  422. X            else if(argc > 1) {
  423. X                tmp = sscanf(argv[1],"%d",&max_hits);
  424. X            if (tmp == 1) {argc--;argv++;}
  425. X            }
  426. X            if (max_hits < 1) {
  427. X            fprintf(stderr, "%s: -m option requires a value for max hits (>= 1)\n",
  428. X                progname);
  429. X#ifdef VMS
  430. X            exit(SS$_NORMAL); /* we already did the error above */
  431. X#else
  432. X            exit(1);
  433. X#endif
  434. X            }
  435. X            break;
  436. X
  437. X        case 'o':  /* Offset */
  438. X            if(argc > 1) {
  439. X              tmp = sscanf(argv[1],"%d",&offset);
  440. X              if (tmp != 1)
  441. X            argc = -1;
  442. X              else {
  443. X            argc--; argv++;
  444. X              }
  445. X            }
  446. X            break;
  447. X
  448. X        case 'r':  /* Regular expression search */
  449. X            qtype = 'R';
  450. X            etype = 'r';
  451. X            break;
  452. X
  453. X        case 's':  /* substring (case insensitive) */
  454. X            qtype = 'S';
  455. X            etype = 's';
  456. X            break;
  457. X
  458. X        case 't':  /* Sort inverted by date */
  459. X            sortflag = 1;
  460. X            break;
  461. X
  462. X        case 'v':  /* Display version */
  463. X            fprintf(stderr,
  464. X            "Client version %s based upon Prospero version %s\n",
  465. X                CLIENT_VERSION, PFS_RELEASE);
  466. X            exitflag++;
  467. X            break;
  468. X
  469. X        default:
  470. X            fprintf(stderr,"Usage: %s [-[cers][l][t][m #][h host][L][N#]] string\n", progname);
  471. X#ifdef VMS
  472. X            exit(SS$_NORMAL); /* we already did the error above */
  473. X#else
  474. X            exit(1);
  475. X#endif
  476. X        }
  477. X        }
  478. X        argc--; argv++;
  479. X    }
  480. X
  481. X      scandone:
  482. X
  483. X    if (eflag) qtype = etype;
  484. X
  485. X    if ((argc != 1) && exitflag) exit(0);
  486. X
  487. X    if (argc != 1) {
  488. X        fprintf(stderr, "Usage: %s [-[cers][l][t][m #][h host][L][N#]] string\n", progname);
  489. X        fprintf(stderr,"       -c : case sensitive substring search\n");
  490. X        fprintf(stderr,"       -e : exact string match (default)\n");
  491. X        fprintf(stderr,"       -r : regular expression search\n");
  492. X        fprintf(stderr,"       -s : case insensitive substring search\n");
  493. X        fprintf(stderr,"       -l : list one match per line\n");
  494. X        fprintf(stderr,"       -t : sort inverted by date\n");
  495. X        fprintf(stderr,"     -m # : specifies maximum number of hits to return (default %d)\n", max_hits);
  496. X        fprintf(stderr,"  -h host : specifies server host\n");
  497. X        fprintf(stderr,"       -L : list known servers\n");
  498. X        fprintf(stderr,"      -N# : specifies query niceness level (0-35765)\n");
  499. X#ifdef VMS
  500. X        exit(SS$_NORMAL); /* we already did the error above */
  501. X#else
  502. X        exit(1);
  503. X#endif
  504. X    }
  505. X
  506. X    procquery(host, argv[0], max_hits, offset, qtype, sortflag, listflag);
  507. X
  508. X    exit(0);
  509. X    }
  510. END_OF_FILE
  511.   if test 5837 -ne `wc -c <'./archie.c'`; then
  512.     echo shar: \"'./archie.c'\" unpacked with wrong size!
  513.   fi
  514.   # end of './archie.c'
  515. fi
  516. if test -f './archie.doc' -a "${1}" != "-c" ; then 
  517.   echo shar: Will not clobber existing file \"'./archie.doc'\"
  518. else
  519.   echo shar: Extracting \"'./archie.doc'\" \(7215 characters\)
  520.   sed "s/^X//" >'./archie.doc' <<'END_OF_FILE'
  521. X
  522. X
  523. X
  524. XARCHIE(1)                USER COMMANDS                  ARCHIE(1)
  525. X
  526. X
  527. X
  528. XNAME
  529. X     archie - query the  Archie  anonymous  FTP  databases  using
  530. X     Prospero
  531. X
  532. XSYNOPSIS
  533. X     archie [ -cers ] [ -l ] [ -t ] [ -m# ] [ -N# ] [ -h host ] [ -L ] string
  534. X
  535. XDESCRIPTION
  536. X     archie queries an archie anonymous FTP database looking  for
  537. X     the  specified  string  using  the  Prospero protocol.  This
  538. X     client is based on Prospero version Beta.4.2 and is provided
  539. X     to  encourage non-interactive use of the Archie servers (and
  540. X     subsequently better performance on both sides).
  541. X
  542. X     The general method of use is of the form
  543. X
  544. X          % archie string
  545. X
  546. X     This will go to the archie server and ask it to look for all
  547. X     known  systems  that have a file named `string' in their FTP
  548. X     area.  archie will wait, and print out any matches.
  549. X
  550. X     For example,
  551. X
  552. X          % archie emacs
  553. X
  554. X     will find all anonymous FTP sites  in  the  archie  database
  555. X     that  have  files  named  emacs somewhere in their FTP area.
  556. X     (This particular query would probably return a lot of direc-
  557. X     tories.)  If you want a list of every filename that contains
  558. X     emacs anywhere in it, you'd use
  559. X
  560. X          % archie -c emacs
  561. X
  562. X     Regular expressions, such as
  563. X
  564. X          % archie -r '[xX][lL]isp'
  565. X
  566. X     may also be used for searches.  (See the manual of a reason-
  567. X     ably good editor, like GNU Emacs or vi, for more information
  568. X     on using regular expressions.)
  569. X
  570. X
  571. XOPTIONS
  572. X     The options currently available to this archie client are:
  573. X
  574. X     -c          Search substrings paying attention  to  upper  &
  575. X                 lower case.
  576. X     -e          Exact string match.  (This is the default.)
  577. X     -r          Search using a regular expression.
  578. X     -s          Search  substrings  ignoring  the  case  of  the
  579. X                 letters.
  580. X
  581. X
  582. X
  583. XArchie (Prospero) Last change: 20 November 1991                 1
  584. X
  585. X
  586. X
  587. X
  588. X
  589. X
  590. XARCHIE(1)                USER COMMANDS                  ARCHIE(1)
  591. X
  592. X
  593. X
  594. X     -l          Output results in a form suitable for parsing by
  595. X                 programs.
  596. X     -t          Sort the results inverted by date.
  597. X     -m#         Specifies the maximum number of  hits  (matches)
  598. X                 to return (default of 95).
  599. X     -N#         Sets the niceness of a query; by  default,  it's
  600. X                 set  to  0.  Without an argument, -N defaults to
  601. X                 35765.  If you use -N with an argument between 0
  602. X                 and  35765,  it'll  adjust  itself  accordingly.
  603. X                 (Note: VMS users will have to put quotes  around
  604. X                 this  argument,  and -L, like ``-N45''; VMS will
  605. X                 otherwise convert it to lowercase.)
  606. X     -h host     Tells the client  to  query  the  Archie  server
  607. X                 named host.
  608. X     -L          Lists the Archie servers known  to  the  program
  609. X                 when it was compiled.
  610. X
  611. X  Quick Hits
  612. X     You'll often find yourself making fast and  furious  queries
  613. X     for  multiple  things  that all look similar (e.g. `telnet',
  614. X     `net', etc).  If you get into the  habit  of  using  the  -c
  615. X     option  when  performing  these  kinds  of searches, they'll
  616. X     often prove more  fruitful  than  if  you  relied  upon  the
  617. X     default of -e.
  618. X
  619. X  Notes
  620. X     The three search-modifying arguments (-c, -r,  and  -s)  are
  621. X     all  mutually  exclusive;  only the last one counts.  If you
  622. X     specify -e with any of -c, -r, or -s, the server will  first
  623. X     check  for  an  exact  match,  then  fall  back to the case-
  624. X     sensitive, case-insensitive, or regular  expression  search.
  625. X     This  is so if there are matches that are particularly obvi-
  626. X     ous, it will take a minimal amount of time to  satisfy  your
  627. X     request.
  628. X
  629. X     If you list a single `-' by itself,  any  further  arguments
  630. X     will  be  taken  as  part  of  the  search  string.  This is
  631. X     intended to enable searching for strings that begin  with  a
  632. X     `-'; for example:
  633. X
  634. X          % archie -s - -old
  635. X
  636. X     will search for all filenames that contain the string `-old'
  637. X     in them.
  638. X
  639. XRESPONSE
  640. X     Archie servers are set up to respond to a number of requests
  641. X     in  a  queued fashion.  That is, smaller requests get served
  642. X     much more quickly than do large requests.  As a result,  the
  643. X     more  often  you query the Archie server, or the larger your
  644. X     requests, the longer the queue will become, resulting  in  a
  645. X     longer  waiting  period  for everyone's requests.  Please be
  646. X
  647. X
  648. X
  649. XArchie (Prospero) Last change: 20 November 1991                 2
  650. X
  651. X
  652. X
  653. X
  654. X
  655. X
  656. XARCHIE(1)                USER COMMANDS                  ARCHIE(1)
  657. X
  658. X
  659. X
  660. X     frugal when possible, for your benefit as well  as  for  the
  661. X     other users.
  662. X
  663. XQUERY PRIORITY
  664. X     Please use the -N option whenever you don't  demand  immedi-
  665. X     acy,  or  when  you're requesting things that could generate
  666. X     large responses.  Even  when  using  the  nice  option,  you
  667. X     should  still  try  to  avoid  big jobs during busy periods.
  668. X     Here is a list of what we consider to be  nice  values  that
  669. X     accurately reflect the priority of a job to the server.
  670. X
  671. X          Normal              0
  672. X          Nice                500
  673. X          Nicer               1000
  674. X          Very Nice           5000
  675. X          Extremely Nice      10000
  676. X          Nicest              32765
  677. X
  678. X     The last priority, Nicest, would be used when a  job  should
  679. X     wait  until  the  queue is essentially empty before running.
  680. X     You should pick one of these values to use, possibly modify-
  681. X     ing  it  slightly depending on where you think your priority
  682. X     should land.  For example, 32760 would mean wait  until  the
  683. X     queue  is  empty,  but  jump  ahead  of other jobs that have
  684. X     selected Nicest.
  685. X
  686. X     There are certain types of  things  that  we  suggest  using
  687. X     Nicest  for,  irregardless.  In particular, any searches for
  688. X     which you would have a hard time justifying the use of  any-
  689. X     thing but extra resources.  (We all know what those searches
  690. X     would be for.)
  691. X
  692. XSEE ALSO
  693. X     For more information on regular expressions, see the  manual
  694. X     pages on:
  695. X
  696. X     regex(3), ed(1)
  697. X
  698. X     Also read the file archie/whatis on archie.mcgill.ca  for  a
  699. X     detailed paper on Archie as a whole.
  700. X
  701. XAUTHORS
  702. X     The archie service was conceived  and  implemented  by  Alan
  703. X     Emtage       (bajan@cs.mcgill.ca),       Peter       Deutsch
  704. X     (peterd@cs.mcgill.ca),        and        Bill         Heelan
  705. X     (wheelan@cs.mcgill.ca).   The  entire  Internet  is in their
  706. X     debt.
  707. X
  708. X     The  Prospero  system  was  created   by   Clifford   Neuman
  709. X     (bcn@isi.edu);   write  to  info-prospero@isi.edu  for  more
  710. X     information on the protocol and its use.
  711. X
  712. X
  713. X
  714. X
  715. XArchie (Prospero) Last change: 20 November 1991                 3
  716. X
  717. X
  718. X
  719. X
  720. X
  721. X
  722. XARCHIE(1)                USER COMMANDS                  ARCHIE(1)
  723. X
  724. X
  725. X
  726. X     This stripped client  was  put  together  by  Brendan  Kehoe
  727. X     (brendan@cs.widener.edu),  with  modifications  by  Clifford
  728. X     Neuman and George Ferguson (ferguson@cs.rochester.edu).
  729. X
  730. XBUGS
  731. X     There are none; only a few unexpected features.
  732. X
  733. X
  734. X
  735. X
  736. X
  737. X
  738. X
  739. X
  740. X
  741. X
  742. X
  743. X
  744. X
  745. X
  746. X
  747. X
  748. X
  749. X
  750. X
  751. X
  752. X
  753. X
  754. X
  755. X
  756. X
  757. X
  758. X
  759. X
  760. X
  761. X
  762. X
  763. X
  764. X
  765. X
  766. X
  767. X
  768. X
  769. X
  770. X
  771. X
  772. X
  773. X
  774. X
  775. X
  776. X
  777. X
  778. X
  779. X
  780. X
  781. XArchie (Prospero) Last change: 20 November 1991                 4
  782. X
  783. X
  784. X
  785. END_OF_FILE
  786.   if test 7215 -ne `wc -c <'./archie.doc'`; then
  787.     echo shar: \"'./archie.doc'\" unpacked with wrong size!
  788.   fi
  789.   # end of './archie.doc'
  790. fi
  791. if test -f './archie.man' -a "${1}" != "-c" ; then 
  792.   echo shar: Will not clobber existing file \"'./archie.man'\"
  793. else
  794.   echo shar: Extracting \"'./archie.man'\" \(6161 characters\)
  795.   sed "s/^X//" >'./archie.man' <<'END_OF_FILE'
  796. X.\" Originally by Jeff Kellem
  797. X.\"
  798. X.TH ARCHIE 1 "20 November 1991" "Archie (Prospero)"
  799. X.SH NAME
  800. Xarchie \- query the Archie anonymous FTP databases using Prospero
  801. X.SH SYNOPSIS
  802. X.in +\w'\fBarchie \fR'u
  803. X.ti -\w'\fBarchie \fR'u
  804. X.B archie\
  805. X\ [\ \fB\-cers\fR\ ]\
  806. X\ [\ \fB\-l\fR\ ]\ [\ \fB\-t\fR\ ]\
  807. X\ [\ \fB\-m#\fR\ ]\ [\ \fB\-N#\fR\ ]\
  808. X\ [\ \fB\-h\fR\ \fIhost\fR\ ]\ [\ \fB\-L\fR\ ]\ \fIstring\fR
  809. X.SH DESCRIPTION
  810. X.B archie
  811. Xqueries an archie anonymous FTP database looking for the specified
  812. X.I string
  813. Xusing the
  814. X.B Prospero
  815. Xprotocol.  This client is based on
  816. X.B Prospero
  817. Xversion Beta.4.2 and is provided to encourage non-interactive use of
  818. Xthe Archie servers (and subsequently better performance on both
  819. Xsides).
  820. X
  821. XThe general method of use is of the form
  822. X
  823. X.RS
  824. X%
  825. X.B archie string
  826. X.RE
  827. X.PP
  828. X
  829. XThis will go to the archie server and ask it to look for all known
  830. Xsystems that have a file named `string' in their FTP area.  \fBarchie\fP
  831. Xwill wait, and print out any matches.
  832. X
  833. XFor example,
  834. X
  835. X.RS
  836. X%
  837. X.B archie emacs
  838. X.RE
  839. X.PP
  840. X
  841. Xwill find all anonymous FTP sites in the archie database that have files
  842. Xnamed
  843. X.B emacs
  844. Xsomewhere in their FTP area.  (This particular query would probably
  845. Xreturn a lot of directories.)  If you want a list of every filename
  846. Xthat contains \fBemacs\fR \fIanywhere\fR in it, you'd use
  847. X
  848. X.RS
  849. X%
  850. X.B archie -c emacs
  851. X.RE
  852. X.PP
  853. X
  854. XRegular expressions, such as
  855. X
  856. X.RS
  857. X%
  858. X.B archie -r '[xX][lL]isp'
  859. X.RE
  860. X.PP
  861. X
  862. Xmay also be used for searches.  (See the manual of a reasonably good
  863. Xeditor, like GNU Emacs or vi, for more information on using regular
  864. Xexpressions.)
  865. X
  866. X.SH OPTIONS
  867. XThe options currently available to this
  868. X.B archie
  869. Xclient are:
  870. X
  871. X.PD 0
  872. X.TP 12
  873. X.BR \-c
  874. XSearch substrings paying attention to upper & lower case.
  875. X.TP
  876. X.BR \-e
  877. XExact string match.  (This is the default.)
  878. X.TP
  879. X.BR \-r
  880. XSearch using a regular expression.
  881. X.TP
  882. X.BR \-s
  883. XSearch substrings ignoring the case of the letters.
  884. X.TP
  885. X.BR \-l
  886. XOutput results in a form suitable for parsing by programs.
  887. X.TP
  888. X.BR \-t
  889. XSort the results inverted by date.
  890. X.TP
  891. X.BI \-m#
  892. XSpecifies the maximum number of hits (matches) to return (default of 
  893. X\fB95\fR).
  894. X.TP
  895. X.BI \-N#
  896. XSets the \fIniceness\fR of a query; by default, it's set to 0.
  897. XWithout an argument, \fB\-N\fR defaults to \fB35765\fR.  If you use
  898. X\fB\-N\fR with an argument between 0 and 35765, it'll adjust itself
  899. Xaccordingly.  (\fBNote\fR: VMS users will have to put quotes around
  900. Xthis argument, and \fB\-L\fR, like ``\fB\-N45\fR''; VMS will otherwise convert
  901. Xit to lowercase.)
  902. X.TP
  903. X.BI \-h\ \fIhost\fR
  904. XTells the client to query the Archie server named \fIhost\fR.
  905. X.TP
  906. X.BI \-L
  907. XLists the Archie servers known to the program when it was compiled.
  908. X
  909. X.PP
  910. X
  911. X.SS Quick Hits
  912. XYou'll often find yourself making fast and furious queries for
  913. Xmultiple things that all look similar (e.g. `telnet', `net', etc).  If
  914. Xyou get into the habit of using the
  915. X.BR \-c
  916. Xoption when performing these kinds of searches, they'll often prove
  917. Xmore fruitful than if you relied upon the default of
  918. X.BR \-e .
  919. X
  920. X.SS Notes
  921. XThe three search-modifying arguments (\fB\-c\fR, \fB\-r\fB, and \fB\-s\fR)
  922. Xare all mutually exclusive; only the last one counts.  If you specify
  923. X\fB\-e\fR with any of \fB\-c\fR, \fB\-r\fB, or \fB\-s\fR,
  924. Xthe server will first check for an exact match, then fall back to the
  925. Xcase-sensitive, case-insensitive, or regular expression search.  This is
  926. Xso if there are matches that are particularly obvious, it will take a
  927. Xminimal amount of time to satisfy your request.
  928. X
  929. XIf you list a single `\-' by itself, any further arguments will be
  930. Xtaken as part of the search string.  This is intended to enable
  931. Xsearching for strings that begin with a `\-'; for example:
  932. X
  933. X.RS
  934. X%
  935. X.B archie \-s \- \-old
  936. X.RE
  937. X
  938. Xwill search for all filenames that contain the string `\-old' in them.
  939. X
  940. X.SH RESPONSE
  941. XArchie servers are set up to respond to a number of requests in a
  942. Xqueued fashion.  That is, smaller requests get served much more
  943. Xquickly than do large requests.  As a result, the more often you query
  944. Xthe Archie server, or the larger your requests, the longer the queue
  945. Xwill become, resulting in a longer waiting period for everyone's
  946. Xrequests.  Please be frugal when possible, for your benefit as well as
  947. Xfor the other users.
  948. X
  949. X.SH QUERY PRIORITY
  950. XPlease use the \fB\-N\fR option whenever you don't demand immediacy, or
  951. Xwhen you're requesting things that could generate large responses.
  952. XEven when using the nice option, you should still try to avoid big
  953. Xjobs during busy periods.  Here is a list of what we consider to be
  954. Xnice values that accurately reflect the priority of a job to the server.
  955. X
  956. X.RS
  957. X.TP 20
  958. X.B Normal
  959. X0
  960. X.TP
  961. X.B Nice
  962. X500
  963. X.TP
  964. X.B Nicer
  965. X1000
  966. X.TP
  967. X.B Very Nice
  968. X5000
  969. X.TP
  970. X.B Extremely Nice
  971. X10000
  972. X.TP
  973. X.B Nicest
  974. X32765
  975. X.RE
  976. X
  977. XThe last priority, \fBNicest\fR, would be used when a job should wait until
  978. Xthe queue is essentially empty before running.  You should pick one of
  979. Xthese values to use, possibly modifying it slightly depending on where
  980. Xyou think your priority should land.  For example, 32760 would mean
  981. Xwait until the queue is empty, but jump ahead of other jobs that have
  982. Xselected \fBNicest\fR.
  983. X
  984. XThere are certain types of things that we suggest using \fBNicest\fR
  985. Xfor, irregardless.  In particular, any searches for which you would
  986. Xhave a hard time justifying the use of anything but extra resources.
  987. X(We all know what those searches would be for.)
  988. X
  989. X.SH SEE ALSO
  990. XFor more information on regular expressions, see the manual pages on:
  991. X
  992. X.BR regex (3) ,
  993. X.BR ed (1)
  994. X
  995. XAlso read the file \fBarchie/whatis\fR on \fBarchie.mcgill.ca\fR for a
  996. Xdetailed paper on Archie as a whole.
  997. X
  998. X.SH AUTHORS
  999. XThe 
  1000. X.B archie
  1001. Xservice was conceived and implemented by Alan Emtage (\fBbajan@cs.mcgill.ca\fR),
  1002. XPeter Deutsch (\fBpeterd@cs.mcgill.ca\fR), and Bill Heelan
  1003. X(\fBwheelan@cs.mcgill.ca\fR).  The entire Internet is in their debt.
  1004. X
  1005. XThe \fBProspero\fR system was created by Clifford Neuman
  1006. X(\fBbcn@isi.edu\fR); write to \fBinfo\-prospero@isi.edu\fR for more
  1007. Xinformation on the protocol and its use.
  1008. X
  1009. XThis stripped client was put together by Brendan Kehoe
  1010. X(\fBbrendan@cs.widener.edu\fR), with modifications by
  1011. XClifford Neuman and George Ferguson (\fBferguson@cs.rochester.edu\fR).
  1012. X
  1013. X.SH BUGS
  1014. XThere are none; only a few unexpected features.
  1015. X
  1016. END_OF_FILE
  1017.   if test 6161 -ne `wc -c <'./archie.man'`; then
  1018.     echo shar: \"'./archie.man'\" unpacked with wrong size!
  1019.   fi
  1020.   # end of './archie.man'
  1021. fi
  1022. if test -f './get_pauth.c' -a "${1}" != "-c" ; then 
  1023.   echo shar: Will not clobber existing file \"'./get_pauth.c'\"
  1024. else
  1025.   echo shar: Extracting \"'./get_pauth.c'\" \(2220 characters\)
  1026.   sed "s/^X//" >'./get_pauth.c' <<'END_OF_FILE'
  1027. X/*
  1028. X * Copyright (c) 1989, 1990 by the University of Washington
  1029. X *
  1030. X * For copying and distribution information, please see the file
  1031. X * <copyright.h>.
  1032. X *
  1033. X * v1.2.2 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  1034. X * v1.2.1 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
  1035. X * v1.2.0 - 09/17/91 (bpk) - fixed it up (thanks to synful)
  1036. X * v1.1.1 - 08/30/91 (bpk) - added VMS support
  1037. X */
  1038. X
  1039. X#include <copyright.h>
  1040. X#include <stdio.h>
  1041. X#ifndef VMS
  1042. X# include <sys/types.h> /* this may/will define FD_SET etc */
  1043. X# include <pmachine.h>
  1044. X#endif
  1045. X
  1046. X#ifdef NEED_STRING_H
  1047. X# include <string.h>
  1048. X#else
  1049. X# include <strings.h>
  1050. X#endif
  1051. X
  1052. X#ifndef VMS
  1053. X# if defined(MSDOS) && !defined(OS2)
  1054. X#  include <rwconf.h>
  1055. X# else
  1056. X#  include <pwd.h>
  1057. X# endif
  1058. X#else
  1059. X# include <jpidef.h>
  1060. X# include <vms.h>
  1061. X#endif
  1062. X
  1063. X#include <pcompat.h>
  1064. X#include <pauthent.h>
  1065. X
  1066. XPAUTH
  1067. Xget_pauth(type)
  1068. X    int        type;
  1069. X    {
  1070. X    static PAUTH_ST   no_auth_st;
  1071. X    static PAUTH          no_auth = NULL;
  1072. X#if !defined(VMS) && !defined(MSDOS) || defined(OS2)
  1073. X    struct passwd *whoiampw;
  1074. X#else
  1075. X    char username[13];
  1076. X    unsigned short usernamelen;
  1077. X    struct {
  1078. X        unsigned short buflen;
  1079. X        unsigned short itmcod;
  1080. X        char *bufadr;
  1081. X        unsigned short *retlenadr;
  1082. X        unsigned long null;
  1083. X    } jpi_itemlist;
  1084. X#endif
  1085. X
  1086. X    if(no_auth == NULL) {
  1087. X        no_auth = &no_auth_st;
  1088. X        strcpy(no_auth->auth_type,"UNAUTHENTICATED");
  1089. X
  1090. X        /* find out who we are */
  1091. X#ifndef VMS
  1092. X#if defined(MSDOS) && !defined(OS2)
  1093. X        if (!getconf("general", "user", no_auth->authenticator, 250)
  1094. X        || (strlen (no_auth->authenticator) == 0))
  1095. X          strcpy(no_auth->authenticator,"nobody");
  1096. X#else /* not MSDOS */
  1097. X        DISABLE_PFS(whoiampw = getpwuid(getuid()));
  1098. X        if (whoiampw == 0) strcpy(no_auth->authenticator,"nobody");
  1099. X        else strcpy(no_auth->authenticator, whoiampw->pw_name);
  1100. X#endif /* not MSDOS */
  1101. X#else
  1102. X        jpi_itemlist.buflen = sizeof(username);
  1103. X        jpi_itemlist.itmcod = JPI$_USERNAME;
  1104. X        jpi_itemlist.bufadr = &username;
  1105. X        jpi_itemlist.retlenadr = &usernamelen;
  1106. X        jpi_itemlist.null = 0;
  1107. X        if (SYS$GETJPI(0, 0, 0, &jpi_itemlist, 0, 0, 0) & 0x1)
  1108. X        {
  1109. X        username[usernamelen] = 0;
  1110. X        strcpy(no_auth->authenticator, username);
  1111. X        } else
  1112. X        strcpy(no_auth->authenticator, "nobody");
  1113. X#endif
  1114. X    }
  1115. X    return(no_auth);
  1116. X    }
  1117. END_OF_FILE
  1118.   if test 2220 -ne `wc -c <'./get_pauth.c'`; then
  1119.     echo shar: \"'./get_pauth.c'\" unpacked with wrong size!
  1120.   fi
  1121.   # end of './get_pauth.c'
  1122. fi
  1123. if test -f './perrno.h' -a "${1}" != "-c" ; then 
  1124.   echo shar: Will not clobber existing file \"'./perrno.h'\"
  1125. else
  1126.   echo shar: Extracting \"'./perrno.h'\" \(4624 characters\)
  1127.   sed "s/^X//" >'./perrno.h' <<'END_OF_FILE'
  1128. X/*
  1129. X * Copyright (c) 1989, 1990 by the University of Washington
  1130. X *
  1131. X * For copying and distribution information, please see the file
  1132. X * <copyright.h>.
  1133. X */
  1134. X
  1135. X#include <copyright.h>
  1136. X
  1137. X/* this file and p_err_text.c should be updated simultaneously */
  1138. X
  1139. X/*
  1140. X * perrno.h - definitions for perrno
  1141. X *
  1142. X * This file contains the declarations and defintions of of the external
  1143. X * error values in which errors are returned by the pfs and psrv
  1144. X * libraries.
  1145. X */
  1146. X
  1147. X#define        P_ERR_STRING_SZ 100     /* Size of error string        */
  1148. X
  1149. Xextern int    perrno;
  1150. Xextern char    p_err_string[];
  1151. Xextern char    *p_err_text[];
  1152. X
  1153. Xextern int    pwarn;
  1154. Xextern char    p_warn_string[];
  1155. Xextern char    *p_warn_text[];
  1156. X
  1157. X/* Error codes returned or found in verrno */
  1158. X
  1159. X#ifndef PSUCCESS
  1160. X#define    PSUCCESS        0
  1161. X#endif
  1162. X
  1163. X/* dirsend (perrno) */
  1164. X#define DIRSEND_PORT_UNKN    1    /* DIRSRV UDP port unknown      */
  1165. X#define DIRSEND_UDP_CANT    2    /* Can't open local UDP port    */
  1166. X#define DIRSEND_BAD_HOSTNAME    3    /* Can't resolve hostname       */
  1167. X#define DIRSEND_NOT_ALL_SENT    4    /* Didn't send entire message   */
  1168. X#define DIRSEND_SELECT_FAILED    5    /* Select failed            */
  1169. X#define DIRSEND_BAD_RECV    6    /* Recvfrom failed             */
  1170. X
  1171. X/* reply */
  1172. X#define REPLY_NOTSENT        11    /* Reply: sendto failed            */
  1173. X
  1174. X/* vl_insert */
  1175. X#define VL_INSERT_ALREADY_THERE    21    /* Link already exists            */
  1176. X#define VL_INSERT_CONFLICT    22    /* Link exists with same name   */
  1177. X
  1178. X/* ul_insert */
  1179. X#define UL_INSERT_ALREADY_THERE 25    /* Link already exists        */
  1180. X#define UL_INSERT_SUPERSEDING   26    /* Replacing existing link    */
  1181. X#define UL_INSERT_POS_NOTFOUND  27    /* Prv entry not in dir->ulinks */
  1182. X
  1183. X/* rd_vdir */
  1184. X#define RVD_DIR_NOT_THERE    41    /* Temporary NOT_FOUND            */
  1185. X#define RVD_NO_CLOSED_NS    42    /* Namespace not closed w/ object:: */
  1186. X#define RVD_NO_NS_ALIAS        43    /* No alias for namespace NS#:      */
  1187. X#define RVD_NS_NOT_FOUND    44    /* Specified namespace not found    */
  1188. X
  1189. X/* pfs_access */
  1190. X#define PFSA_AM_NOT_SUPPORTED   51      /* Access method not supported  */
  1191. X
  1192. X/* pmap_cache */
  1193. X#define PMC_DELETE_ON_CLOSE     55    /* Delete cached copy on close   */
  1194. X#define PMC_RETRIEVE_FAILED     56      /* Unable to retrieve file       */
  1195. X
  1196. X/* mk_vdir */
  1197. X/* #define MKVD_ALREADY_EXISTS     61    /* Directory already exists      */
  1198. X/* #define MKVD_NAME_CONFLICT    62    /* Link with name already exists */
  1199. X
  1200. X/* vfsetenv */
  1201. X#define VFSN_NOT_A_VS        65    /* Not a virtual system          */
  1202. X#define VFSN_CANT_FIND_DIR    66    /* Not a virtual system          */
  1203. X
  1204. X/* add_vlink */
  1205. X/* #define ADDVL_ALREADY_EXISTS    71    /* Directory already exists      */
  1206. X/* #define ADDVL_NAME_CONFLICT    72    /* Link with name already exists */
  1207. X
  1208. X/* Local error codes on server */
  1209. X
  1210. X/* dsrdir */
  1211. X#define DSRDIR_NOT_A_DIRECTORY 111    /* Not a directory name        */
  1212. X/* dsrfinfo */
  1213. X#define DSRFINFO_NOT_A_FILE    121      /* Object not found             */
  1214. X#define DSRFINFO_FORWARDED     122      /* Object has moved             */
  1215. X
  1216. X/* Error codes that may be returned by various procedures               */
  1217. X#define PFS_FILE_NOT_FOUND     230      /* File not found               */
  1218. X#define PFS_DIR_NOT_FOUND      231      /* Directory in path not found  */
  1219. X#define PFS_SYMLINK_DEPTH      232    /* Max sym-link depth exceeded  */
  1220. X#define PFS_ENV_NOT_INITIALIZED    233    /* Can't read environment    */
  1221. X#define PFS_EXT_USED_AS_DIR    234    /* Can't use externals as dirs  */
  1222. X#define PFS_MAX_FWD_DEPTH      235    /* Exceeded max forward depth   */
  1223. X
  1224. X/* Error codes returned by directory server                    */
  1225. X/* some of these duplicate errors from individual routines     */
  1226. X/* some of those error codes should be eliminated              */
  1227. X#define DIRSRV_AUTHENT_REQ     242      /* Authentication required       */
  1228. X#define DIRSRV_NOT_AUTHORIZED  243      /* Not authorized                */
  1229. X#define DIRSRV_NOT_FOUND       244      /* Not found                     */
  1230. X#define DIRSRV_BAD_VERS        245
  1231. X#define DIRSRV_NOT_DIRECTORY   246
  1232. X#define DIRSRV_ALREADY_EXISTS  247    /* Identical link already exists */
  1233. X#define DIRSRV_NAME_CONFLICT   248    /* Link with name already exists */
  1234. X
  1235. X#define DIRSRV_UNIMPLEMENTED   251      /* Unimplemented command         */
  1236. X#define DIRSRV_BAD_FORMAT      252
  1237. X#define DIRSRV_ERROR           253
  1238. X#define DIRSRV_SERVER_FAILED   254      /* Unspecified server failure    */
  1239. X
  1240. X#ifndef PFAILURE
  1241. X#define    PFAILURE            255
  1242. X#endif
  1243. X
  1244. X/* Warning codes */
  1245. X
  1246. X#define PNOWARN             0    /* No warning indicated         */
  1247. X#define PWARN_OUT_OF_DATE     1    /* Software is out of date       */
  1248. X#define PWARN_MSG_FROM_SERVER     2      /* Warning in p_warn_string      */
  1249. X#define PWARN_UNRECOGNIZED_RESP  3    /* Unrecognized line in response */
  1250. X#define PWARNING           255    /* Warning in p_warn_string      */
  1251. END_OF_FILE
  1252.   if test 4624 -ne `wc -c <'./perrno.h'`; then
  1253.     echo shar: \"'./perrno.h'\" unpacked with wrong size!
  1254.   fi
  1255.   # end of './perrno.h'
  1256. fi
  1257. if test -f './procquery.c' -a "${1}" != "-c" ; then 
  1258.   echo shar: Will not clobber existing file \"'./procquery.c'\"
  1259. else
  1260.   echo shar: Extracting \"'./procquery.c'\" \(5736 characters\)
  1261.   sed "s/^X//" >'./procquery.c' <<'END_OF_FILE'
  1262. X/*
  1263. X * procquery.c : Routines for processing results from Archie
  1264. X *
  1265. X * Originally part of the Prospero Archie client by Cliff Neuman (bcn@isi.edu).
  1266. X * Modified by Brendan Kehoe (brendan@cs.widener.edu).
  1267. X * Re-modified by George Ferguson (ferguson@cs.rochester.edu).
  1268. X *
  1269. X * Copyright (c) 1991 by the University of Washington
  1270. X *
  1271. X * For copying and distribution information, please see the file
  1272. X * <copyright.h>.
  1273. X *
  1274. X * v1.2.2 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  1275. X * v1.2.1 - 10/18/91 (bpk) - warning stuff
  1276. X * v1.2.0 - 09/20/91 (bpk) - VMS under Multinet 3.0 too
  1277. X * v1.1.1 - 08/20/91 (bpk) - took out archie_query from error msg
  1278. X */
  1279. X#include <copyright.h>
  1280. X#include <stdio.h>
  1281. X#include <pfs.h>
  1282. X#include <perrno.h>
  1283. X#include <pmachine.h>
  1284. X#include <archie.h>
  1285. X
  1286. X#ifdef NEED_TIME_H
  1287. X# include <time.h>
  1288. X#else
  1289. X# ifndef VMS
  1290. X#  include <sys/time.h>
  1291. X# endif
  1292. X#endif
  1293. X
  1294. Xextern int client_dirsrv_timeout,client_dirsrv_retry;    /* dirsend.c */
  1295. Xextern char *progname;
  1296. X
  1297. X
  1298. X/*
  1299. X * Functions defined here
  1300. X */
  1301. Xvoid display_link(), procquery();
  1302. X
  1303. X/*
  1304. X * Data defined here
  1305. X */
  1306. Xextern int pwarn, perrno;
  1307. Xint pfs_debug;
  1308. Xstatic struct tm *presenttime;
  1309. Xstatic char lastpath[MAX_VPATH] = "\001";
  1310. Xstatic char lasthost[MAX_VPATH] = "\001";
  1311. X
  1312. X/*    -    -    -    -    -    -    -    -    */
  1313. X/*
  1314. X * display_link : Prints the contents of the given virtual link. If
  1315. X *    listflag is 0, then this uses last{host,path} to save state
  1316. X *    between calls for a less verbose output. If listflag is non-zero
  1317. X *    then all information is printed every time.
  1318. X */
  1319. Xvoid
  1320. Xdisplay_link(l,listflag)
  1321. XVLINK l;
  1322. Xint listflag;
  1323. X{
  1324. X    PATTRIB     ap;
  1325. X    char    linkpath[MAX_VPATH];
  1326. X    int        dirflag = 0;
  1327. X#ifdef MSDOS
  1328. X    unsigned long size = 0L;
  1329. X#else
  1330. X    int        size = 0;
  1331. X#endif
  1332. X    char    *modes = "";
  1333. X    char    archie_date[20];
  1334. X    char    *gt_date = "";
  1335. X    int        gt_year = 0;
  1336. X    int        gt_mon = 0;
  1337. X    int        gt_day = 0;
  1338. X    int        gt_hour = 0;
  1339. X    int        gt_min = 0;
  1340. X    
  1341. X    /* Initialize local buffers */
  1342. X    *archie_date = '\0';
  1343. X
  1344. X    /* Remember if we're looking at a directory */
  1345. X    if (sindex(l->type,"DIRECTORY"))
  1346. X    dirflag = 1;
  1347. X    else
  1348. X    dirflag = 0;
  1349. X    
  1350. X    /* Extract the linkpath from the filename */
  1351. X    strcpy(linkpath,l->filename);
  1352. X    *(linkpath + (strlen(linkpath) - strlen(l->name) - 1)) = '\0';
  1353. X    
  1354. X    /* Is this a new host? */
  1355. X    if (strcmp(l->host,lasthost) != 0) {
  1356. X    if (!listflag)
  1357. X        printf("\nHost %s\n\n",l->host);
  1358. X    strcpy(lasthost,l->host);
  1359. X    *lastpath = '\001';
  1360. X    }
  1361. X    
  1362. X    /* Is this a new linkpath (location)? */
  1363. X    if(strcmp(linkpath,lastpath) != 0) {
  1364. X    if (!listflag)
  1365. X        printf("    Location: %s\n",(*linkpath ? linkpath : "/"));
  1366. X    strcpy(lastpath,linkpath);
  1367. X    }
  1368. X    
  1369. X    /* Parse the attibutes of this link */
  1370. X    for (ap = l->lattrib; ap; ap = ap->next) {
  1371. X    if (strcmp(ap->aname,"SIZE") == 0) {
  1372. X#ifdef MSDOS
  1373. X        sscanf(ap->value.ascii,"%lu",&size);
  1374. X#else
  1375. X        sscanf(ap->value.ascii,"%d",&size);
  1376. X#endif
  1377. X    } else if(strcmp(ap->aname,"UNIX-MODES") == 0) {
  1378. X        modes = ap->value.ascii;
  1379. X    } else if(strcmp(ap->aname,"LAST-MODIFIED") == 0) {
  1380. X        gt_date = ap->value.ascii;
  1381. X        sscanf(gt_date,"%4d%2d%2d%2d%2d",>_year,
  1382. X           >_mon, >_day, >_hour, >_min);
  1383. X        if ((12 * (presenttime->tm_year + 1900 - gt_year) + 
  1384. X                    presenttime->tm_mon - gt_mon) > 6) 
  1385. X        sprintf(archie_date,"%s %2d %4d",month_sname(gt_mon),
  1386. X            gt_day, gt_year);
  1387. X        else
  1388. X        sprintf(archie_date,"%s %2d %02d:%02d",month_sname(gt_mon),
  1389. X             gt_day, gt_hour, gt_min);
  1390. X    }
  1391. X    }
  1392. X    
  1393. X    /* Print this link's information */
  1394. X    if (listflag)
  1395. X#if defined(MSDOS)
  1396. X    printf("%s %6lu %s %s%s\n",gt_date,size,l->host,l->filename,
  1397. X           (dirflag ? "/" : ""));
  1398. X#else
  1399. X    printf("%s %6d %s %s%s\n",gt_date,size,l->host,l->filename,
  1400. X           (dirflag ? "/" : ""));
  1401. X#endif
  1402. X    else
  1403. X#ifdef MSDOS
  1404. X    printf("      %9s %s %10lu  %s  %s\n",(dirflag ? "DIRECTORY" : "FILE"),
  1405. X                    modes,size,archie_date,l->name);
  1406. X#else
  1407. X    printf("      %9s %s %10d  %s  %s\n",(dirflag ? "DIRECTORY" : "FILE"),
  1408. X                    modes,size,archie_date,l->name);
  1409. X#endif /* MSDOS */
  1410. X
  1411. X
  1412. X    /* Free the attibutes */
  1413. X    atlfree(l->lattrib);
  1414. X    l->lattrib = NULL;
  1415. X}
  1416. X
  1417. X/*    -    -    -    -    -    -    -    -    */
  1418. X/*
  1419. X * procquery : Process the given query and display the results. If
  1420. X *    sortflag is non-zero, then the results are sorted by increasing
  1421. X *    date, else by host/filename. If listflag is non-zero then each
  1422. X *    entry is printed on a separate, complete line. Note that listflag
  1423. X *    is ignored by xarchie.
  1424. X */
  1425. Xvoid
  1426. Xprocquery(host,str,max_hits,offset,query_type,sortflag,listflag)
  1427. Xchar *host,*str;
  1428. Xint max_hits,offset;
  1429. Xchar query_type;
  1430. Xint sortflag,listflag;
  1431. X{
  1432. X    VLINK l;
  1433. X    long now;
  1434. X    extern int rdgram_priority;
  1435. X
  1436. X    /* initialize data structures for this query */
  1437. X    (void)time(&now);
  1438. X    presenttime = localtime(&now);
  1439. X
  1440. X    /* Do the query */
  1441. X    if (sortflag == 1)
  1442. X    l = archie_query(host,str,max_hits,offset,query_type,AQ_INVDATECMP,0);
  1443. X    else
  1444. X    l = archie_query(host,str,max_hits,offset,query_type,NULL,0);
  1445. X
  1446. X    /* Error? */
  1447. X    if (perrno != PSUCCESS) {
  1448. X    if (p_err_text[perrno]) {
  1449. X        if (*p_err_string)
  1450. X        fprintf(stderr, "%s: failed: %s - %s\n", progname,
  1451. X                p_err_text[perrno], p_err_string);
  1452. X        else
  1453. X            fprintf(stderr, "%s failed: %s\n", progname, p_err_text[perrno]);
  1454. X    } else
  1455. X        fprintf(stderr, "%s failed: Undefined error %d (prospero)", perrno);
  1456. X    }
  1457. X
  1458. X    /* Warning? */
  1459. X    if (pwarn != PNOWARN) {
  1460. X    if (*p_warn_string)
  1461. X        fprintf(stderr, "%s: Warning! %s - %s\n", progname,
  1462. X        p_warn_text[pwarn], p_warn_string);
  1463. X    else
  1464. X        fprintf(stderr, "%s: Warning! %s\n", progname, p_warn_text[pwarn]);
  1465. X    }
  1466. X
  1467. X
  1468. X    /* Display the results */
  1469. X
  1470. X    if (l == (VLINK)NULL && pwarn == PNOWARN && perrno == PSUCCESS) {
  1471. X    if (! listflag) puts ("No matches.");
  1472. X    exit (1);
  1473. X    }
  1474. X
  1475. X    *lasthost = '\001';
  1476. X    *lastpath = '\001';
  1477. X    while (l != NULL) {
  1478. X    display_link(l,listflag);
  1479. X    l = l->next;
  1480. X    }
  1481. X}
  1482. END_OF_FILE
  1483.   if test 5736 -ne `wc -c <'./procquery.c'`; then
  1484.     echo shar: \"'./procquery.c'\" unpacked with wrong size!
  1485.   fi
  1486.   # end of './procquery.c'
  1487. fi
  1488. if test -f './stcopy.c' -a "${1}" != "-c" ; then 
  1489.   echo shar: Will not clobber existing file \"'./stcopy.c'\"
  1490. else
  1491.   echo shar: Extracting \"'./stcopy.c'\" \(2207 characters\)
  1492.   sed "s/^X//" >'./stcopy.c' <<'END_OF_FILE'
  1493. X/*
  1494. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  1495. X *
  1496. X * For copying and distribution information, please see the file
  1497. X * <copyright.h>.
  1498. X *
  1499. X * v1.2.1 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  1500. X * v1.2.0 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
  1501. X */
  1502. X
  1503. X#include <copyright.h>
  1504. X#include <stdio.h>
  1505. X#include <pmachine.h>
  1506. X
  1507. X#ifdef NEED_STRING_H
  1508. X# include <string.h>
  1509. X#else
  1510. X# include <strings.h>
  1511. X#endif
  1512. X
  1513. X#if defined(MSDOS)
  1514. X# include <stdlib.h>
  1515. X#endif
  1516. X
  1517. Xchar    *stcopyr();
  1518. X
  1519. Xint    string_count = 0;
  1520. Xint    string_max = 0;
  1521. X
  1522. X/*
  1523. X * stcopy - allocate space for and copy a string
  1524. X *
  1525. X *     STCOPY takes a string as an argument, allocates space for
  1526. X *     a copy of the string, copies the string to the allocated space,
  1527. X *     and returns a pointer to the copy.
  1528. X */
  1529. X
  1530. Xchar *
  1531. Xstcopy(st)
  1532. X    char    *st;
  1533. X    {
  1534. X      if (!st) return(NULL);
  1535. X      if (string_max < ++string_count) string_max = string_count;
  1536. X
  1537. X      return strcpy((char *)malloc(strlen(st) + 1), st);
  1538. X    }
  1539. X
  1540. X/*
  1541. X * stcopyr - copy a string allocating space if necessary
  1542. X *
  1543. X *     STCOPYR takes a string, S, as an argument, and a pointer to a second
  1544. X *     string, R, which is to be replaced by S.  If R is long enough to
  1545. X *     hold S, S is copied.  Otherwise, new space is allocated, and R is
  1546. X *     freed.  S is then copied to the newly allocated space.  If S is
  1547. X *     NULL, then R is freed and NULL is returned.
  1548. X *
  1549. X *     In any event, STCOPYR returns a pointer to the new copy of S,
  1550. X *     or a NULL pointer.
  1551. X */
  1552. Xchar *
  1553. Xstcopyr(s,r)
  1554. X    char    *s;
  1555. X    char    *r;
  1556. X    {
  1557. X    int    sl;
  1558. X
  1559. X    if(!s && r) {
  1560. X        free(r);
  1561. X        string_count--;
  1562. X        return(NULL);
  1563. X    }
  1564. X    else if (!s) return(NULL);
  1565. X
  1566. X    sl = strlen(s) + 1;
  1567. X
  1568. X    if(r) {
  1569. X        if ((strlen(r) + 1) < sl) {
  1570. X        free(r);
  1571. X        r = (char *) malloc(sl);
  1572. X        }
  1573. X    }
  1574. X    else {
  1575. X        r = (char *) malloc(sl);
  1576. X        string_count++;
  1577. X        if(string_max < string_count) string_max = string_count;
  1578. X    }
  1579. X        
  1580. X    return strcpy(r,s);
  1581. X    }
  1582. X
  1583. X/*
  1584. X * stfree - free space allocated by stcopy or stalloc
  1585. X *
  1586. X *     STFREE takes a string that was returned by stcopy or stalloc 
  1587. X *     and frees the space that was allocated for the string.
  1588. X */
  1589. Xvoid
  1590. Xstfree(st)
  1591. X    char *st;
  1592. X    {
  1593. X    if(st) {
  1594. X        free(st);
  1595. X        string_count--;
  1596. X    }
  1597. X    }
  1598. X
  1599. X
  1600. END_OF_FILE
  1601.   if test 2207 -ne `wc -c <'./stcopy.c'`; then
  1602.     echo shar: \"'./stcopy.c'\" unpacked with wrong size!
  1603.   fi
  1604.   # end of './stcopy.c'
  1605. fi
  1606. if test -f './udp.c' -a "${1}" != "-c" ; then 
  1607.   echo shar: Will not clobber existing file \"'./udp.c'\"
  1608. else
  1609.   echo shar: Extracting \"'./udp.c'\" \(2234 characters\)
  1610.   sed "s/^X//" >'./udp.c' <<'END_OF_FILE'
  1611. X/*
  1612. X * udp - Check if UDP traffic is allowed on this host; we open port 1527 on
  1613. X *       a system (default of cs.widener.edu), which is expecting it; the
  1614. X *       date is output (e.g. very similar to the daytime service).  This
  1615. X *       will conclusively tell us if UDP traffic on ports > 1000 is allowed.
  1616. X *
  1617. X *    It should print out the date if UDP traffic's not blocked on your
  1618. X *    system.  If it just hangs, try these tests too:
  1619. X *      a. run it with -d  (e.g. "udp -d"); that goes to the normal UDP port
  1620. X *         to print the date.  If it works, then you can be sure that any
  1621. X *         UDP traffic > port 1000 is blocked on your system.
  1622. X *      b. if it hangs too, try "telnet 147.31.254.130 13" and see if
  1623. X *         _that_ prints the date; if it doesn't, it's another problem (your
  1624. X *         network can't get to me, e.g.).
  1625. X *
  1626. X * Compile by: cc -o udp udp.c
  1627. X *
  1628. X * Brendan Kehoe, brendan@cs.widener.edu, Oct 1991.
  1629. X */
  1630. X
  1631. X#include <stdio.h>
  1632. X#include <sys/types.h>
  1633. X#include <sys/socket.h>
  1634. X#include <netinet/in.h>
  1635. X#ifndef hpux
  1636. X# include <arpa/inet.h>
  1637. X#endif
  1638. X
  1639. X#define    SIZE    2048
  1640. X#define    HOST    "147.31.254.130"    /* cs.widener.edu */
  1641. X#define PORT    1527
  1642. X
  1643. Xmain (argc, argv)
  1644. X     int argc;
  1645. X     char **argv;
  1646. X{
  1647. X  int s, len;
  1648. X  struct sockaddr_in server, sa;
  1649. X  char buf[SIZE];
  1650. X
  1651. X  if ((s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
  1652. X    {
  1653. X      perror ("socket()");
  1654. X      exit (1);
  1655. X    }
  1656. X
  1657. X  bzero ((char *) &sa, sizeof (sa));
  1658. X  sa.sin_family = AF_INET;
  1659. X  sa.sin_addr.s_addr = htonl (INADDR_ANY);
  1660. X  sa.sin_port = htons (0);
  1661. X
  1662. X  if (bind (s, (struct sockaddr *) &sa, sizeof (sa)) < 0)
  1663. X    {
  1664. X      perror ("bind()");
  1665. X      exit (1);
  1666. X    }
  1667. X
  1668. X  bzero ((char *) &server, sizeof (server));
  1669. X  server.sin_family = AF_INET;
  1670. X  server.sin_addr.s_addr = inet_addr (HOST);
  1671. X  if (argc > 1 && strcmp(*(argv + 1), "-d") == 0)
  1672. X    server.sin_port = htons ((unsigned short) 13);
  1673. X  else
  1674. X    server.sin_port = htons ((unsigned short) PORT);
  1675. X
  1676. X  /* yoo hoo, we're here .. */
  1677. X  if (sendto (s, "\n", 1, 0, &server, sizeof (server)) < 0)
  1678. X    {
  1679. X      perror ("sendto()");
  1680. X      exit (1);
  1681. X    }
  1682. X
  1683. X  /* slurp */
  1684. X  len = sizeof (server);
  1685. X  if (recvfrom (s, buf, sizeof (buf), 0, &server, &len) < 0)
  1686. X    {
  1687. X      perror ("recvfrom");
  1688. X      exit (1);
  1689. X    }
  1690. X
  1691. X  printf ("%s", buf);
  1692. X  close (s);
  1693. X}
  1694. END_OF_FILE
  1695.   if test 2234 -ne `wc -c <'./udp.c'`; then
  1696.     echo shar: \"'./udp.c'\" unpacked with wrong size!
  1697.   fi
  1698.   # end of './udp.c'
  1699. fi
  1700. if test -f './vlalloc.c' -a "${1}" != "-c" ; then 
  1701.   echo shar: Will not clobber existing file \"'./vlalloc.c'\"
  1702. else
  1703.   echo shar: Extracting \"'./vlalloc.c'\" \(2321 characters\)
  1704.   sed "s/^X//" >'./vlalloc.c' <<'END_OF_FILE'
  1705. X/*
  1706. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  1707. X *
  1708. X * For copying and distribution information, please see the file
  1709. X * <copyright.h>.
  1710. X */
  1711. X
  1712. X#include <copyright.h>
  1713. X#include <stdio.h>
  1714. X
  1715. X#include <pfs.h>
  1716. X#include <pmachine.h>
  1717. X
  1718. Xstatic VLINK    lfree = NULL;
  1719. Xint        vlink_count = 0;
  1720. Xint        vlink_max = 0;
  1721. X
  1722. X/*
  1723. X * vlalloc - allocate and initialize vlink structure
  1724. X *
  1725. X *    VLALLOC returns a pointer to an initialized structure of type
  1726. X *    VLINK.  If it is unable to allocate such a structure, it
  1727. X *    returns NULL.
  1728. X */
  1729. XVLINK
  1730. Xvlalloc()
  1731. X    {
  1732. X    VLINK    vl;
  1733. X    if(lfree) {
  1734. X        vl = lfree;
  1735. X        lfree = lfree->next;
  1736. X    }
  1737. X    else {
  1738. X        vl = (VLINK) malloc(sizeof(VLINK_ST));
  1739. X        if (!vl) return(NULL);
  1740. X        vlink_max++;
  1741. X    }
  1742. X
  1743. X    vlink_count++;
  1744. X
  1745. X    /* Initialize and fill in default values */
  1746. X    /* Since all but four are set to a zero-value,
  1747. X       why not just wipe it clean?  */
  1748. X    ZERO(vl);
  1749. X
  1750. X    vl->linktype = 'L';
  1751. X    vl->type = stcopy("FILE");
  1752. X    vl->hosttype = stcopy("INTERNET-D");
  1753. X    vl->nametype = stcopy("ASCII");
  1754. X
  1755. X    return(vl);
  1756. X    }
  1757. X
  1758. X/*
  1759. X * vlfree - free a VLINK structure
  1760. X *
  1761. X *    VLFREE takes a pointer to a VLINK structure and adds it to
  1762. X *    the free list for later reuse.
  1763. X */
  1764. Xvoid
  1765. Xvlfree(vl)
  1766. X    VLINK    vl;
  1767. X    {
  1768. X        extern int string_count;
  1769. X
  1770. X    if(vl->dontfree) return;
  1771. X    /* many of these don't need to call stfree(); since a check
  1772. X       for pointer validity's already done before even calling
  1773. X       it, we can just call free() here then do one big decrement
  1774. X       of string_count at the end.  */
  1775. X    if(vl->name) free(vl->name);
  1776. X    stfree(vl->type);
  1777. X    if(vl->replicas) vllfree(vl->replicas);
  1778. X    stfree(vl->hosttype);
  1779. X    if(vl->host) free(vl->host);
  1780. X    stfree(vl->nametype);
  1781. X    if(vl->filename) free(vl->filename);
  1782. X    if(vl->args) free(vl->args);
  1783. X    if(vl->lattrib) atlfree(vl->lattrib);
  1784. X    /* No allocation routines for f_info yet */
  1785. X    vl->f_info = NULL;
  1786. X    vl->next = lfree;
  1787. X    vl->previous = NULL;
  1788. X    lfree = vl;
  1789. X    vlink_count--;
  1790. X    string_count -= 4; /* freed name, host, filename, and args */
  1791. X    }
  1792. X
  1793. X/*
  1794. X * vllfree - free a VLINK structure
  1795. X *
  1796. X *    VLLFREE takes a pointer to a VLINK structure frees it and any linked
  1797. X *    VLINK structures.  It is used to free an entrie list of VLINK
  1798. X *    structures.
  1799. X */
  1800. Xvoid
  1801. Xvllfree(vl)
  1802. X    VLINK    vl;
  1803. X    {
  1804. X    VLINK    nxt;
  1805. X
  1806. X    while((vl != NULL) && !vl->dontfree) {
  1807. X        nxt = vl->next;
  1808. X        vlfree(vl);
  1809. X        vl = nxt;
  1810. X    }
  1811. X    }
  1812. X
  1813. END_OF_FILE
  1814.   if test 2321 -ne `wc -c <'./vlalloc.c'`; then
  1815.     echo shar: \"'./vlalloc.c'\" unpacked with wrong size!
  1816.   fi
  1817.   # end of './vlalloc.c'
  1818. fi
  1819. if test -f './vms/fd.h' -a "${1}" != "-c" ; then 
  1820.   echo shar: Will not clobber existing file \"'./vms/fd.h'\"
  1821. else
  1822.   echo shar: Extracting \"'./vms/fd.h'\" \(393 characters\)
  1823.   sed "s/^X//" >'./vms/fd.h' <<'END_OF_FILE'
  1824. X#ifndef _VMS_FD
  1825. X#define _VMS_FD
  1826. X
  1827. Xtypedef struct fd_set
  1828. X{
  1829. X  int fds_bits[1];
  1830. X} fd_set;
  1831. X
  1832. X#define FD_SETSIZE          (sizeof (fd_set) * 8)
  1833. X#define FD_SET(f,s)         ((s)->fds_bits[0] |= (1 << (f)))
  1834. X#define FD_CLR(f,s)         ((s)->fds_bits[0] &= ~(1 << (f)))
  1835. X#define FD_ISSET(f,s)       ((s)->fds_bits[0] & (1 << (f)))
  1836. X#define FD_ZERO(s)          ((s)->fds_bits[0] = 0)
  1837. X
  1838. X#endif /* _VMS_FD */
  1839. END_OF_FILE
  1840.   if test 393 -ne `wc -c <'./vms/fd.h'`; then
  1841.     echo shar: \"'./vms/fd.h'\" unpacked with wrong size!
  1842.   fi
  1843.   # end of './vms/fd.h'
  1844. fi
  1845. echo shar: End of archive 4 \(of 5\).
  1846. cp /dev/null ark4isdone
  1847. MISSING=""
  1848. for I in 1 2 3 4 5 ; do
  1849.     if test ! -f ark${I}isdone ; then
  1850.     MISSING="${MISSING} ${I}"
  1851.     fi
  1852. done
  1853. if test "${MISSING}" = "" ; then
  1854.     echo You have unpacked all 5 archives.
  1855.     rm -f ark[1-9]isdone
  1856. else
  1857.     echo You still must unpack the following archives:
  1858.     echo "        " ${MISSING}
  1859. fi
  1860. exit 0
  1861. exit 0 # Just in case...
  1862.