home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-23 | 54.2 KB | 1,862 lines |
- Newsgroups: comp.sources.misc
- From: brendan@cs.widener.edu (Brendan Kehoe)
- Subject: v26i049: archie - A Prospero client for Archie, v1.2, Part04/05
- Message-ID: <1991Nov24.045445.4873@sparky.imd.sterling.com>
- X-Md4-Signature: 77ec069d95ef7e14b644842dd2751dcb
- Date: Sun, 24 Nov 1991 04:54:45 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: brendan@cs.widener.edu (Brendan Kehoe)
- Posting-number: Volume 26, Issue 49
- Archive-name: archie/part04
- Environment: UNIX, VMS
- Supersedes: archie: Volume 22, Issue 35-39
-
- #! /bin/sh
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: ./INSTALL ./Makefile ./README ./archie.c ./archie.doc
- # ./archie.man ./get_pauth.c ./perrno.h ./procquery.c ./stcopy.c
- # ./udp.c ./vlalloc.c ./vms/fd.h
- # Wrapped by kent@sparky on Wed Nov 20 18:23:44 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 4 (of 5)."'
- if test -f './INSTALL' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./INSTALL'\"
- else
- echo shar: Extracting \"'./INSTALL'\" \(2345 characters\)
- sed "s/^X//" >'./INSTALL' <<'END_OF_FILE'
- X[Last changed: 11/20/91 v1.2]
- X
- X This is the minimal set of things you need to build an Archie client
- Xthat takes advantage of the Prospero system. It is derived from the
- X4.2beta version of Prospero, currently available as the file prospero.tar.Z
- Xon the host cs.washington.edu.
- X
- X * To make the client under Unix:
- X
- X - edit the Makefile, changing CC, OPTIONS, LDFLAGS, and RM if
- X necessary (odds are you won't have to do this..see below)
- X - edit the DEFINEs as necessary
- X - if you're in Finland, Australia, the UK, or Canada, please edit
- X archie.h and change ARCHIE_HOST appropriately (the US is set).
- X - type `make'
- X
- X I've tried to make this as portable as possible. I'd encourage you
- Xto try doing a "make" without any changes to the Makefile, and see how
- Xit goes. If it pukes, and you have to define something, please drop
- Xme a line---my goal is for anybody to just type "make" and not have to
- Xworry about things like what functions their system supports.
- X
- X * To make the client under VMS, you should edit MAKE.COM and select
- Xthe appropriate define for your version of TCP/IP (currently either
- XMultinet or Wallongong). It will sense if you're using Gnu C or not.
- XIt's currently only been ported to VMS 5.4-2 -- I can't guarantee
- Xit'll work with older versions.
- X
- X * To make the client under MSDOS or OS/2, presently the only PC
- XTCP/IP package archie has been modified for is FTP Software's PC/TCP
- Xfor MSDOS (version 2.1 or higher) and OS/2 (version 1.1 and higher).
- X
- X It's been successfully built on:
- X
- X Machine OS
- X
- X* Apollo Domain/OS 10.3
- X* Apple Mac IIsomething A/UX v2.01
- X* CDC Mips systems, all sorts EP/IX 1.2.3 and 1.3.1
- X* Convex c210 & others ConvexOS 9.0
- X* DecStations -- all sorts Ultrix 4.1 and 4.2
- X* Encore Multimax 520 (XPC) Encore UMAX 4.3
- X* Encore Multimax 520 Encore Mach 1.1alpha
- X* Harris HCX-9 (tahoe) CX/UX 5.1
- X* HP 9000/s300 MORE/bsd-4.3
- X* HP 9000/s834 HP/UX 7.0
- X* IBM PC MSDOS and OS/2
- X* IBM RS/6000 AIX
- X* IBM RT 4.3BSD, and AIX
- X* NeXT NeXT OS 2.1
- X* Sequent Symmetry Dynix 3.1.1
- X* SGI 4D/220GTX SGI Irix 3.3.2
- X* Solbourne Series 5/600 OS/MP 4.0Da
- X* Stardent 3030 SysV Rel 3.0.1
- X* Suns -- all sorts SunOS 4.0.3, 4.1, and 4.1.1
- X* Vax 8600 MORE/bsd-4.3
- X* Vax 6000/310 VMS 5.4/Wallongong 5.1
- X* MicroVax 3400 VMS 5.4-2/Multinet 2.2 and Multinet 3.0
- X
- X-- Brendan Kehoe (brendan@cs.widener.edu)
- END_OF_FILE
- if test 2345 -ne `wc -c <'./INSTALL'`; then
- echo shar: \"'./INSTALL'\" unpacked with wrong size!
- fi
- # end of './INSTALL'
- fi
- if test -f './Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./Makefile'\"
- else
- echo shar: Extracting \"'./Makefile'\" \(3798 characters\)
- sed "s/^X//" >'./Makefile' <<'END_OF_FILE'
- X#
- X# Last changed: 11/20/91, v1.2
- X#
- X# Makefile for the minimal build for an archie Prospero client.
- X
- X# Your C compiler:
- XCC=cc
- X
- X# For most systems, these OPTIONS will suffice. Exceptions:
- X#
- X# * If you're on a Stardent, add -43
- X# * If you're running EP/IX, you may need to add -systype bsd43 ..try
- X# it without it first, though.
- X
- XOPTIONS= -O -I. # -43 -systype bsd43
- X
- X# For this, DEFINES is usually ok as-is. Try it without any of these
- X# first; if some stuff fails or shows up undefined, then come back and
- X# add 'em.
- X#
- X# * if you're on an Apple running A/UX, add -DAUX
- X# * if you're using a BULL system (Bull DPX/2), add -DBULL
- X# * if you want to include the debugging code (so you
- X# can help with problem-solving if any crop up), add -DDEBUG
- X# * if you're running System V, add -DSYSV
- X# * if you're running a USG (System V.2) system, add -DUSG
- X# * if you're running UTS, add -DUTS
- X# * if your system doesn't have the functions index(),
- X# rindex(), bcopy(), or bzero(), add -DFUNCS
- X# * if your system doesn't have the re_comp/regcmp or re_exec/regex
- X# routines (no regex(3)/regcmp(3X) library), then add -DNOREGEX
- X# * if your system is lacking strspn(), add -DSTRSPN
- XDEFINES= -DDEBUG
- X
- X# Usually LDFLAGS is empty; if, after you build this, archie
- X# complains that it can't resolve ARCHIE.SURA.NET, you need
- X# to add `-lresolv'.
- X# * If you need the PW library (e.g. A/UX), add -lPW
- XLDFLAGS= # -lresolv -lPW
- X
- X# Change this if necessary.
- XRM=/bin/rm
- X
- X# =========================
- X# Yer' done....make archie.
- X# =========================
- X#
- XCFLAGS=$(OPTIONS) $(DEFINES)
- X#
- XOBJS= aquery.o archie.o atalloc.o dirsend.o get_pauth.o get_vdir.o \
- X perrmesg.o procquery.o ptalloc.o regex.o stcopy.o support.o \
- X vlalloc.o vl_comp.o
- X#
- Xall: archie
- X
- Xarchie: $(OBJS)
- X $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
- X
- X$(OBJS): archie.h pmachine.h pcompat.h Makefile
- X
- Xprocquery.o: copyright.h
- X
- Xclean:
- X $(RM) -f *.o archie
- X
- Xgclean: clean
- X $(RM) -f *~ archie.0* archie.com archie.tar* gmon.out archie.doc
- X
- Xunx-deadly:
- X unifdef -UXARCHIE xprocquery.c > procquery.c
- X
- Xudp: udp.o
- X $(CC) -o $@ udp.o
- X
- Xudptest: udp
- X @echo "This should print the date, if UDP's enabled, or hang if not:"
- X @./udp
- X
- XFILES= INSTALL Makefile Prospero README archie.c archie.h archie.lnk \
- X archie.doc archie.man aquery.c atalloc.c dirsend.c get_pauth.c \
- X get_vdir.c make.com makefile.dos makefile.os2 perrmesg.c \
- X patchlevel.h pauthent.h pcompat.h perrno.h pfs.h pmachine.h pprot.h \
- X procquery.c ptalloc.c rdgram.h regex.c regex.h stcopy.c support.c \
- X copyright.h udp.c vl_comp.c vlalloc.c vms.h vms_support.c vms/fd.h \
- X vms/in.h vms/pseudos.h vms/signal.h vms/socket.h vms/time.h \
- X vms/types.h vms/network.h vms/multi.opt vms/wall.opt
- X
- XBFILES= $(FILES) xprocquery.c
- X
- Xdist: tar shar dcl
- X
- Xshar: archie.doc
- X makekit -narchie. $(FILES) vms > Manifest
- X
- Xarchie.doc: archie.man
- X nroff -man archie.man | tr '\010' _ | sed -e s/__//g > archie.doc
- X
- Xdcl: archie.doc
- X echo '$$ write sys$$output "Unpacking..."' > archie.com
- X echo '$$ if f$$search("archie.dir") .eqs. "" then create/dir [.ARCHIE]' >> archie.com
- X echo '$$ if f$$search("[.ARCHIE]vms.dir") .eqs. "" then create/dir [.ARCHIE.VMS]' >> archie.com
- X echo '$$ set noverify' >> archie.com
- X (cd .. ; dclshar `echo $(FILES) | tr ' ' '\012' |\
- X sed -e "s/^/archie\//g"` >> archie/archie.com )
- X echo '$$ write sys$$output "Ok, now enter the ARCHIE directory and type @MAKE ."' >> archie.com
- X
- Xtar: archie.doc
- X ( cd .. ; tar cvf archie/archie.tar `echo $(FILES) |\
- X tr ' ' '\012' | sed -e "s/^/archie\//g"` )
- X compress -f archie.tar
- X
- Xatest: archie.doc
- X ( cd .. ; tar cvf archie/atest.tar `echo $(BFILES) |\
- X tr ' ' '\012' | sed -e "s/^/archie\//g"` )
- X compress -f atest.tar
- END_OF_FILE
- if test 3798 -ne `wc -c <'./Makefile'`; then
- echo shar: \"'./Makefile'\" unpacked with wrong size!
- fi
- # end of './Makefile'
- fi
- if test -f './README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./README'\"
- else
- echo shar: Extracting \"'./README'\" \(2329 characters\)
- sed "s/^X//" >'./README' <<'END_OF_FILE'
- X[Last changed 11/20/91 v1.2]
- X
- X Enclosed you'll find a Prospero client for the archie service. It'll
- Xlet you query the archie databases without actually using an
- Xinteractive process on the remote server's machine (e.g. archie.sura.net),
- Xresulting in a MUCH better response time. It also helps lessen the
- Xload on the archie server itself.
- X
- X This is a third child of Clifford Neuman's Prospero project. It's really
- Xthe Archie client that's included in the prospero stuff, but I've taken out
- Xeverything that's unnecessary for this client to work. (Aka, you don't
- Xhave to build all of Prospero to get the Archie client.) Khun Yee Fung
- Xwrote an archie client in Perl, and George Ferguson has written a client
- Xfor use with XWindows, based in part upon this code. A curses version is
- Xcurrently being developed to mimic the X client's look and feel.
- X
- X Using the Archie Prospero interface in its true form will probably be of
- Xinterest---check out the file `Prospero' for an example of its interface.
- XIf you find it intriguing, you should probably get the full prospero kit
- Xfrom the University of Washington on cs.washington.edu in pub/prospero.tar.Z.
- X
- X Suffice to say, there are now a number of ways to query Archie without
- Xbogging a server down with your logins.
- X
- X Check out the man page (or archie.doc, if you're using VMS or DOS)
- Xfor instructions on how to use this archie client.
- X
- X Please check to make sure you don't have "archie" aliased or modified
- Xin some way to do a telnet or rlogin (which you may've done before
- Xthis command-line ability came into being).
- X
- X If Archie consistently hangs (at different times of day with
- Xdifferent queries), it's possible that your site has UDP traffic on
- Xports > 1000 blocked, for security reasons. Type `make udptest' to
- Xcheck---if it prints out the date, the Archie server is probably down;
- Xif it doesn't print out the date, either Widener's computer is down
- X(God forbid ;-) ) or you do indeed have UDP blocked. See your system
- Xadministrator in this case. If the problem persists and haven't the
- Xvaguest, then write me describing the situation and what machine/OS
- Xyou're using.
- X
- X Write to archie-l@cs.mcgill.ca with questions about Archie itself.
- X Write to info-prospero@isi.edu about the Prospero protocol.
- X Write to brendan@cs.widener.edu with questions about this specific package.
- END_OF_FILE
- if test 2329 -ne `wc -c <'./README'`; then
- echo shar: \"'./README'\" unpacked with wrong size!
- fi
- # end of './README'
- fi
- if test -f './archie.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./archie.c'\"
- else
- echo shar: Extracting \"'./archie.c'\" \(5837 characters\)
- sed "s/^X//" >'./archie.c' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1991 by the University of Washington
- X *
- X * For copying and distribution information, please see the file
- X * <copyright.h>.
- X *
- X * v1.2.0 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
- X * v1.1.2 - 08/27/91 (bpk) - added <pmachine.h> for index()
- X * v1.1.1 - 08/22/91 (bpk) - added 0-9 as arguments
- X */
- X
- X#include <copyright.h>
- X
- X/*
- X * Archie client using the Prospero protocol.
- X *
- X * Suggestions and improvements to Brendan Kehoe (brendan@cs.widener.edu).
- X */
- X
- X#include <stdio.h>
- X#if defined(OS2)
- X# include <pctcp.h>
- X#endif
- X#if defined(MSDOS)
- X# include <string.h>
- X# include <stdlib.h>
- X#endif
- X
- X#include <pfs.h>
- X#include <rdgram.h>
- X#include <archie.h>
- X#include <pmachine.h>
- X
- Xint listflag = 0;
- Xint sortflag = 0; /* 1 = by date */
- Xchar *progname;
- X#ifdef DEBUG
- Xint pfs_debug = 0;
- X#endif
- Xextern int rdgram_priority;
- X
- Xmain(argc,argv)
- X int argc;
- X char *argv[];
- X {
- X char *cur_arg;
- X char qtype = '='; /* Default to exact string match */
- X char etype = '='; /* Type if only -e is specified */
- X int eflag = 0; /* Exact flag specified */
- X int max_hits = MAX_HITS;
- X int offset = 0;
- X int exitflag = 0; /* Display release identifier */
- X int tmp;
- X char *host = ARCHIE_HOST;
- X static char *archies[] = { ARCHIES };
- X
- X progname = *argv;
- X argc--; argv++;
- X
- X while (argc > 0 && **argv == '-') {
- X cur_arg = argv[0]+1;
- X
- X /* If a - by itself, or --, then no more arguments */
- X if(!*cur_arg || ((*cur_arg == '-') && (!*(cur_arg+1)))) {
- X argc--, argv++;
- X goto scandone;
- X }
- X
- X while (*cur_arg) {
- X switch (*cur_arg++) {
- X#ifdef DEBUG
- X case 'D': /* Debug level */
- X pfs_debug = 1; /* Default debug level */
- X if(*cur_arg && index("0123456789",*cur_arg)) {
- X sscanf(cur_arg,"%d",&pfs_debug);
- X cur_arg += strspn(cur_arg,"0123456789");
- X }
- X else if(argc > 2) {
- X tmp = sscanf(argv[1],"%d",&pfs_debug);
- X if (tmp == 1) {argc--;argv++;}
- X }
- X break;
- X#endif
- X#ifndef XARCHIE
- X case 'L':
- X printf("Known archie servers:\n");
- X for (tmp = 0; tmp < NARCHIES; tmp++)
- X printf("\t%s\n", archies[tmp]);
- X printf("For the most up-to-date list, log into an Archie server & type `servers'.\n");
- X exitflag = 1;
- X break;
- X#endif
- X
- X case 'N': /* Priority (nice) */
- X rdgram_priority = RDGRAM_MAX_PRI; /* Use this if no # */
- X if(*cur_arg && index("-0123456789",*cur_arg)) {
- X sscanf(cur_arg,"%d",&rdgram_priority);
- X cur_arg += strspn(cur_arg,"-0123456789");
- X }
- X else if(argc > 2) {
- X tmp = sscanf(argv[1],"%d",&rdgram_priority);
- X if (tmp == 1) {argc--;argv++;}
- X }
- X if(rdgram_priority > RDGRAM_MAX_SPRI)
- X rdgram_priority = RDGRAM_MAX_PRI;
- X if(rdgram_priority < RDGRAM_MIN_PRI)
- X rdgram_priority = RDGRAM_MIN_PRI;
- X break;
- X
- X case 'c': /* substring (case sensitive) */
- X qtype = 'C';
- X etype = 'c';
- X break;
- X
- X case 'e': /* Exact match */
- X /* If -e specified by itself, then we use the */
- X /* default value of etype which must be '=' */
- X eflag++;
- X break;
- X
- X case 'h': /* Host */
- X host = argv[1];
- X argc--; argv++;
- X break;
- X
- X case 'l': /* List one match per line */
- X listflag++;
- X break;
- X
- X case '0': case '1': case '2': case '3': case '4':
- X case '5': case '6': case '7': case '8': case '9':
- X cur_arg--;
- X case 'm': /* Max hits */
- X max_hits = -1;
- X if(*cur_arg && index("0123456789",*cur_arg)) {
- X sscanf(cur_arg,"%d",&max_hits);
- X cur_arg += strspn(cur_arg,"0123456789");
- X }
- X else if(argc > 1) {
- X tmp = sscanf(argv[1],"%d",&max_hits);
- X if (tmp == 1) {argc--;argv++;}
- X }
- X if (max_hits < 1) {
- X fprintf(stderr, "%s: -m option requires a value for max hits (>= 1)\n",
- X progname);
- X#ifdef VMS
- X exit(SS$_NORMAL); /* we already did the error above */
- X#else
- X exit(1);
- X#endif
- X }
- X break;
- X
- X case 'o': /* Offset */
- X if(argc > 1) {
- X tmp = sscanf(argv[1],"%d",&offset);
- X if (tmp != 1)
- X argc = -1;
- X else {
- X argc--; argv++;
- X }
- X }
- X break;
- X
- X case 'r': /* Regular expression search */
- X qtype = 'R';
- X etype = 'r';
- X break;
- X
- X case 's': /* substring (case insensitive) */
- X qtype = 'S';
- X etype = 's';
- X break;
- X
- X case 't': /* Sort inverted by date */
- X sortflag = 1;
- X break;
- X
- X case 'v': /* Display version */
- X fprintf(stderr,
- X "Client version %s based upon Prospero version %s\n",
- X CLIENT_VERSION, PFS_RELEASE);
- X exitflag++;
- X break;
- X
- X default:
- X fprintf(stderr,"Usage: %s [-[cers][l][t][m #][h host][L][N#]] string\n", progname);
- X#ifdef VMS
- X exit(SS$_NORMAL); /* we already did the error above */
- X#else
- X exit(1);
- X#endif
- X }
- X }
- X argc--; argv++;
- X }
- X
- X scandone:
- X
- X if (eflag) qtype = etype;
- X
- X if ((argc != 1) && exitflag) exit(0);
- X
- X if (argc != 1) {
- X fprintf(stderr, "Usage: %s [-[cers][l][t][m #][h host][L][N#]] string\n", progname);
- X fprintf(stderr," -c : case sensitive substring search\n");
- X fprintf(stderr," -e : exact string match (default)\n");
- X fprintf(stderr," -r : regular expression search\n");
- X fprintf(stderr," -s : case insensitive substring search\n");
- X fprintf(stderr," -l : list one match per line\n");
- X fprintf(stderr," -t : sort inverted by date\n");
- X fprintf(stderr," -m # : specifies maximum number of hits to return (default %d)\n", max_hits);
- X fprintf(stderr," -h host : specifies server host\n");
- X fprintf(stderr," -L : list known servers\n");
- X fprintf(stderr," -N# : specifies query niceness level (0-35765)\n");
- X#ifdef VMS
- X exit(SS$_NORMAL); /* we already did the error above */
- X#else
- X exit(1);
- X#endif
- X }
- X
- X procquery(host, argv[0], max_hits, offset, qtype, sortflag, listflag);
- X
- X exit(0);
- X }
- END_OF_FILE
- if test 5837 -ne `wc -c <'./archie.c'`; then
- echo shar: \"'./archie.c'\" unpacked with wrong size!
- fi
- # end of './archie.c'
- fi
- if test -f './archie.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./archie.doc'\"
- else
- echo shar: Extracting \"'./archie.doc'\" \(7215 characters\)
- sed "s/^X//" >'./archie.doc' <<'END_OF_FILE'
- X
- X
- X
- XARCHIE(1) USER COMMANDS ARCHIE(1)
- X
- X
- X
- XNAME
- X archie - query the Archie anonymous FTP databases using
- X Prospero
- X
- XSYNOPSIS
- X archie [ -cers ] [ -l ] [ -t ] [ -m# ] [ -N# ] [ -h host ] [ -L ] string
- X
- XDESCRIPTION
- X archie queries an archie anonymous FTP database looking for
- X the specified string using the Prospero protocol. This
- X client is based on Prospero version Beta.4.2 and is provided
- X to encourage non-interactive use of the Archie servers (and
- X subsequently better performance on both sides).
- X
- X The general method of use is of the form
- X
- X % archie string
- X
- X This will go to the archie server and ask it to look for all
- X known systems that have a file named `string' in their FTP
- X area. archie will wait, and print out any matches.
- X
- X For example,
- X
- X % archie emacs
- X
- X will find all anonymous FTP sites in the archie database
- X that have files named emacs somewhere in their FTP area.
- X (This particular query would probably return a lot of direc-
- X tories.) If you want a list of every filename that contains
- X emacs anywhere in it, you'd use
- X
- X % archie -c emacs
- X
- X Regular expressions, such as
- X
- X % archie -r '[xX][lL]isp'
- X
- X may also be used for searches. (See the manual of a reason-
- X ably good editor, like GNU Emacs or vi, for more information
- X on using regular expressions.)
- X
- X
- XOPTIONS
- X The options currently available to this archie client are:
- X
- X -c Search substrings paying attention to upper &
- X lower case.
- X -e Exact string match. (This is the default.)
- X -r Search using a regular expression.
- X -s Search substrings ignoring the case of the
- X letters.
- X
- X
- X
- XArchie (Prospero) Last change: 20 November 1991 1
- X
- X
- X
- X
- X
- X
- XARCHIE(1) USER COMMANDS ARCHIE(1)
- X
- X
- X
- X -l Output results in a form suitable for parsing by
- X programs.
- X -t Sort the results inverted by date.
- X -m# Specifies the maximum number of hits (matches)
- X to return (default of 95).
- X -N# Sets the niceness of a query; by default, it's
- X set to 0. Without an argument, -N defaults to
- X 35765. If you use -N with an argument between 0
- X and 35765, it'll adjust itself accordingly.
- X (Note: VMS users will have to put quotes around
- X this argument, and -L, like ``-N45''; VMS will
- X otherwise convert it to lowercase.)
- X -h host Tells the client to query the Archie server
- X named host.
- X -L Lists the Archie servers known to the program
- X when it was compiled.
- X
- X Quick Hits
- X You'll often find yourself making fast and furious queries
- X for multiple things that all look similar (e.g. `telnet',
- X `net', etc). If you get into the habit of using the -c
- X option when performing these kinds of searches, they'll
- X often prove more fruitful than if you relied upon the
- X default of -e.
- X
- X Notes
- X The three search-modifying arguments (-c, -r, and -s) are
- X all mutually exclusive; only the last one counts. If you
- X specify -e with any of -c, -r, or -s, the server will first
- X check for an exact match, then fall back to the case-
- X sensitive, case-insensitive, or regular expression search.
- X This is so if there are matches that are particularly obvi-
- X ous, it will take a minimal amount of time to satisfy your
- X request.
- X
- X If you list a single `-' by itself, any further arguments
- X will be taken as part of the search string. This is
- X intended to enable searching for strings that begin with a
- X `-'; for example:
- X
- X % archie -s - -old
- X
- X will search for all filenames that contain the string `-old'
- X in them.
- X
- XRESPONSE
- X Archie servers are set up to respond to a number of requests
- X in a queued fashion. That is, smaller requests get served
- X much more quickly than do large requests. As a result, the
- X more often you query the Archie server, or the larger your
- X requests, the longer the queue will become, resulting in a
- X longer waiting period for everyone's requests. Please be
- X
- X
- X
- XArchie (Prospero) Last change: 20 November 1991 2
- X
- X
- X
- X
- X
- X
- XARCHIE(1) USER COMMANDS ARCHIE(1)
- X
- X
- X
- X frugal when possible, for your benefit as well as for the
- X other users.
- X
- XQUERY PRIORITY
- X Please use the -N option whenever you don't demand immedi-
- X acy, or when you're requesting things that could generate
- X large responses. Even when using the nice option, you
- X should still try to avoid big jobs during busy periods.
- X Here is a list of what we consider to be nice values that
- X accurately reflect the priority of a job to the server.
- X
- X Normal 0
- X Nice 500
- X Nicer 1000
- X Very Nice 5000
- X Extremely Nice 10000
- X Nicest 32765
- X
- X The last priority, Nicest, would be used when a job should
- X wait until the queue is essentially empty before running.
- X You should pick one of these values to use, possibly modify-
- X ing it slightly depending on where you think your priority
- X should land. For example, 32760 would mean wait until the
- X queue is empty, but jump ahead of other jobs that have
- X selected Nicest.
- X
- X There are certain types of things that we suggest using
- X Nicest for, irregardless. In particular, any searches for
- X which you would have a hard time justifying the use of any-
- X thing but extra resources. (We all know what those searches
- X would be for.)
- X
- XSEE ALSO
- X For more information on regular expressions, see the manual
- X pages on:
- X
- X regex(3), ed(1)
- X
- X Also read the file archie/whatis on archie.mcgill.ca for a
- X detailed paper on Archie as a whole.
- X
- XAUTHORS
- X The archie service was conceived and implemented by Alan
- X Emtage (bajan@cs.mcgill.ca), Peter Deutsch
- X (peterd@cs.mcgill.ca), and Bill Heelan
- X (wheelan@cs.mcgill.ca). The entire Internet is in their
- X debt.
- X
- X The Prospero system was created by Clifford Neuman
- X (bcn@isi.edu); write to info-prospero@isi.edu for more
- X information on the protocol and its use.
- X
- X
- X
- X
- XArchie (Prospero) Last change: 20 November 1991 3
- X
- X
- X
- X
- X
- X
- XARCHIE(1) USER COMMANDS ARCHIE(1)
- X
- X
- X
- X This stripped client was put together by Brendan Kehoe
- X (brendan@cs.widener.edu), with modifications by Clifford
- X Neuman and George Ferguson (ferguson@cs.rochester.edu).
- X
- XBUGS
- X There are none; only a few unexpected features.
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- XArchie (Prospero) Last change: 20 November 1991 4
- X
- X
- X
- END_OF_FILE
- if test 7215 -ne `wc -c <'./archie.doc'`; then
- echo shar: \"'./archie.doc'\" unpacked with wrong size!
- fi
- # end of './archie.doc'
- fi
- if test -f './archie.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./archie.man'\"
- else
- echo shar: Extracting \"'./archie.man'\" \(6161 characters\)
- sed "s/^X//" >'./archie.man' <<'END_OF_FILE'
- X.\" Originally by Jeff Kellem
- X.\"
- X.TH ARCHIE 1 "20 November 1991" "Archie (Prospero)"
- X.SH NAME
- Xarchie \- query the Archie anonymous FTP databases using Prospero
- X.SH SYNOPSIS
- X.in +\w'\fBarchie \fR'u
- X.ti -\w'\fBarchie \fR'u
- X.B archie\
- X\ [\ \fB\-cers\fR\ ]\
- X\ [\ \fB\-l\fR\ ]\ [\ \fB\-t\fR\ ]\
- X\ [\ \fB\-m#\fR\ ]\ [\ \fB\-N#\fR\ ]\
- X\ [\ \fB\-h\fR\ \fIhost\fR\ ]\ [\ \fB\-L\fR\ ]\ \fIstring\fR
- X.SH DESCRIPTION
- X.B archie
- Xqueries an archie anonymous FTP database looking for the specified
- X.I string
- Xusing the
- X.B Prospero
- Xprotocol. This client is based on
- X.B Prospero
- Xversion Beta.4.2 and is provided to encourage non-interactive use of
- Xthe Archie servers (and subsequently better performance on both
- Xsides).
- X
- XThe general method of use is of the form
- X
- X.RS
- X%
- X.B archie string
- X.RE
- X.PP
- X
- XThis will go to the archie server and ask it to look for all known
- Xsystems that have a file named `string' in their FTP area. \fBarchie\fP
- Xwill wait, and print out any matches.
- X
- XFor example,
- X
- X.RS
- X%
- X.B archie emacs
- X.RE
- X.PP
- X
- Xwill find all anonymous FTP sites in the archie database that have files
- Xnamed
- X.B emacs
- Xsomewhere in their FTP area. (This particular query would probably
- Xreturn a lot of directories.) If you want a list of every filename
- Xthat contains \fBemacs\fR \fIanywhere\fR in it, you'd use
- X
- X.RS
- X%
- X.B archie -c emacs
- X.RE
- X.PP
- X
- XRegular expressions, such as
- X
- X.RS
- X%
- X.B archie -r '[xX][lL]isp'
- X.RE
- X.PP
- X
- Xmay also be used for searches. (See the manual of a reasonably good
- Xeditor, like GNU Emacs or vi, for more information on using regular
- Xexpressions.)
- X
- X.SH OPTIONS
- XThe options currently available to this
- X.B archie
- Xclient are:
- X
- X.PD 0
- X.TP 12
- X.BR \-c
- XSearch substrings paying attention to upper & lower case.
- X.TP
- X.BR \-e
- XExact string match. (This is the default.)
- X.TP
- X.BR \-r
- XSearch using a regular expression.
- X.TP
- X.BR \-s
- XSearch substrings ignoring the case of the letters.
- X.TP
- X.BR \-l
- XOutput results in a form suitable for parsing by programs.
- X.TP
- X.BR \-t
- XSort the results inverted by date.
- X.TP
- X.BI \-m#
- XSpecifies the maximum number of hits (matches) to return (default of
- X\fB95\fR).
- X.TP
- X.BI \-N#
- XSets the \fIniceness\fR of a query; by default, it's set to 0.
- XWithout an argument, \fB\-N\fR defaults to \fB35765\fR. If you use
- X\fB\-N\fR with an argument between 0 and 35765, it'll adjust itself
- Xaccordingly. (\fBNote\fR: VMS users will have to put quotes around
- Xthis argument, and \fB\-L\fR, like ``\fB\-N45\fR''; VMS will otherwise convert
- Xit to lowercase.)
- X.TP
- X.BI \-h\ \fIhost\fR
- XTells the client to query the Archie server named \fIhost\fR.
- X.TP
- X.BI \-L
- XLists the Archie servers known to the program when it was compiled.
- X
- X.PP
- X
- X.SS Quick Hits
- XYou'll often find yourself making fast and furious queries for
- Xmultiple things that all look similar (e.g. `telnet', `net', etc). If
- Xyou get into the habit of using the
- X.BR \-c
- Xoption when performing these kinds of searches, they'll often prove
- Xmore fruitful than if you relied upon the default of
- X.BR \-e .
- X
- X.SS Notes
- XThe three search-modifying arguments (\fB\-c\fR, \fB\-r\fB, and \fB\-s\fR)
- Xare all mutually exclusive; only the last one counts. If you specify
- X\fB\-e\fR with any of \fB\-c\fR, \fB\-r\fB, or \fB\-s\fR,
- Xthe server will first check for an exact match, then fall back to the
- Xcase-sensitive, case-insensitive, or regular expression search. This is
- Xso if there are matches that are particularly obvious, it will take a
- Xminimal amount of time to satisfy your request.
- X
- XIf you list a single `\-' by itself, any further arguments will be
- Xtaken as part of the search string. This is intended to enable
- Xsearching for strings that begin with a `\-'; for example:
- X
- X.RS
- X%
- X.B archie \-s \- \-old
- X.RE
- X
- Xwill search for all filenames that contain the string `\-old' in them.
- X
- X.SH RESPONSE
- XArchie servers are set up to respond to a number of requests in a
- Xqueued fashion. That is, smaller requests get served much more
- Xquickly than do large requests. As a result, the more often you query
- Xthe Archie server, or the larger your requests, the longer the queue
- Xwill become, resulting in a longer waiting period for everyone's
- Xrequests. Please be frugal when possible, for your benefit as well as
- Xfor the other users.
- X
- X.SH QUERY PRIORITY
- XPlease use the \fB\-N\fR option whenever you don't demand immediacy, or
- Xwhen you're requesting things that could generate large responses.
- XEven when using the nice option, you should still try to avoid big
- Xjobs during busy periods. Here is a list of what we consider to be
- Xnice values that accurately reflect the priority of a job to the server.
- X
- X.RS
- X.TP 20
- X.B Normal
- X0
- X.TP
- X.B Nice
- X500
- X.TP
- X.B Nicer
- X1000
- X.TP
- X.B Very Nice
- X5000
- X.TP
- X.B Extremely Nice
- X10000
- X.TP
- X.B Nicest
- X32765
- X.RE
- X
- XThe last priority, \fBNicest\fR, would be used when a job should wait until
- Xthe queue is essentially empty before running. You should pick one of
- Xthese values to use, possibly modifying it slightly depending on where
- Xyou think your priority should land. For example, 32760 would mean
- Xwait until the queue is empty, but jump ahead of other jobs that have
- Xselected \fBNicest\fR.
- X
- XThere are certain types of things that we suggest using \fBNicest\fR
- Xfor, irregardless. In particular, any searches for which you would
- Xhave a hard time justifying the use of anything but extra resources.
- X(We all know what those searches would be for.)
- X
- X.SH SEE ALSO
- XFor more information on regular expressions, see the manual pages on:
- X
- X.BR regex (3) ,
- X.BR ed (1)
- X
- XAlso read the file \fBarchie/whatis\fR on \fBarchie.mcgill.ca\fR for a
- Xdetailed paper on Archie as a whole.
- X
- X.SH AUTHORS
- XThe
- X.B archie
- Xservice was conceived and implemented by Alan Emtage (\fBbajan@cs.mcgill.ca\fR),
- XPeter Deutsch (\fBpeterd@cs.mcgill.ca\fR), and Bill Heelan
- X(\fBwheelan@cs.mcgill.ca\fR). The entire Internet is in their debt.
- X
- XThe \fBProspero\fR system was created by Clifford Neuman
- X(\fBbcn@isi.edu\fR); write to \fBinfo\-prospero@isi.edu\fR for more
- Xinformation on the protocol and its use.
- X
- XThis stripped client was put together by Brendan Kehoe
- X(\fBbrendan@cs.widener.edu\fR), with modifications by
- XClifford Neuman and George Ferguson (\fBferguson@cs.rochester.edu\fR).
- X
- X.SH BUGS
- XThere are none; only a few unexpected features.
- X
- END_OF_FILE
- if test 6161 -ne `wc -c <'./archie.man'`; then
- echo shar: \"'./archie.man'\" unpacked with wrong size!
- fi
- # end of './archie.man'
- fi
- if test -f './get_pauth.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./get_pauth.c'\"
- else
- echo shar: Extracting \"'./get_pauth.c'\" \(2220 characters\)
- sed "s/^X//" >'./get_pauth.c' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1989, 1990 by the University of Washington
- X *
- X * For copying and distribution information, please see the file
- X * <copyright.h>.
- X *
- X * v1.2.2 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
- X * v1.2.1 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
- X * v1.2.0 - 09/17/91 (bpk) - fixed it up (thanks to synful)
- X * v1.1.1 - 08/30/91 (bpk) - added VMS support
- X */
- X
- X#include <copyright.h>
- X#include <stdio.h>
- X#ifndef VMS
- X# include <sys/types.h> /* this may/will define FD_SET etc */
- X# include <pmachine.h>
- X#endif
- X
- X#ifdef NEED_STRING_H
- X# include <string.h>
- X#else
- X# include <strings.h>
- X#endif
- X
- X#ifndef VMS
- X# if defined(MSDOS) && !defined(OS2)
- X# include <rwconf.h>
- X# else
- X# include <pwd.h>
- X# endif
- X#else
- X# include <jpidef.h>
- X# include <vms.h>
- X#endif
- X
- X#include <pcompat.h>
- X#include <pauthent.h>
- X
- XPAUTH
- Xget_pauth(type)
- X int type;
- X {
- X static PAUTH_ST no_auth_st;
- X static PAUTH no_auth = NULL;
- X#if !defined(VMS) && !defined(MSDOS) || defined(OS2)
- X struct passwd *whoiampw;
- X#else
- X char username[13];
- X unsigned short usernamelen;
- X struct {
- X unsigned short buflen;
- X unsigned short itmcod;
- X char *bufadr;
- X unsigned short *retlenadr;
- X unsigned long null;
- X } jpi_itemlist;
- X#endif
- X
- X if(no_auth == NULL) {
- X no_auth = &no_auth_st;
- X strcpy(no_auth->auth_type,"UNAUTHENTICATED");
- X
- X /* find out who we are */
- X#ifndef VMS
- X#if defined(MSDOS) && !defined(OS2)
- X if (!getconf("general", "user", no_auth->authenticator, 250)
- X || (strlen (no_auth->authenticator) == 0))
- X strcpy(no_auth->authenticator,"nobody");
- X#else /* not MSDOS */
- X DISABLE_PFS(whoiampw = getpwuid(getuid()));
- X if (whoiampw == 0) strcpy(no_auth->authenticator,"nobody");
- X else strcpy(no_auth->authenticator, whoiampw->pw_name);
- X#endif /* not MSDOS */
- X#else
- X jpi_itemlist.buflen = sizeof(username);
- X jpi_itemlist.itmcod = JPI$_USERNAME;
- X jpi_itemlist.bufadr = &username;
- X jpi_itemlist.retlenadr = &usernamelen;
- X jpi_itemlist.null = 0;
- X if (SYS$GETJPI(0, 0, 0, &jpi_itemlist, 0, 0, 0) & 0x1)
- X {
- X username[usernamelen] = 0;
- X strcpy(no_auth->authenticator, username);
- X } else
- X strcpy(no_auth->authenticator, "nobody");
- X#endif
- X }
- X return(no_auth);
- X }
- END_OF_FILE
- if test 2220 -ne `wc -c <'./get_pauth.c'`; then
- echo shar: \"'./get_pauth.c'\" unpacked with wrong size!
- fi
- # end of './get_pauth.c'
- fi
- if test -f './perrno.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./perrno.h'\"
- else
- echo shar: Extracting \"'./perrno.h'\" \(4624 characters\)
- sed "s/^X//" >'./perrno.h' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1989, 1990 by the University of Washington
- X *
- X * For copying and distribution information, please see the file
- X * <copyright.h>.
- X */
- X
- X#include <copyright.h>
- X
- X/* this file and p_err_text.c should be updated simultaneously */
- X
- X/*
- X * perrno.h - definitions for perrno
- X *
- X * This file contains the declarations and defintions of of the external
- X * error values in which errors are returned by the pfs and psrv
- X * libraries.
- X */
- X
- X#define P_ERR_STRING_SZ 100 /* Size of error string */
- X
- Xextern int perrno;
- Xextern char p_err_string[];
- Xextern char *p_err_text[];
- X
- Xextern int pwarn;
- Xextern char p_warn_string[];
- Xextern char *p_warn_text[];
- X
- X/* Error codes returned or found in verrno */
- X
- X#ifndef PSUCCESS
- X#define PSUCCESS 0
- X#endif
- X
- X/* dirsend (perrno) */
- X#define DIRSEND_PORT_UNKN 1 /* DIRSRV UDP port unknown */
- X#define DIRSEND_UDP_CANT 2 /* Can't open local UDP port */
- X#define DIRSEND_BAD_HOSTNAME 3 /* Can't resolve hostname */
- X#define DIRSEND_NOT_ALL_SENT 4 /* Didn't send entire message */
- X#define DIRSEND_SELECT_FAILED 5 /* Select failed */
- X#define DIRSEND_BAD_RECV 6 /* Recvfrom failed */
- X
- X/* reply */
- X#define REPLY_NOTSENT 11 /* Reply: sendto failed */
- X
- X/* vl_insert */
- X#define VL_INSERT_ALREADY_THERE 21 /* Link already exists */
- X#define VL_INSERT_CONFLICT 22 /* Link exists with same name */
- X
- X/* ul_insert */
- X#define UL_INSERT_ALREADY_THERE 25 /* Link already exists */
- X#define UL_INSERT_SUPERSEDING 26 /* Replacing existing link */
- X#define UL_INSERT_POS_NOTFOUND 27 /* Prv entry not in dir->ulinks */
- X
- X/* rd_vdir */
- X#define RVD_DIR_NOT_THERE 41 /* Temporary NOT_FOUND */
- X#define RVD_NO_CLOSED_NS 42 /* Namespace not closed w/ object:: */
- X#define RVD_NO_NS_ALIAS 43 /* No alias for namespace NS#: */
- X#define RVD_NS_NOT_FOUND 44 /* Specified namespace not found */
- X
- X/* pfs_access */
- X#define PFSA_AM_NOT_SUPPORTED 51 /* Access method not supported */
- X
- X/* pmap_cache */
- X#define PMC_DELETE_ON_CLOSE 55 /* Delete cached copy on close */
- X#define PMC_RETRIEVE_FAILED 56 /* Unable to retrieve file */
- X
- X/* mk_vdir */
- X/* #define MKVD_ALREADY_EXISTS 61 /* Directory already exists */
- X/* #define MKVD_NAME_CONFLICT 62 /* Link with name already exists */
- X
- X/* vfsetenv */
- X#define VFSN_NOT_A_VS 65 /* Not a virtual system */
- X#define VFSN_CANT_FIND_DIR 66 /* Not a virtual system */
- X
- X/* add_vlink */
- X/* #define ADDVL_ALREADY_EXISTS 71 /* Directory already exists */
- X/* #define ADDVL_NAME_CONFLICT 72 /* Link with name already exists */
- X
- X/* Local error codes on server */
- X
- X/* dsrdir */
- X#define DSRDIR_NOT_A_DIRECTORY 111 /* Not a directory name */
- X/* dsrfinfo */
- X#define DSRFINFO_NOT_A_FILE 121 /* Object not found */
- X#define DSRFINFO_FORWARDED 122 /* Object has moved */
- X
- X/* Error codes that may be returned by various procedures */
- X#define PFS_FILE_NOT_FOUND 230 /* File not found */
- X#define PFS_DIR_NOT_FOUND 231 /* Directory in path not found */
- X#define PFS_SYMLINK_DEPTH 232 /* Max sym-link depth exceeded */
- X#define PFS_ENV_NOT_INITIALIZED 233 /* Can't read environment */
- X#define PFS_EXT_USED_AS_DIR 234 /* Can't use externals as dirs */
- X#define PFS_MAX_FWD_DEPTH 235 /* Exceeded max forward depth */
- X
- X/* Error codes returned by directory server */
- X/* some of these duplicate errors from individual routines */
- X/* some of those error codes should be eliminated */
- X#define DIRSRV_AUTHENT_REQ 242 /* Authentication required */
- X#define DIRSRV_NOT_AUTHORIZED 243 /* Not authorized */
- X#define DIRSRV_NOT_FOUND 244 /* Not found */
- X#define DIRSRV_BAD_VERS 245
- X#define DIRSRV_NOT_DIRECTORY 246
- X#define DIRSRV_ALREADY_EXISTS 247 /* Identical link already exists */
- X#define DIRSRV_NAME_CONFLICT 248 /* Link with name already exists */
- X
- X#define DIRSRV_UNIMPLEMENTED 251 /* Unimplemented command */
- X#define DIRSRV_BAD_FORMAT 252
- X#define DIRSRV_ERROR 253
- X#define DIRSRV_SERVER_FAILED 254 /* Unspecified server failure */
- X
- X#ifndef PFAILURE
- X#define PFAILURE 255
- X#endif
- X
- X/* Warning codes */
- X
- X#define PNOWARN 0 /* No warning indicated */
- X#define PWARN_OUT_OF_DATE 1 /* Software is out of date */
- X#define PWARN_MSG_FROM_SERVER 2 /* Warning in p_warn_string */
- X#define PWARN_UNRECOGNIZED_RESP 3 /* Unrecognized line in response */
- X#define PWARNING 255 /* Warning in p_warn_string */
- END_OF_FILE
- if test 4624 -ne `wc -c <'./perrno.h'`; then
- echo shar: \"'./perrno.h'\" unpacked with wrong size!
- fi
- # end of './perrno.h'
- fi
- if test -f './procquery.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./procquery.c'\"
- else
- echo shar: Extracting \"'./procquery.c'\" \(5736 characters\)
- sed "s/^X//" >'./procquery.c' <<'END_OF_FILE'
- X/*
- X * procquery.c : Routines for processing results from Archie
- X *
- X * Originally part of the Prospero Archie client by Cliff Neuman (bcn@isi.edu).
- X * Modified by Brendan Kehoe (brendan@cs.widener.edu).
- X * Re-modified by George Ferguson (ferguson@cs.rochester.edu).
- X *
- X * Copyright (c) 1991 by the University of Washington
- X *
- X * For copying and distribution information, please see the file
- X * <copyright.h>.
- X *
- X * v1.2.2 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
- X * v1.2.1 - 10/18/91 (bpk) - warning stuff
- X * v1.2.0 - 09/20/91 (bpk) - VMS under Multinet 3.0 too
- X * v1.1.1 - 08/20/91 (bpk) - took out archie_query from error msg
- X */
- X#include <copyright.h>
- X#include <stdio.h>
- X#include <pfs.h>
- X#include <perrno.h>
- X#include <pmachine.h>
- X#include <archie.h>
- X
- X#ifdef NEED_TIME_H
- X# include <time.h>
- X#else
- X# ifndef VMS
- X# include <sys/time.h>
- X# endif
- X#endif
- X
- Xextern int client_dirsrv_timeout,client_dirsrv_retry; /* dirsend.c */
- Xextern char *progname;
- X
- X
- X/*
- X * Functions defined here
- X */
- Xvoid display_link(), procquery();
- X
- X/*
- X * Data defined here
- X */
- Xextern int pwarn, perrno;
- Xint pfs_debug;
- Xstatic struct tm *presenttime;
- Xstatic char lastpath[MAX_VPATH] = "\001";
- Xstatic char lasthost[MAX_VPATH] = "\001";
- X
- X/* - - - - - - - - */
- X/*
- X * display_link : Prints the contents of the given virtual link. If
- X * listflag is 0, then this uses last{host,path} to save state
- X * between calls for a less verbose output. If listflag is non-zero
- X * then all information is printed every time.
- X */
- Xvoid
- Xdisplay_link(l,listflag)
- XVLINK l;
- Xint listflag;
- X{
- X PATTRIB ap;
- X char linkpath[MAX_VPATH];
- X int dirflag = 0;
- X#ifdef MSDOS
- X unsigned long size = 0L;
- X#else
- X int size = 0;
- X#endif
- X char *modes = "";
- X char archie_date[20];
- X char *gt_date = "";
- X int gt_year = 0;
- X int gt_mon = 0;
- X int gt_day = 0;
- X int gt_hour = 0;
- X int gt_min = 0;
- X
- X /* Initialize local buffers */
- X *archie_date = '\0';
- X
- X /* Remember if we're looking at a directory */
- X if (sindex(l->type,"DIRECTORY"))
- X dirflag = 1;
- X else
- X dirflag = 0;
- X
- X /* Extract the linkpath from the filename */
- X strcpy(linkpath,l->filename);
- X *(linkpath + (strlen(linkpath) - strlen(l->name) - 1)) = '\0';
- X
- X /* Is this a new host? */
- X if (strcmp(l->host,lasthost) != 0) {
- X if (!listflag)
- X printf("\nHost %s\n\n",l->host);
- X strcpy(lasthost,l->host);
- X *lastpath = '\001';
- X }
- X
- X /* Is this a new linkpath (location)? */
- X if(strcmp(linkpath,lastpath) != 0) {
- X if (!listflag)
- X printf(" Location: %s\n",(*linkpath ? linkpath : "/"));
- X strcpy(lastpath,linkpath);
- X }
- X
- X /* Parse the attibutes of this link */
- X for (ap = l->lattrib; ap; ap = ap->next) {
- X if (strcmp(ap->aname,"SIZE") == 0) {
- X#ifdef MSDOS
- X sscanf(ap->value.ascii,"%lu",&size);
- X#else
- X sscanf(ap->value.ascii,"%d",&size);
- X#endif
- X } else if(strcmp(ap->aname,"UNIX-MODES") == 0) {
- X modes = ap->value.ascii;
- X } else if(strcmp(ap->aname,"LAST-MODIFIED") == 0) {
- X gt_date = ap->value.ascii;
- X sscanf(gt_date,"%4d%2d%2d%2d%2d",>_year,
- X >_mon, >_day, >_hour, >_min);
- X if ((12 * (presenttime->tm_year + 1900 - gt_year) +
- X presenttime->tm_mon - gt_mon) > 6)
- X sprintf(archie_date,"%s %2d %4d",month_sname(gt_mon),
- X gt_day, gt_year);
- X else
- X sprintf(archie_date,"%s %2d %02d:%02d",month_sname(gt_mon),
- X gt_day, gt_hour, gt_min);
- X }
- X }
- X
- X /* Print this link's information */
- X if (listflag)
- X#if defined(MSDOS)
- X printf("%s %6lu %s %s%s\n",gt_date,size,l->host,l->filename,
- X (dirflag ? "/" : ""));
- X#else
- X printf("%s %6d %s %s%s\n",gt_date,size,l->host,l->filename,
- X (dirflag ? "/" : ""));
- X#endif
- X else
- X#ifdef MSDOS
- X printf(" %9s %s %10lu %s %s\n",(dirflag ? "DIRECTORY" : "FILE"),
- X modes,size,archie_date,l->name);
- X#else
- X printf(" %9s %s %10d %s %s\n",(dirflag ? "DIRECTORY" : "FILE"),
- X modes,size,archie_date,l->name);
- X#endif /* MSDOS */
- X
- X
- X /* Free the attibutes */
- X atlfree(l->lattrib);
- X l->lattrib = NULL;
- X}
- X
- X/* - - - - - - - - */
- X/*
- X * procquery : Process the given query and display the results. If
- X * sortflag is non-zero, then the results are sorted by increasing
- X * date, else by host/filename. If listflag is non-zero then each
- X * entry is printed on a separate, complete line. Note that listflag
- X * is ignored by xarchie.
- X */
- Xvoid
- Xprocquery(host,str,max_hits,offset,query_type,sortflag,listflag)
- Xchar *host,*str;
- Xint max_hits,offset;
- Xchar query_type;
- Xint sortflag,listflag;
- X{
- X VLINK l;
- X long now;
- X extern int rdgram_priority;
- X
- X /* initialize data structures for this query */
- X (void)time(&now);
- X presenttime = localtime(&now);
- X
- X /* Do the query */
- X if (sortflag == 1)
- X l = archie_query(host,str,max_hits,offset,query_type,AQ_INVDATECMP,0);
- X else
- X l = archie_query(host,str,max_hits,offset,query_type,NULL,0);
- X
- X /* Error? */
- X if (perrno != PSUCCESS) {
- X if (p_err_text[perrno]) {
- X if (*p_err_string)
- X fprintf(stderr, "%s: failed: %s - %s\n", progname,
- X p_err_text[perrno], p_err_string);
- X else
- X fprintf(stderr, "%s failed: %s\n", progname, p_err_text[perrno]);
- X } else
- X fprintf(stderr, "%s failed: Undefined error %d (prospero)", perrno);
- X }
- X
- X /* Warning? */
- X if (pwarn != PNOWARN) {
- X if (*p_warn_string)
- X fprintf(stderr, "%s: Warning! %s - %s\n", progname,
- X p_warn_text[pwarn], p_warn_string);
- X else
- X fprintf(stderr, "%s: Warning! %s\n", progname, p_warn_text[pwarn]);
- X }
- X
- X
- X /* Display the results */
- X
- X if (l == (VLINK)NULL && pwarn == PNOWARN && perrno == PSUCCESS) {
- X if (! listflag) puts ("No matches.");
- X exit (1);
- X }
- X
- X *lasthost = '\001';
- X *lastpath = '\001';
- X while (l != NULL) {
- X display_link(l,listflag);
- X l = l->next;
- X }
- X}
- END_OF_FILE
- if test 5736 -ne `wc -c <'./procquery.c'`; then
- echo shar: \"'./procquery.c'\" unpacked with wrong size!
- fi
- # end of './procquery.c'
- fi
- if test -f './stcopy.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./stcopy.c'\"
- else
- echo shar: Extracting \"'./stcopy.c'\" \(2207 characters\)
- sed "s/^X//" >'./stcopy.c' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1989, 1990, 1991 by the University of Washington
- X *
- X * For copying and distribution information, please see the file
- X * <copyright.h>.
- X *
- X * v1.2.1 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
- X * v1.2.0 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
- X */
- X
- X#include <copyright.h>
- X#include <stdio.h>
- X#include <pmachine.h>
- X
- X#ifdef NEED_STRING_H
- X# include <string.h>
- X#else
- X# include <strings.h>
- X#endif
- X
- X#if defined(MSDOS)
- X# include <stdlib.h>
- X#endif
- X
- Xchar *stcopyr();
- X
- Xint string_count = 0;
- Xint string_max = 0;
- X
- X/*
- X * stcopy - allocate space for and copy a string
- X *
- X * STCOPY takes a string as an argument, allocates space for
- X * a copy of the string, copies the string to the allocated space,
- X * and returns a pointer to the copy.
- X */
- X
- Xchar *
- Xstcopy(st)
- X char *st;
- X {
- X if (!st) return(NULL);
- X if (string_max < ++string_count) string_max = string_count;
- X
- X return strcpy((char *)malloc(strlen(st) + 1), st);
- X }
- X
- X/*
- X * stcopyr - copy a string allocating space if necessary
- X *
- X * STCOPYR takes a string, S, as an argument, and a pointer to a second
- X * string, R, which is to be replaced by S. If R is long enough to
- X * hold S, S is copied. Otherwise, new space is allocated, and R is
- X * freed. S is then copied to the newly allocated space. If S is
- X * NULL, then R is freed and NULL is returned.
- X *
- X * In any event, STCOPYR returns a pointer to the new copy of S,
- X * or a NULL pointer.
- X */
- Xchar *
- Xstcopyr(s,r)
- X char *s;
- X char *r;
- X {
- X int sl;
- X
- X if(!s && r) {
- X free(r);
- X string_count--;
- X return(NULL);
- X }
- X else if (!s) return(NULL);
- X
- X sl = strlen(s) + 1;
- X
- X if(r) {
- X if ((strlen(r) + 1) < sl) {
- X free(r);
- X r = (char *) malloc(sl);
- X }
- X }
- X else {
- X r = (char *) malloc(sl);
- X string_count++;
- X if(string_max < string_count) string_max = string_count;
- X }
- X
- X return strcpy(r,s);
- X }
- X
- X/*
- X * stfree - free space allocated by stcopy or stalloc
- X *
- X * STFREE takes a string that was returned by stcopy or stalloc
- X * and frees the space that was allocated for the string.
- X */
- Xvoid
- Xstfree(st)
- X char *st;
- X {
- X if(st) {
- X free(st);
- X string_count--;
- X }
- X }
- X
- X
- END_OF_FILE
- if test 2207 -ne `wc -c <'./stcopy.c'`; then
- echo shar: \"'./stcopy.c'\" unpacked with wrong size!
- fi
- # end of './stcopy.c'
- fi
- if test -f './udp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./udp.c'\"
- else
- echo shar: Extracting \"'./udp.c'\" \(2234 characters\)
- sed "s/^X//" >'./udp.c' <<'END_OF_FILE'
- X/*
- X * udp - Check if UDP traffic is allowed on this host; we open port 1527 on
- X * a system (default of cs.widener.edu), which is expecting it; the
- X * date is output (e.g. very similar to the daytime service). This
- X * will conclusively tell us if UDP traffic on ports > 1000 is allowed.
- X *
- X * It should print out the date if UDP traffic's not blocked on your
- X * system. If it just hangs, try these tests too:
- X * a. run it with -d (e.g. "udp -d"); that goes to the normal UDP port
- X * to print the date. If it works, then you can be sure that any
- X * UDP traffic > port 1000 is blocked on your system.
- X * b. if it hangs too, try "telnet 147.31.254.130 13" and see if
- X * _that_ prints the date; if it doesn't, it's another problem (your
- X * network can't get to me, e.g.).
- X *
- X * Compile by: cc -o udp udp.c
- X *
- X * Brendan Kehoe, brendan@cs.widener.edu, Oct 1991.
- X */
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <netinet/in.h>
- X#ifndef hpux
- X# include <arpa/inet.h>
- X#endif
- X
- X#define SIZE 2048
- X#define HOST "147.31.254.130" /* cs.widener.edu */
- X#define PORT 1527
- X
- Xmain (argc, argv)
- X int argc;
- X char **argv;
- X{
- X int s, len;
- X struct sockaddr_in server, sa;
- X char buf[SIZE];
- X
- X if ((s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
- X {
- X perror ("socket()");
- X exit (1);
- X }
- X
- X bzero ((char *) &sa, sizeof (sa));
- X sa.sin_family = AF_INET;
- X sa.sin_addr.s_addr = htonl (INADDR_ANY);
- X sa.sin_port = htons (0);
- X
- X if (bind (s, (struct sockaddr *) &sa, sizeof (sa)) < 0)
- X {
- X perror ("bind()");
- X exit (1);
- X }
- X
- X bzero ((char *) &server, sizeof (server));
- X server.sin_family = AF_INET;
- X server.sin_addr.s_addr = inet_addr (HOST);
- X if (argc > 1 && strcmp(*(argv + 1), "-d") == 0)
- X server.sin_port = htons ((unsigned short) 13);
- X else
- X server.sin_port = htons ((unsigned short) PORT);
- X
- X /* yoo hoo, we're here .. */
- X if (sendto (s, "\n", 1, 0, &server, sizeof (server)) < 0)
- X {
- X perror ("sendto()");
- X exit (1);
- X }
- X
- X /* slurp */
- X len = sizeof (server);
- X if (recvfrom (s, buf, sizeof (buf), 0, &server, &len) < 0)
- X {
- X perror ("recvfrom");
- X exit (1);
- X }
- X
- X printf ("%s", buf);
- X close (s);
- X}
- END_OF_FILE
- if test 2234 -ne `wc -c <'./udp.c'`; then
- echo shar: \"'./udp.c'\" unpacked with wrong size!
- fi
- # end of './udp.c'
- fi
- if test -f './vlalloc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./vlalloc.c'\"
- else
- echo shar: Extracting \"'./vlalloc.c'\" \(2321 characters\)
- sed "s/^X//" >'./vlalloc.c' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1989, 1990, 1991 by the University of Washington
- X *
- X * For copying and distribution information, please see the file
- X * <copyright.h>.
- X */
- X
- X#include <copyright.h>
- X#include <stdio.h>
- X
- X#include <pfs.h>
- X#include <pmachine.h>
- X
- Xstatic VLINK lfree = NULL;
- Xint vlink_count = 0;
- Xint vlink_max = 0;
- X
- X/*
- X * vlalloc - allocate and initialize vlink structure
- X *
- X * VLALLOC returns a pointer to an initialized structure of type
- X * VLINK. If it is unable to allocate such a structure, it
- X * returns NULL.
- X */
- XVLINK
- Xvlalloc()
- X {
- X VLINK vl;
- X if(lfree) {
- X vl = lfree;
- X lfree = lfree->next;
- X }
- X else {
- X vl = (VLINK) malloc(sizeof(VLINK_ST));
- X if (!vl) return(NULL);
- X vlink_max++;
- X }
- X
- X vlink_count++;
- X
- X /* Initialize and fill in default values */
- X /* Since all but four are set to a zero-value,
- X why not just wipe it clean? */
- X ZERO(vl);
- X
- X vl->linktype = 'L';
- X vl->type = stcopy("FILE");
- X vl->hosttype = stcopy("INTERNET-D");
- X vl->nametype = stcopy("ASCII");
- X
- X return(vl);
- X }
- X
- X/*
- X * vlfree - free a VLINK structure
- X *
- X * VLFREE takes a pointer to a VLINK structure and adds it to
- X * the free list for later reuse.
- X */
- Xvoid
- Xvlfree(vl)
- X VLINK vl;
- X {
- X extern int string_count;
- X
- X if(vl->dontfree) return;
- X /* many of these don't need to call stfree(); since a check
- X for pointer validity's already done before even calling
- X it, we can just call free() here then do one big decrement
- X of string_count at the end. */
- X if(vl->name) free(vl->name);
- X stfree(vl->type);
- X if(vl->replicas) vllfree(vl->replicas);
- X stfree(vl->hosttype);
- X if(vl->host) free(vl->host);
- X stfree(vl->nametype);
- X if(vl->filename) free(vl->filename);
- X if(vl->args) free(vl->args);
- X if(vl->lattrib) atlfree(vl->lattrib);
- X /* No allocation routines for f_info yet */
- X vl->f_info = NULL;
- X vl->next = lfree;
- X vl->previous = NULL;
- X lfree = vl;
- X vlink_count--;
- X string_count -= 4; /* freed name, host, filename, and args */
- X }
- X
- X/*
- X * vllfree - free a VLINK structure
- X *
- X * VLLFREE takes a pointer to a VLINK structure frees it and any linked
- X * VLINK structures. It is used to free an entrie list of VLINK
- X * structures.
- X */
- Xvoid
- Xvllfree(vl)
- X VLINK vl;
- X {
- X VLINK nxt;
- X
- X while((vl != NULL) && !vl->dontfree) {
- X nxt = vl->next;
- X vlfree(vl);
- X vl = nxt;
- X }
- X }
- X
- END_OF_FILE
- if test 2321 -ne `wc -c <'./vlalloc.c'`; then
- echo shar: \"'./vlalloc.c'\" unpacked with wrong size!
- fi
- # end of './vlalloc.c'
- fi
- if test -f './vms/fd.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'./vms/fd.h'\"
- else
- echo shar: Extracting \"'./vms/fd.h'\" \(393 characters\)
- sed "s/^X//" >'./vms/fd.h' <<'END_OF_FILE'
- X#ifndef _VMS_FD
- X#define _VMS_FD
- X
- Xtypedef struct fd_set
- X{
- X int fds_bits[1];
- X} fd_set;
- X
- X#define FD_SETSIZE (sizeof (fd_set) * 8)
- X#define FD_SET(f,s) ((s)->fds_bits[0] |= (1 << (f)))
- X#define FD_CLR(f,s) ((s)->fds_bits[0] &= ~(1 << (f)))
- X#define FD_ISSET(f,s) ((s)->fds_bits[0] & (1 << (f)))
- X#define FD_ZERO(s) ((s)->fds_bits[0] = 0)
- X
- X#endif /* _VMS_FD */
- END_OF_FILE
- if test 393 -ne `wc -c <'./vms/fd.h'`; then
- echo shar: \"'./vms/fd.h'\" unpacked with wrong size!
- fi
- # end of './vms/fd.h'
- fi
- echo shar: End of archive 4 \(of 5\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 5 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 5 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-