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

  1. Newsgroups: comp.sources.misc
  2. From: brendan@cs.widener.edu (Brendan Kehoe)
  3. Subject:  v26i048:  archie - A Prospero client for Archie, v1.2, Part03/05
  4. Message-ID: <1991Nov24.045421.4731@sparky.imd.sterling.com>
  5. X-Md4-Signature: eee4201dfe5a08250f4bcc7e2b7dad21
  6. Date: Sun, 24 Nov 1991 04:54:21 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: brendan@cs.widener.edu (Brendan Kehoe)
  10. Posting-number: Volume 26, Issue 48
  11. Archive-name: archie/part03
  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:  ./aquery.c ./get_vdir.c ./perrmesg.c ./pfs.h
  21. #   ./vms/network.h
  22. # Wrapped by kent@sparky on Wed Nov 20 18:23:44 1991
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 3 (of 5)."'
  26. if test -f './aquery.c' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'./aquery.c'\"
  28. else
  29.   echo shar: Extracting \"'./aquery.c'\" \(7961 characters\)
  30.   sed "s/^X//" >'./aquery.c' <<'END_OF_FILE'
  31. X/*
  32. X * aquery.c : Programmatic Prospero interface to Archie
  33. X *
  34. X * Copyright (c) 1991 by the University of Washington
  35. X *
  36. X * For copying and distribution information, please see the file
  37. X * <copyright.h>.
  38. X *
  39. X * Originally part of the Prospero Archie client by Clifford 
  40. X * Neuman (bcn@isi.edu).  Modifications, addition of programmatic interface,
  41. X * and new sorting code by George Ferguson (ferguson@cs.rochester.edu) 
  42. X * and Brendan Kehoe (brendan@cs.widener.edu).  MSDOS and OS2 modifications
  43. X * to use with PC/TCP by Mark Towfiq (towfiq@FTP.COM).
  44. X *
  45. X * v1.2.1 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  46. X * v1.2.0 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
  47. X * v1.1.3 - 08/30/91 (bpk) - cast index()
  48. X * v1.1.2 - 08/20/91 (bcn) - make it do it properly (new invdatecmplink)
  49. X * v1.1.1 - 08/20/91 (bpk) - made sorting go inverted as we purport it does
  50. X */
  51. X#include <copyright.h>
  52. X
  53. X#include <stdio.h>
  54. X
  55. X#include <pfs.h>
  56. X#include <perrno.h>
  57. X#include <archie.h>
  58. X
  59. X#include <pmachine.h>
  60. X#ifdef NEED_STRING_H
  61. X# include <string.h>            /* for char *index() */
  62. X#else
  63. X# include <strings.h>            /* for char *index() */
  64. X#endif
  65. X
  66. Xstatic void translateArchieResponse();
  67. X
  68. Xextern int pwarn;
  69. Xextern char p_warn_string[];
  70. X
  71. X/*
  72. X * archie_query : Sends a request to _host_, telling it to search for
  73. X *                _string_ using _query_type_ as the search method.
  74. X *                No more than _max_hits_ matches are to be returned
  75. X *                skipping over _offset_ matches.
  76. X *
  77. X *          archie_query returns a linked list of virtual links. 
  78. X *                If _flags_ does not include AQ_NOTRANS, then the Archie
  79. X *                responses will be translated. If _flags_ does not include 
  80. X *                AQ_NOSORT, then the list will be sorted using _cmp_proc_ to
  81. X *                compare pairs of links.  If _cmp_proc_ is NULL or AQ_DEFCMP,
  82. X *                then the default comparison procedure, defcmplink(), is used
  83. X *                sorting by host, then filename. If cmp_proc is AQ_INVDATECMP
  84. X *                then invdatecmplink() is used, sorting inverted by date.
  85. X *                otherwise a user-defined comparison procedure is called.
  86. X *
  87. X *                archie_query returns NULL and sets perrno if the query
  88. X *                failed. Note that it can return NULL with perrno == PSUCCESS
  89. X *                if the query didn't fail but there were simply no matches.
  90. X *
  91. X *   query_type:  S  Substring search ignoring case   
  92. X *                C  Substring search with case significant
  93. X *                R  Regular expression search
  94. X *                =  Exact String Match
  95. X *            s,c,e  Tries exact match first and falls back to S, C, or R 
  96. X *                   if not found.
  97. X *
  98. X *     cmp_proc:  AQ_DEFCMP      Sort by host, then filename
  99. X *                AQ_INVDATECMP  Sort inverted by date
  100. X *
  101. X *        flags:  AQ_NOSORT      Don't sort results
  102. X *                AQ_NOTRANS     Don't translate results
  103. X */
  104. XVLINK 
  105. Xarchie_query(host,string,max_hits,offset,query_type,cmp_proc,flags)
  106. X    char    *host,*string;
  107. X    int        max_hits,offset;
  108. X    char    query_type;
  109. X    int        (*cmp_proc)();
  110. X    int        flags;
  111. X    {
  112. X    char qstring[MAX_VPATH];    /* For construting the query  */
  113. X    VLINK    links;        /* Matches returned by server */
  114. X    VDIR_ST    dir_st;         /* Filled in by get_vdir      */
  115. X    VDIR    dir= &dir_st;
  116. X    
  117. X    VLINK    p,q,r,lowest,nextp,pnext,pprev;
  118. X    int    tmp;
  119. X
  120. X    /* Set the cmp_proc if not given */
  121. X    if (cmp_proc == NULL) cmp_proc = defcmplink;
  122. X
  123. X    /* Make the query string */
  124. X    sprintf(qstring,"ARCHIE/MATCH(%d,%d,%c)/%s",
  125. X        max_hits,offset,query_type,string);
  126. X
  127. X    /* Initialize Prospero structures */
  128. X    perrno = PSUCCESS; *p_err_string = '\0';
  129. X    pwarn = PNOWARN; *p_warn_string = '\0';
  130. X    vdir_init(dir);
  131. X    
  132. X    /* Retrieve the list of matches, return error if there was one */
  133. X#if defined(MSDOS)
  134. X    if(tmp = get_vdir(host, qstring, "", dir, (long)GVD_ATTRIB|GVD_NOSORT,
  135. X        NULL, NULL)) {
  136. X#else
  137. X    if(tmp = get_vdir(host,qstring,"",dir,GVD_ATTRIB|GVD_NOSORT,NULL,NULL)) {
  138. X# endif
  139. X        perrno = tmp;
  140. X        return(NULL);
  141. X    }
  142. X
  143. X    /* Save the links, and clear in dir in case it's used again   */
  144. X    links = dir->links; dir->links = NULL;
  145. X
  146. X    /* As returned, list is sorted by suffix, and conflicting     */
  147. X    /* suffixes appear on a list of "replicas".  We want to       */
  148. X    /* create a one-dimensional list sorted by host then filename */
  149. X    /* and maybe by some other parameter                          */
  150. X
  151. X    /* First flatten the doubly-linked list */
  152. X    for (p = links; p != NULL; p = nextp) {
  153. X        nextp = p->next;
  154. X        if (p->replicas != NULL) {
  155. X        p->next = p->replicas;
  156. X        p->next->previous = p;
  157. X        for (r = p->replicas; r->next != NULL; r = r->next)
  158. X            /*EMPTY*/ ;
  159. X        r->next = nextp;
  160. X        nextp->previous = r;
  161. X        p->replicas = NULL;
  162. X        }
  163. X    }
  164. X
  165. X    /* Translate the filenames unless NOTRANS was given */
  166. X    if (!(flags & AQ_NOTRANS))
  167. X        for (p = links; p != NULL; p = p->next)
  168. X        translateArchieResponse(p);
  169. X
  170. X    /* If NOSORT given, then just hand it back */
  171. X    if (flags & AQ_NOSORT) {
  172. X        perrno = PSUCCESS;
  173. X        return(links);
  174. X    }
  175. X
  176. X    /* Otherwise sort it using a selection sort and the given cmp_proc */
  177. X    for (p = links; p != NULL; p = nextp) {
  178. X        nextp = p->next;
  179. X        lowest = p;
  180. X        for (q = p->next; q != NULL; q = q->next)
  181. X        if ((*cmp_proc)(q,lowest) < 0)
  182. X            lowest = q;
  183. X        if (p != lowest) {
  184. X        /* swap the two links */
  185. X        pnext = p->next;
  186. X        pprev = p->previous;
  187. X        if (lowest->next != NULL)
  188. X            lowest->next->previous = p;
  189. X        p->next = lowest->next;
  190. X        if (nextp == lowest) {
  191. X            p->previous = lowest;
  192. X        } else {
  193. X            lowest->previous->next = p;
  194. X            p->previous = lowest->previous;
  195. X        }
  196. X        if (nextp == lowest) {
  197. X            lowest->next = p;
  198. X        } else {
  199. X            pnext->previous = lowest;
  200. X            lowest->next = pnext;
  201. X        }
  202. X        if (pprev != NULL)
  203. X            pprev->next = lowest;
  204. X        lowest->previous = pprev;
  205. X        /* keep the head of the list in the right place */
  206. X        if (links == p)
  207. X            links = lowest;
  208. X        }
  209. X    }
  210. X
  211. X    /* Return the links */
  212. X    perrno = PSUCCESS;
  213. X    return(links);
  214. X    }
  215. X
  216. X/*
  217. X * translateArchieResponse: 
  218. X *
  219. X *   If the given link is for an archie-pseudo directory, fix it. 
  220. X *   This is called unless AQ_NOTRANS was given to archie_query().
  221. X */
  222. Xstatic void
  223. XtranslateArchieResponse(l)
  224. X    VLINK l;
  225. X    {
  226. X    char *slash;
  227. X
  228. X    if (strcmp(l->type,"DIRECTORY") == 0) {
  229. X        if (strncmp(l->filename,"ARCHIE/HOST",11) == 0) {
  230. X        l->type = stcopyr("EXTERNAL(AFTP,DIRECTORY)",l->type);
  231. X        l->host = stcopyr(l->filename+12,l->host);
  232. X        slash = (char *)index(l->host,'/');
  233. X        if (slash) {
  234. X            l->filename = stcopyr(slash,l->filename);
  235. X            *slash++ = '\0';
  236. X        } else
  237. X            l->filename = stcopyr("",l->filename);
  238. X        }
  239. X    }
  240. X    }
  241. X
  242. X/*
  243. X * defcmplink: The default link comparison function for sorting. Compares
  244. X *           links p and q first by host then by filename. Returns < 0 if p
  245. X *             belongs before q, > 0 if p belongs after q, and == 0 if their
  246. X *             host and filename fields are identical.
  247. X */
  248. Xint
  249. Xdefcmplink(p,q)
  250. X    VLINK p,q;
  251. X    {
  252. X    int result;
  253. X
  254. X    if ((result=strcmp(p->host,q->host)) != 0)
  255. X        return(result);
  256. X    else
  257. X        return(strcmp(p->filename,q->filename));
  258. X    }
  259. X
  260. X/*
  261. X * invdatecmplink: An alternative comparison function for sorting that
  262. X *               compares links p and q first by LAST-MODIFIED date,
  263. X *                 if they both have that attribute. If both links
  264. X *                 don't have that attribute or the dates are the
  265. X *                 same, it then calls defcmplink() and returns its 
  266. X *           value.
  267. X */
  268. Xint
  269. Xinvdatecmplink(p,q)
  270. X    VLINK p,q;
  271. X    {
  272. X    PATTRIB pat,qat;
  273. X    char *pdate,*qdate;
  274. X    int result;
  275. X    
  276. X    pdate = qdate = NULL;
  277. X    for (pat = p->lattrib; pat; pat = pat->next)
  278. X        if(strcmp(pat->aname,"LAST-MODIFIED") == 0)
  279. X        pdate = pat->value.ascii;
  280. X    for (qat = q->lattrib; qat; qat = qat->next)
  281. X        if(strcmp(qat->aname,"LAST-MODIFIED") == 0)
  282. X        qdate = qat->value.ascii;
  283. X    if(!pdate && !qdate) return(defcmplink(p,q));
  284. X    if(!pdate) return(1); 
  285. X    if(!qdate) return(-1);
  286. X    if((result=strcmp(qdate,pdate)) == 0) return(defcmplink(p,q));
  287. X    else return(result);
  288. X    }
  289. END_OF_FILE
  290.   if test 7961 -ne `wc -c <'./aquery.c'`; then
  291.     echo shar: \"'./aquery.c'\" unpacked with wrong size!
  292.   fi
  293.   # end of './aquery.c'
  294. fi
  295. if test -f './get_vdir.c' -a "${1}" != "-c" ; then 
  296.   echo shar: Will not clobber existing file \"'./get_vdir.c'\"
  297. else
  298.   echo shar: Extracting \"'./get_vdir.c'\" \(14298 characters\)
  299.   sed "s/^X//" >'./get_vdir.c' <<'END_OF_FILE'
  300. X/*
  301. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  302. X *
  303. X * For copying and distribution information, please see the file
  304. X * <copyright.h>.
  305. X *
  306. X * v1.2.2 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  307. X * v1.2.1 - 10/23/91 (bpk) - added missing code
  308. X * v1.2.0 - 09/17/91 (bpk) - added new get_vdir code
  309. X * v1.1.1 - 08/30/91 (bpk) - cast rindex()
  310. X */
  311. X
  312. X#include <copyright.h>
  313. X#include <stdio.h>
  314. X
  315. X#include <pfs.h>
  316. X#include <pprot.h>
  317. X#include <perrno.h>
  318. X#include <pcompat.h>
  319. X#include <pauthent.h>
  320. X#include <pmachine.h>
  321. X
  322. X#ifdef NEED_STRING_H
  323. X# include <string.h>
  324. X#else
  325. X# include <strings.h>
  326. X#endif
  327. X
  328. X#ifdef DEBUG
  329. Xextern int    pfs_debug;
  330. X#endif
  331. X
  332. Xextern int    pwarn;
  333. Xextern char    p_warn_string[];
  334. Xextern int    perrno;
  335. Xextern char    p_err_string[];
  336. X
  337. X/*
  338. X * get_vdir - Get contents of a directory given its location
  339. X *
  340. X *          GET_VDIR takes a directory location, a list of desired
  341. X *          components, a pointer to a directory structure to be 
  342. X *          filled in, and flags.  It then queries the appropriate 
  343. X *          directory server and retrieves the desired information.
  344. X *
  345. X *      ARGS:   dhost       - Host on which directory resides
  346. X *              dfile       - Directory on that host
  347. X *              components  - The names from the directory we want
  348. X *        dir        - Structure to be filled in
  349. X *            flags       - Options.  See FLAGS
  350. X *        filters     - filters to be applied to result 
  351. X *              acomp       - Pointer to remaining components
  352. X *
  353. X *     FLAGS:    GVD_UNION   - Do not expand union links
  354. X *        GVD_EXPAND  - Expand union links locally
  355. X *        GVD_REMEXP  - Request remote expansion (& local if refused)
  356. X *        GVD_LREMEXP - Request remote expansion of local union links
  357. X *        GVD_VERIFY  - Only verify that args are for a directory
  358. X *              GVD_ATTRIB  - Request attributes from directory server
  359. X *              GVD_NOSORT  - Do not sort links when adding to directory
  360. X *
  361. X *   RETURNS:   PSUCCESS (0) or error code
  362. X *        On some codes addition information in p_err_string
  363. X *
  364. X *     NOTES:   If acomp is non-null the string it points to might be modified
  365. X *
  366. X *              If the directory passed as an argument already has
  367. X *        links or union links, then those lists will be freed
  368. X *              before the new contents are filled in.
  369. X *
  370. X *              If a filter is passed to the procedure, and application of
  371. X *              the filter results in additional union link, then those links
  372. X *              will (or will not) be expanded as specified in the FLAGS field.
  373. X *
  374. X *              If the list of components in NULL, or the null string, then
  375. X *              get_vdir will return all links in the requested directory.
  376. X *
  377. X *      BUGS:   Doesn't process union links yet
  378. X *              Doesn't process errors returned from server
  379. X *        Doesn't expand union links if requested to
  380. X */
  381. Xint
  382. Xget_vdir(dhost,dfile,components,dir,flags,filters,acomp)
  383. X    char    *dhost;        /* Host on which directory resides           */
  384. X    char    *dfile;        /* Name of file on that host                 */
  385. X    char    *components;    /* Component name (wildcards allowed)        */
  386. X    VDIR    dir;        /* Structure to be filled in             */
  387. X    long    flags;        /* Flags                         */
  388. X    VLINK    filters;    /* Filters to be applied to result           */
  389. X    char    *acomp;        /* Components left to be resolved            */
  390. X    {
  391. X        PTEXT    request;    /* Text of request to dir server             */
  392. X    PTEXT    resp;            /* Response from dir server                 */
  393. X
  394. X    char    ulcomp[MAX_VPATH];/* Work space for new current component    */
  395. X    char    *comp = components;
  396. X
  397. X    VLINK    cur_link = NULL;/* Current link being filled in              */
  398. X    VLINK     exp = NULL;     /* The current ulink being expanded         */
  399. X    VLINK    pul = NULL;     /* Prev union link (insert new one after it) */
  400. X    VLINK    l;        /* Temp link pointer                  */
  401. X    int    mcomp;        /* Flag - check multiple components          */
  402. X    int    unresp;        /* Flag - received unresolved response       */
  403. X    int    getattrib = 0;  /* Get attributes from server                */
  404. X    int    vl_insert_flag; /* Flags to vl_insert                        */
  405. X
  406. X    int    fwdcnt = MAX_FWD_DEPTH;
  407. X
  408. X    int    no_links = 0;   /* Count of number of links found         */
  409. X
  410. X    char    options[40];    /* LIST option                               */
  411. X    char    *opt;           /* After leading +                           */
  412. X
  413. X    PAUTH    authinfo;
  414. X
  415. X    /* Treat null string like NULL (return entire directory) */
  416. X    if(!components || !*components) comp = NULL;
  417. X
  418. X    if(acomp && !filters) mcomp = 1;
  419. X    else mcomp = 0;
  420. X
  421. X    if(flags&GVD_ATTRIB) {
  422. X        getattrib++;
  423. X        flags &= (~GVD_ATTRIB);
  424. X    }
  425. X
  426. X    if(flags&GVD_NOSORT) vl_insert_flag = VLI_NOSORT;
  427. X    else vl_insert_flag = VLI_ALLOW_CONF;
  428. X    flags &= (~GVD_NOSORT);
  429. X
  430. X    if(filters) comp = NULL;
  431. X
  432. X    perrno = 0;
  433. X
  434. X    authinfo = get_pauth(PFSA_UNAUTHENTICATED);
  435. X
  436. X    *options = '\0';
  437. X
  438. X    if(getattrib) {
  439. X        strcat(options,"+ATTRIBUTES");
  440. X        flags &= (~GVD_ATTRIB);
  441. X    }
  442. X
  443. X    if(!filters) { /* Can't do remote expansion if filters to be applied */
  444. X        if(flags == GVD_REMEXP) strcat(options,"+EXPAND");
  445. X        if(flags == GVD_LREMEXP) strcat(options,"+LEXPAND");
  446. X    }
  447. X
  448. X    /* If all we are doing is verifying that dfile is a directory */
  449. X    /* then we do not want a big response from the directory      */
  450. X    /* server.  A NOT-FOUND is sufficient.                  */
  451. X    if(flags == GVD_VERIFY)
  452. X#ifdef NEWVERIFYOPT
  453. X        strcat(options,"+VERIFY");
  454. X#else
  455. X    comp = "%#$PRobably_nOn_existaNT$#%";
  456. X#endif
  457. X
  458. X    if(*options) opt = options+1;
  459. X    else opt = "''";
  460. X
  461. X    startover:
  462. X    request = ptalloc();
  463. X
  464. X    sprintf(request->start,
  465. X        "VERSION %d\nAUTHENTICATOR %s %s\nDIRECTORY ASCII %s\nLIST %s COMPONENTS %s%s%s\n",
  466. X        VFPROT_VNO, authinfo->auth_type, authinfo->authenticator,
  467. X        dfile,opt, (comp ? comp : ""), (mcomp ? "/" : ""),
  468. X        (mcomp ? acomp : ""));
  469. X
  470. X    request->length = strlen(request->start);
  471. X
  472. X#ifdef DEBUG
  473. X    if(pfs_debug > 2)
  474. X        fprintf(stderr,"Sending message to dirsrv:\n%s",request->start);
  475. X#endif
  476. X
  477. X#if defined(MSDOS)
  478. X    resp = dirsend(request,dhost,0L);
  479. X#else
  480. X    resp = dirsend(request,dhost,0);
  481. X#endif
  482. X
  483. X#ifdef DEBUG
  484. X    if(pfs_debug && (resp == NULL)) {
  485. X        fprintf(stderr,"Dirsend failed: %d\n",perrno);
  486. X    }
  487. X#endif
  488. X
  489. X    /* If we don't get a response, then if the requested       */
  490. X    /* directory, return error, if a ulink, mark it unexpanded */
  491. X    if(resp == NULL) {
  492. X        if(exp) exp->expanded = FAILED;
  493. X        else return(perrno);
  494. X    }
  495. X
  496. X    unresp = 0;
  497. X
  498. X    /* Here we must parse reponse and put in directory */
  499. X    /* While looking at each packet            */
  500. X    while(resp) {
  501. X        PTEXT        vtmp;
  502. X        char        *line;
  503. X
  504. X        vtmp = resp;
  505. X#ifdef DEBUG
  506. X        if(pfs_debug > 3) fprintf(stderr,"%s\n",resp->start);
  507. X#endif
  508. X        /* Look at each line in packet */
  509. X        for(line = resp->start;line != NULL;line = nxtline(line)) {
  510. X        switch (*line) {
  511. X            
  512. X            /* Temporary variables to hold link info */
  513. X            char    l_linktype;
  514. X            char     l_name[MAX_DIR_LINESIZE];
  515. X            char    l_type[MAX_DIR_LINESIZE];
  516. X            char     l_htype[MAX_DIR_LINESIZE];
  517. X            char     l_host[MAX_DIR_LINESIZE];
  518. X            char     l_ntype[MAX_DIR_LINESIZE];
  519. X            char     l_fname[MAX_DIR_LINESIZE];
  520. X            int        l_version;
  521. X            char     t_unresolved[MAX_DIR_LINESIZE];
  522. X            int        l_magic;
  523. X            int        tmp;
  524. X
  525. X        case 'L': /* LINK or LINK-INFO */
  526. X            if(strncmp(line,"LINK-INFO",9) == 0) {
  527. X            PATTRIB        at;
  528. X            PATTRIB        last_at;
  529. X            at = parse_attribute(line);
  530. X            if(!at) break;
  531. X
  532. X            /* Cant have link info without a link */
  533. X            if(!cur_link) {
  534. X                perrno = DIRSRV_BAD_FORMAT;
  535. X                atfree(at);
  536. X                break;
  537. X            }
  538. X            
  539. X            if(cur_link->lattrib) {
  540. X                last_at = cur_link->lattrib;
  541. X                while(last_at->next) last_at = last_at->next;
  542. X                at->previous = last_at;
  543. X                last_at->next = at;
  544. X            }
  545. X            else {
  546. X                cur_link->lattrib = at;
  547. X                at->previous = NULL;
  548. X            }
  549. X            break;
  550. X            }
  551. X
  552. X            /* Not LINK-INFO, must be LINK - if not check for error */
  553. X            if(strncmp(line,"LINK",4) != 0) goto scanerr;
  554. X
  555. X            /* If only verifying, don't want to change dir */
  556. X            if(flags == GVD_VERIFY) {
  557. X            break;
  558. X            }
  559. X            /* If first link and some links in dir, free them */
  560. X            if(!no_links++) {
  561. X            if(dir->links) vllfree(dir->links); dir->links=NULL;
  562. X            if(dir->ulinks) vllfree(dir->ulinks); dir->ulinks=NULL;
  563. X            }
  564. X            
  565. X            cur_link = vlalloc();
  566. X
  567. X            /* parse and insert file info */
  568. X            tmp = sscanf(line,"LINK %c %s %s %s %s %s %s %d %d", &l_linktype,
  569. X                 l_type, l_name, l_htype, l_host, 
  570. X                 l_ntype, l_fname, &(cur_link->version),
  571. X                 &(cur_link->f_magic_no));
  572. X
  573. X            if(tmp != 9) {
  574. X            perrno = DIRSRV_BAD_FORMAT;
  575. X            vlfree(cur_link);
  576. X            break;
  577. X            }
  578. X
  579. X            cur_link->linktype = l_linktype;
  580. X            cur_link->type = stcopyr(l_type,cur_link->type);
  581. X            cur_link->name = stcopyr(unquote(l_name),cur_link->name);
  582. X            cur_link->hosttype = stcopyr(l_htype,cur_link->hosttype);
  583. X            cur_link->host = stcopyr(l_host,cur_link->host);
  584. X            cur_link->nametype = stcopyr(l_ntype,cur_link->nametype);
  585. X            cur_link->filename = stcopyr(l_fname,cur_link->filename);
  586. X
  587. X            /* Double check to make sure we don't get */
  588. X            /* back unwanted components              */
  589. X            /* OK to keep if special (URP) links      */
  590. X            /* or if mcomp specified                  */
  591. X            if(!mcomp && (cur_link->linktype == 'L') && 
  592. X               (!wcmatch(cur_link->name,comp))) {
  593. X            vlfree(cur_link);
  594. X            break;
  595. X            }
  596. X
  597. X            /* If other optional info was sent back, it must */
  598. X            /* also be parsed before inserting link     ***  */
  599. X            
  600. X            
  601. X            if(cur_link->linktype == 'L') 
  602. X            vl_insert(cur_link,dir,vl_insert_flag);
  603. X            else {
  604. X            tmp = ul_insert(cur_link,dir,pul);
  605. X
  606. X            /* If inserted after pul, next one after cur_link */
  607. X            if(pul && (!tmp || (tmp == UL_INSERT_SUPERSEDING)))
  608. X                pul = cur_link;
  609. X            }
  610. X            
  611. X            break;
  612. X
  613. X        case 'F': /* FILTER, FAILURE or FORWARDED*/
  614. X            /* FORWARDED */
  615. X            if(strncmp(line,"FORWARDED",9) == 0) {
  616. X            if(fwdcnt-- <= 0) {
  617. X                ptlfree(resp);
  618. X                perrno = PFS_MAX_FWD_DEPTH;
  619. X                return(perrno);
  620. X            }
  621. X            /* parse and start over */
  622. X
  623. X            tmp = sscanf(line,"FORWARDED %s %s %s %s %d %d", 
  624. X                     l_htype,l_host,l_ntype,l_fname,
  625. X                     &l_version, &l_magic);
  626. X
  627. X            dhost = stcopy(l_host);
  628. X            dfile = stcopy(l_fname);
  629. X
  630. X            if(tmp < 4) {
  631. X                perrno = DIRSRV_BAD_FORMAT;
  632. X                break;
  633. X            }
  634. X
  635. X            ptlfree(resp);
  636. X            goto startover;
  637. X            }
  638. X            if(strncmp(line,"FILTER",6) != 0) goto scanerr;
  639. X            break;
  640. X
  641. X
  642. X        case 'M': /* MULTI-PACKET (processed by dirsend) */
  643. X        case 'P': /* PACKET (processed by dirsend) */
  644. X            break;
  645. X
  646. X        case 'N': /* NOT-A-DIRECTORY or NONE-FOUND */
  647. X            /* NONE-FOUND, we just have no links to insert */
  648. X            /* It is not an error, but we must clear any   */
  649. X            /* old links in the directory arg              */
  650. X            if(strncmp(line,"NONE-FOUND",10) == 0) {
  651. X            /* If only verifying, don't want to change dir */
  652. X            if(flags == GVD_VERIFY) {
  653. X                break;
  654. X            }
  655. X
  656. X            /* If first link and some links in dir, free them */
  657. X            if(!no_links++) {
  658. X                if(dir->links) vllfree(dir->links);
  659. X                if(dir->ulinks) vllfree(dir->ulinks);
  660. X                dir->links = NULL;
  661. X                dir->ulinks = NULL;
  662. X            }
  663. X            break;
  664. X            }
  665. X            /* If NOT-A-DIRECTORY or anything else, scan error */
  666. X            goto scanerr;
  667. X
  668. X        case 'U': /* UNRESOLVED */
  669. X            if(strncmp(line,"UNRESOLVED",10) != 0) {
  670. X            goto scanerr;
  671. X            }
  672. X            tmp = sscanf(line,"UNRESOLVED %s", t_unresolved);
  673. X            if(tmp < 1) {
  674. X            perrno = DIRSRV_BAD_FORMAT;
  675. X            break;
  676. X            }
  677. X            /* If multiple components were resolved */
  678. X            if(strlen(t_unresolved) < strlen(acomp)) {
  679. X            strcpy(ulcomp,acomp);
  680. X            /* ulcomp is the components that were resolved */
  681. X            *(ulcomp+strlen(acomp)-strlen(t_unresolved)-1) = '\0';
  682. X            /* Comp gets the last component resolved */
  683. X            comp = (char *) rindex(ulcomp,'/');
  684. X            if(comp) comp++;
  685. X            else comp = ulcomp;
  686. X            /* Let rd_vdir know what remains */
  687. X            strcpy(acomp,t_unresolved);
  688. X            }
  689. X            unresp = 1;
  690. X            break;
  691. X
  692. X        case 'V': /* VERSION-NOT-SUPPORTED */
  693. X            if(strncmp(line,"VERSION-NOT-SUPPORTED",21) == 0) {
  694. X            perrno = DIRSRV_BAD_VERS;
  695. X            return(perrno);
  696. X            }
  697. X            goto scanerr;
  698. X
  699. X        scanerr:
  700. X        default:
  701. X            if(*line && (tmp = scan_error(line))) {
  702. X            ptlfree(resp);
  703. X            return(tmp);
  704. X            }
  705. X            break;
  706. X        }
  707. X        }
  708. X
  709. X        resp = resp->next;
  710. X
  711. X        ptfree(vtmp);
  712. X    }
  713. X
  714. X    /* We sent multiple components and weren't told any */
  715. X    /* were unresolved                                  */
  716. X    if(mcomp && !unresp) {
  717. X        /* ulcomp is the components that were resolved */
  718. X        strcpy(ulcomp,acomp);
  719. X        /* Comp gets the last component resolved */
  720. X        comp = (char *) rindex(ulcomp,'/');
  721. X        if(comp) comp++;
  722. X        else comp = ulcomp;
  723. X        /* If we have union links to resolve, only one component remains */
  724. X        mcomp = 0;
  725. X        /* Let rd_vdir know what remains */
  726. X        *acomp = '\0';
  727. X    }
  728. X
  729. X    /* If only verifying, we already know it is a directory */
  730. X    if(flags == GVD_VERIFY) return(PSUCCESS);
  731. X
  732. X    /* Don't return if matching was delayed by the need to filter    */
  733. X    /* if FIND specified, and dir->links is non null, then we have   */
  734. X    /* found a match, and should return.                             */
  735. X    if((flags & GVD_FIND) && dir->links && (!filters))
  736. X        return(PSUCCESS);
  737. X
  738. X    /* If expand specified, and ulinks must be expanded, making sure */
  739. X        /* that the order of the links is maintained properly            */
  740. X
  741. Xexpand_ulinks:
  742. X
  743. X    if((flags != GVD_UNION) && (flags != GVD_VERIFY)) {
  744. X
  745. X        l = dir->ulinks;
  746. X
  747. X        /* Find first unexpanded ulink */
  748. X        while(l && l->expanded && (l->linktype == 'U')) l = l->next;
  749. X        
  750. X        /* Only expand if a FILE or DIRECTORY -  Mark as  */
  751. X            /* failed otherwise                               */
  752. X        /* We must still add support for symbolic ulinks */
  753. X        if(l) {
  754. X        if ((strcmp(l->type,"DIRECTORY") == 0) || 
  755. X            (strcmp(l->type,"FILE") == 0)) {
  756. X            l->expanded = TRUE;
  757. X            exp = l;
  758. X            pul = l;
  759. X            dhost = l->host;
  760. X            dfile = l->filename;
  761. X            goto startover; /* was get_contents; */
  762. X        }
  763. X        else l->expanded = FAILED;
  764. X        }
  765. X    }
  766. X
  767. X    /* Double check to make sure we don't get */
  768. X    /* back unwanted components          */
  769. X    /* OK to keep if special (URP) links      */
  770. X    if(components && *components) {
  771. X        l = dir->links;
  772. X        while(l) {
  773. X        VLINK    ol;
  774. X        if((l->linktype == 'L') && (!wcmatch(l->name,components))) {
  775. X            if(l == dir->links)
  776. X            dir->links = l->next;
  777. X            else l->previous->next = l->next;
  778. X            if(l->next) l->next->previous = l->previous;
  779. X            ol = l;
  780. X            l = l->next;
  781. X            vlfree(ol);
  782. X        }
  783. X        else l = l->next;
  784. X        }
  785. X    }
  786. X
  787. X    return(PSUCCESS);
  788. X    }
  789. END_OF_FILE
  790.   if test 14298 -ne `wc -c <'./get_vdir.c'`; then
  791.     echo shar: \"'./get_vdir.c'\" unpacked with wrong size!
  792.   fi
  793.   # end of './get_vdir.c'
  794. fi
  795. if test -f './perrmesg.c' -a "${1}" != "-c" ; then 
  796.   echo shar: Will not clobber existing file \"'./perrmesg.c'\"
  797. else
  798.   echo shar: Extracting \"'./perrmesg.c'\" \(9027 characters\)
  799.   sed "s/^X//" >'./perrmesg.c' <<'END_OF_FILE'
  800. X/*
  801. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  802. X *
  803. X * For copying and distribution information, please see the file
  804. X * <copyright.h>.
  805. X */
  806. X
  807. X#include <copyright.h>
  808. X#include <perrno.h>
  809. X#include <stdio.h>
  810. X
  811. X/* This file and perrno.h should always be updated simultaneously */
  812. X
  813. Xint    perrno = 0;
  814. Xint    pwarn = 0;
  815. Xchar    p_err_string[P_ERR_STRING_SZ];
  816. Xchar    p_warn_string[P_ERR_STRING_SZ];
  817. X
  818. Xchar    *p_err_text[256] = {
  819. X    /*   0 */ "Success (prospero)",
  820. X    /*   1 */ "Port unknown (dirsend)",
  821. X    /*   2 */ "Can't open local UDP port (dirsend)",
  822. X    /*   3 */ "Can't resolve hostname (dirsend)",
  823. X    /*   4 */ "Unable to send entire message (dirsend)",
  824. X    /*   5 */ "Timed out (dirsend)",
  825. X    /*   6 */ "Recvfrom failed (dirsend)",
  826. X    /*   7 */ "",    /*   8 */ "",    /*   9 */ "",    /*  10 */ "",
  827. X    /*  11 */ "Sendto failed (reply)",
  828. X    /*  12 */ "",    /*  13 */ "",    /*  14 */ "",    /*  15 */ "",
  829. X    /*  16 */ "",    /*  17 */ "",    /*  18 */ "",    /*  19 */ "",
  830. X    /*  20 */ "",
  831. X    /*  21 */ "Link already exists (vl_insert)",
  832. X    /*  22 */ "Link with same name already exists (vl_insert)",
  833. X    /*  23 */ "",    /*  24 */ "",
  834. X    /*  25 */ "Link already exists (ul_insert)",
  835. X    /*  26 */ "Replacing existing link (ul_insert)",
  836. X    /*  27 */ "Previous entry not found in dir->ulinks (ul_insert)",
  837. X    /*  28 */ "",    /*  29 */ "",    /*  30 */ "",    /*  31 */ "",
  838. X    /*  32 */ "",    /*  33 */ "",    /*  34 */ "",    /*  35 */ "",
  839. X    /*  36 */ "",    /*  37 */ "",    /*  38 */ "",    /*  39 */ "",
  840. X    /*  40 */ "",
  841. X    /*  41 */ "Temporary not found (rd_vdir)",
  842. X    /*  42 */ "Namespace not closed with object (rd_vdir)",
  843. X    /*  43 */ "Alias for namespace not defined (rd_vdir)",
  844. X    /*  44 */ "Specified namespace not found (rd_vdir)",
  845. X    /*  45 */ "",    /*  46 */ "",    /*  47 */ "",    /*  48 */ "",
  846. X    /*  49 */ "",    /*  50 */ "",
  847. X    /*  51 */ "File access method not supported (pfs_access)",
  848. X    /*  52 */ "",    /*  53 */ "",    /*  54 */ "",
  849. X    /*  55 */ "Pointer to cached copy - delete on close (pmap_cache)",
  850. X    /*  56 */ "Unable to retrieve file (pmap_cache)",
  851. X    /*  57 */ "",    /*  58 */ "",    /*  59 */ "",    /*  60 */ "",
  852. X    /*  61 */ "Directory already exists (mk_vdir)",
  853. X    /*  62 */ "Link with same name already exists (mk_vdir)",
  854. X    /*  63 */ "",    /*  64 */ "",
  855. X    /*  65 */ "Not a virtual system (vfsetenv)",
  856. X    /*  66 */ "Can't find directory (vfsetenv)",
  857. X    /*  67 */ "",    /*  68 */ "",    /*  69 */ "",    /*  70 */ "",
  858. X    /*  71 */ "Link already exists (add_vlink)",
  859. X    /*  72 */ "Link with same name already exists (add_vlink)",
  860. X    /*  73 */ "",    /*  74 */ "",    /*  75 */ "",    /*  76 */ "",
  861. X    /*  77 */ "",    /*  78 */ "",    /*  79 */ "",    /*  80 */ "",
  862. X    /*  81 */ "",    /*  82 */ "",    /*  83 */ "",    /*  84 */ "",
  863. X    /*  85 */ "",    /*  86 */ "",    /*  87 */ "",    /*  88 */ "",
  864. X    /*  89 */ "",    /*  90 */ "",    /*  91 */ "",    /*  92 */ "",
  865. X    /*  93 */ "",    /*  94 */ "",    /*  95 */ "",    /*  96 */ "",
  866. X    /*  97 */ "",    /*  98 */ "",    /*  99 */ "",    /* 100 */ "",
  867. X    /* 101 */ "",    /* 102 */ "",    /* 103 */ "",    /* 104 */ "",
  868. X    /* 105 */ "",    /* 106 */ "",    /* 107 */ "",    /* 108 */ "",
  869. X    /* 109 */ "",    /* 110 */ "",    /* 111 */ "",    /* 112 */ "",
  870. X    /* 113 */ "",    /* 114 */ "",    /* 115 */ "",    /* 116 */ "",
  871. X    /* 117 */ "",    /* 118 */ "",    /* 119 */ "",    /* 120 */ "",
  872. X    /* 121 */ "",    /* 122 */ "",    /* 123 */ "",    /* 124 */ "",
  873. X    /* 125 */ "",    /* 126 */ "",    /* 127 */ "",    /* 128 */ "",
  874. X    /* 129 */ "",    /* 130 */ "",    /* 131 */ "",    /* 132 */ "",
  875. X    /* 133 */ "",    /* 134 */ "",    /* 135 */ "",    /* 136 */ "",
  876. X    /* 137 */ "",    /* 138 */ "",    /* 139 */ "",    /* 140 */ "",
  877. X    /* 141 */ "",    /* 142 */ "",    /* 143 */ "",    /* 144 */ "",
  878. X    /* 145 */ "",    /* 146 */ "",    /* 147 */ "",    /* 148 */ "",
  879. X    /* 149 */ "",    /* 150 */ "",    /* 151 */ "",    /* 152 */ "",
  880. X    /* 153 */ "",    /* 154 */ "",    /* 155 */ "",    /* 156 */ "",
  881. X    /* 157 */ "",    /* 158 */ "",    /* 159 */ "",    /* 160 */ "",
  882. X    /* 161 */ "",    /* 162 */ "",    /* 163 */ "",    /* 164 */ "",
  883. X    /* 165 */ "",    /* 166 */ "",    /* 167 */ "",    /* 168 */ "",
  884. X    /* 169 */ "",    /* 170 */ "",    /* 171 */ "",    /* 172 */ "",
  885. X    /* 173 */ "",    /* 174 */ "",    /* 175 */ "",    /* 176 */ "",
  886. X    /* 177 */ "",    /* 178 */ "",    /* 179 */ "",    /* 180 */ "",
  887. X    /* 181 */ "",    /* 182 */ "",    /* 183 */ "",    /* 184 */ "",
  888. X    /* 185 */ "",    /* 186 */ "",    /* 187 */ "",    /* 188 */ "",
  889. X    /* 189 */ "",    /* 190 */ "",    /* 191 */ "",    /* 192 */ "",
  890. X    /* 193 */ "",    /* 194 */ "",    /* 195 */ "",    /* 196 */ "",
  891. X    /* 197 */ "",    /* 198 */ "",    /* 199 */ "",    /* 200 */ "",
  892. X    /* 201 */ "",    /* 202 */ "",    /* 203 */ "",    /* 204 */ "",
  893. X    /* 205 */ "",    /* 206 */ "",    /* 207 */ "",    /* 208 */ "",
  894. X    /* 209 */ "",    /* 210 */ "",    /* 211 */ "",    /* 212 */ "",
  895. X    /* 213 */ "",    /* 214 */ "",    /* 215 */ "",    /* 216 */ "",
  896. X    /* 217 */ "",    /* 218 */ "",    /* 219 */ "",    /* 220 */ "",
  897. X    /* 221 */ "",    /* 222 */ "",    /* 223 */ "",    /* 224 */ "",
  898. X    /* 225 */ "",    /* 226 */ "",    /* 227 */ "",    /* 228 */ "",
  899. X    /* 229 */ "",
  900. X    /* 230 */ "File not found (prospero)",
  901. X    /* 231 */ "Directory not found (prospero)",
  902. X    /* 232 */ "Symbolic links nested too deep (prospero)",
  903. X    /* 233 */ "Environment not initialized - source vfsetup.source then run vfsetup",
  904. X    /* 234 */ "Can't traverse an external file (prospero)",
  905. X    /* 235 */ "Forwarding chain is too long (prospero)",
  906. X    /* 236 */ "",    /* 237 */ "",    /* 238 */ "",    /* 239 */ "",
  907. X    /* 240 */ "",    /* 241 */ "",
  908. X    /* 242 */ "Authentication required (prospero server)",
  909. X    /* 243 */ "Not authorized (prospero server)",
  910. X    /* 244 */ "Not found (prospero server)",
  911. X    /* 245 */ "Bad version number (prospero server)",
  912. X    /* 246 */ "Not a directory (prospero server)",
  913. X    /* 247 */ "Already exists (prospero server)",
  914. X    /* 248 */ "Link with same name already exists (prospero server)",
  915. X    /* 249 */ "",    /* 250 */ "",
  916. X    /* 251 */ "Command not implemented on server (dirsrv)",
  917. X    /* 252 */ "Bad format for response (dirsrv)",
  918. X    /* 253 */ "Protocol error (prospero server)",
  919. X    /* 254 */ "Unspecified server failure (prospero server)",
  920. X    /* 255 */ "Generic Failure (prospero)"};
  921. X
  922. Xchar    *p_warn_text[256] = {
  923. X    /*   0 */ "No warning",
  924. X    /*   1 */ "You are using an old version of this program",
  925. X    /*   2 */ "From server",
  926. X    /*   3 */ "Unrecognized line in response from server",
  927. X  /* 4-254 */ "", "", "", "", "", "", "", "", "", "", "", "", "",
  928. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  929. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  930. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  931. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  932. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  933. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  934. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  935. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  936. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  937. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  938. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  939. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  940. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  941. X  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  942. X    /* 255 */ ""};
  943. X
  944. X#ifndef ARCHIE
  945. Xperrmesg(prefix,no,text)
  946. X    char    *prefix;
  947. X    int        no;
  948. X    char    *text;
  949. X    {
  950. X    fprintf(stderr,"%s%s%s%s\n", (prefix ? prefix : ""),
  951. X        (no ? p_err_text[no] : p_err_text[perrno]),
  952. X        ((text ? (*text ? " - " : "") : 
  953. X          (!no && *p_err_string ? " - " : ""))),
  954. X        (text ? text : (no ? "" : p_err_string)));
  955. X    }
  956. X
  957. Xsperrmesg(buf,prefix,no,text)
  958. X    char    *buf;
  959. X    char    *prefix;
  960. X    int        no;
  961. X    char    *text;
  962. X    {
  963. X    sprintf(buf,"%s%s%s%s\n", (prefix ? prefix : ""),
  964. X        (no ? p_err_text[no] : p_err_text[perrno]),
  965. X        ((text ? (*text ? " - " : "") : 
  966. X          (!no && *p_err_string ? " - " : ""))),
  967. X        (text ? text : (no ? "" : p_err_string)));
  968. X    }
  969. X
  970. Xpwarnmesg(prefix,no,text)
  971. X    char    *prefix;
  972. X    int        no;
  973. X    char    *text;
  974. X    {
  975. X    fprintf(stderr,"%s%s%s%s\n", (prefix ? prefix : ""),
  976. X        (no ? p_warn_text[no] : p_warn_text[pwarn]),
  977. X        ((text ? (*text ? " - " : "") : 
  978. X          (!no && *p_warn_string ? " - " : ""))),
  979. X        (text ? text : (no ? "" : p_warn_string)));
  980. X    }
  981. X
  982. Xspwarnmesg(buf,prefix,no,text)
  983. X    char    *buf;
  984. X    char    *prefix;
  985. X    int        no;
  986. X    char    *text;
  987. X    {
  988. X    sprintf(buf,"%s%s%s%s\n", (prefix ? prefix : ""),
  989. X        (no ? p_warn_text[no] : p_warn_text[pwarn]),
  990. X        ((text ? (*text ? " - " : "") : 
  991. X          (!no && *p_warn_string ? " - " : ""))),
  992. X        (text ? text : (no ? "" : p_warn_string)));
  993. X    }
  994. X#endif
  995. END_OF_FILE
  996.   if test 9027 -ne `wc -c <'./perrmesg.c'`; then
  997.     echo shar: \"'./perrmesg.c'\" unpacked with wrong size!
  998.   fi
  999.   # end of './perrmesg.c'
  1000. fi
  1001. if test -f './pfs.h' -a "${1}" != "-c" ; then 
  1002.   echo shar: Will not clobber existing file \"'./pfs.h'\"
  1003. else
  1004.   echo shar: Extracting \"'./pfs.h'\" \(13858 characters\)
  1005.   sed "s/^X//" >'./pfs.h' <<'END_OF_FILE'
  1006. X/*
  1007. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  1008. X *
  1009. X * For copying and distribution information, please see the file
  1010. X * <copyright.h>.
  1011. X *
  1012. X * v1.2.0 - 11/19/91 (mmt) - added MSDOS & OS2 stuff
  1013. X * v1.1.2 - 08/30/91 (bpk) - added VMS support
  1014. X * v1.1.1 - 08/20/91 (bpk) - 4.2 -> 4.2B
  1015. X */
  1016. X
  1017. X#include <copyright.h>
  1018. X
  1019. X#ifdef VMS
  1020. X# include <vms.h>
  1021. X#else /* not VMS */
  1022. X# ifndef _TYPES_
  1023. X#  include <sys/types.h>
  1024. X# endif /* _TYPES_ */
  1025. X# ifndef IN_H
  1026. X#  include <netinet/in.h> 
  1027. X#  define IN_H
  1028. X# endif
  1029. X#endif /* VMS */
  1030. X
  1031. X#ifndef NULL
  1032. X# if defined(MSDOS)
  1033. X#  include <stdio.h>
  1034. X# else
  1035. X#  define NULL 0
  1036. X# endif /* MSDOS */
  1037. X#endif /* NULL */
  1038. X
  1039. X#define        PFS_RELEASE    "Beta.4.2D"
  1040. X/* moved up for vdir_init */
  1041. X#define ZERO(p)        bzero((char *)(p), sizeof(*(p)))
  1042. X
  1043. X/* General Definitions */
  1044. X
  1045. X#define        MAX_PTXT_LEN    1250     /* Max length of PTEXT structure   */
  1046. X#define        MAX_PTXT_HDR    32       /* Max offset for start            */
  1047. X#define        P_ERR_STRING_SZ 100     /* Size of error string        */
  1048. X#define        MAX_VPATH    1024     /* Max length of virtual pathname  */
  1049. X
  1050. X/* Definition of text structure used to pass text around */
  1051. X
  1052. Xstruct ptext {
  1053. X    int            length;          /* Length of text (from start)    */
  1054. X    char        *start;          /* Start of text            */
  1055. X    char        dat[MAX_PTXT_LEN+2*MAX_PTXT_HDR];/* The data itself */
  1056. X    unsigned long     mbz;          /* ZERO to catch runaway strings  */
  1057. X    struct ptext    *previous;        /* Previous element in list       */
  1058. X    struct ptext    *next;          /* Next element in linked list    */
  1059. X    int            seq;          /* Sequence Number            */
  1060. X};
  1061. X
  1062. Xtypedef struct ptext *PTEXT;
  1063. Xtypedef struct ptext PTEXT_ST;
  1064. X
  1065. X/* Request structure: maintains information about server requests */
  1066. Xstruct preq {
  1067. X    int            cid;          /* Connection ID                  */
  1068. X    short        priority;      /* Connection priority            */
  1069. X    int            pf_priority;      /* Priority assigned by pri_func  */
  1070. X    int            recv_tot;      /* Total # of packets received    */
  1071. X    int            trns_tot;      /* Total # of packets to transmit */
  1072. X    struct ptext    *cpkt;          /* Current packet being filled in */
  1073. X    struct ptext    *recv;          /* Received packets               */
  1074. X    struct ptext    *trns;          /* Transmitted packets            */
  1075. X    int            rcvd_thru;      /* Received all packets through # */
  1076. X    struct preq        *previous;        /* Previous element in list       */
  1077. X    struct preq        *next;          /* Next element in linked list    */
  1078. X    struct sockaddr_in    fromto;       /* Sender/Destination            */
  1079. X};
  1080. X
  1081. Xtypedef struct preq *PREQ;
  1082. Xtypedef struct preq PREQ_ST;
  1083. X
  1084. X
  1085. X/* Definition of structure containing information on virtual link */
  1086. X
  1087. Xstruct vlink {
  1088. X    int            dontfree;      /* Flag: don't free this link     */
  1089. X    char        *name;          /* Component of path name        */
  1090. X    char        linktype;      /* L = Link, U = Union, N= Native */
  1091. X    int            expanded;      /* Has a union link been expanded */
  1092. X    char        *type;            /* Type of object pointed to      */
  1093. X    struct vlink    *filters;      /* Filters associated with link   */
  1094. X    struct vlink    *replicas;      /* Replicas (* see comment below) */
  1095. X    char        *hosttype;      /* Type of hostname            */
  1096. X    char        *host;          /* Files physical location        */
  1097. X    char        *nametype;      /* Type of filename            */
  1098. X    char        *filename;      /* System level filename        */
  1099. X    long        version;      /* Version number of destination  */
  1100. X    long        f_magic_no;      /* File's magic number        */
  1101. X    struct acl        *acl;          /* ACL for link            */
  1102. X    long        dest_exp;      /* Expiration for dest of link    */
  1103. X    long        link_exp;      /* Expiration of link itself      */
  1104. X    char        *args;          /* Arguments if this is a filter  */
  1105. X    struct pattrib    *lattrib;      /* Attributes associated w/ link  */
  1106. X    struct pfile    *f_info;      /* Info to be assoicated w/ file  */
  1107. X    struct vlink    *previous;        /* Previous elt in linked list    */
  1108. X    struct vlink    *next;          /* Next element in linked list    */
  1109. X};
  1110. X
  1111. Xtypedef struct vlink *VLINK;
  1112. Xtypedef struct vlink VLINK_ST;
  1113. X
  1114. X/* * Note that vlink->replicas is not really a list of replicas of the  */
  1115. X/*   object.  Instead, it is a list of the objects returned during name */
  1116. X/*   resolution that share the same name as the current object.  Such   */
  1117. X/*   an object should only be considered a replica if it also shares    */
  1118. X/*   the same non-zero magic number.                                    */
  1119. X
  1120. X/* Definition of structure continiaing virtual directory information    */
  1121. X
  1122. Xstruct vdir {
  1123. X    int            version;      /* Version of local directory fmt  */
  1124. X    int            inc_native;      /* Include the native directory    */
  1125. X    long        magic_no;      /* Magic number of current file    */
  1126. X    struct acl        *dacl;            /* Default acl for links in dir    */
  1127. X    struct pfile    *f_info;      /* Directory file info             */
  1128. X    struct vlink    *links;          /* The directory entries         */
  1129. X    struct vlink    *lastlink;      /* Last directory entry            */
  1130. X    struct vlink    *ulinks;      /* The entries for union links     */
  1131. X    struct vdir        *previous;        /* Previous element in linked list */
  1132. X    struct vdir        *next;          /* Next element in linked list     */
  1133. X};
  1134. X
  1135. Xtypedef struct vdir *VDIR;
  1136. Xtypedef struct vdir VDIR_ST;
  1137. X
  1138. X/* Initialize directory */
  1139. X#define vdir_init(dir)  ZERO(dir)
  1140. X/* XXX: was
  1141. X
  1142. X  dir->version = 0;     dir->inc_native = 0; \
  1143. X  dir->magic_no = 0;    dir->f_info = NULL; \
  1144. X  dir->links = NULL;    dir->lastlink = NULL; \
  1145. X  dir->ulinks = NULL;   dir->dacl = NULL; \
  1146. X  dir->previous = NULL; dir->next = NULL;
  1147. X*/
  1148. X
  1149. X#define vdir_copy(d1,d2) d2->version = d1->version; \
  1150. X                         d2->inc_native = d1->inc_native; \
  1151. X                         d2->magic_no = d1->magic_no; \
  1152. X                 d2->f_info = d1->f_info; \
  1153. X                         d2->links = d1->links; \
  1154. X                         d2->lastlink = d1->lastlink; \
  1155. X                         d2->ulinks = d1->ulinks; \
  1156. X                         d2->dacl = d1->dacl; \
  1157. X                         d2->previous = d1->previous; \
  1158. X                         d2->next = d1->next; 
  1159. X                         
  1160. X/* Values of ->inc_native in vdir structure */
  1161. X#define VDIN_REALONLY    -1   /* Include native files, but not . and ..       */
  1162. X#define VDIN_NONATIVE     0   /* Do not include files from native directory   */
  1163. X#define VDIN_INCLNATIVE     1   /* Include files from native directory          */
  1164. X#define VDIN_NATIVEONLY  2   /* All entries in directory are from native dir */
  1165. X#define VDIN_PSEUDO      3   /* Directory is not real                        */
  1166. X
  1167. X
  1168. X/* Definition of structure containing information on a specific file */
  1169. X
  1170. Xunion avalue {
  1171. X    char        *ascii;        /* Character string                */
  1172. X    struct vlink    *link;        /* A link               */
  1173. X};
  1174. X
  1175. X
  1176. Xstruct pattrib {
  1177. X    char        precedence;    /* Precedence for link attribute   */
  1178. X    char        *aname;        /* Name of the attribute           */
  1179. X    char        *avtype;    /* Type of the attribute value     */
  1180. X    union avalue    value;        /* Attribute Value                 */
  1181. X    struct pattrib    *previous;      /* Previous element in linked list */
  1182. X    struct pattrib    *next;        /* Next element in linked list     */
  1183. X};
  1184. X
  1185. Xtypedef struct pattrib *PATTRIB;
  1186. Xtypedef struct pattrib PATTRIB_ST;
  1187. X
  1188. X#define     ATR_PREC_OBJECT  'O'   /* Authoritative answer for object */
  1189. X#define     ATR_PREC_LINK    'L'   /* Authoritative answer for link   */
  1190. X#define     ATR_PREC_CACHED  'C'   /* Object info cached w/ link      */
  1191. X#define     ATR_PREC_REPLACE 'R'   /* From link (replaces O)          */
  1192. X#define     ATR_PREC_ADD     'A'   /* From link (additional value)    */
  1193. X
  1194. X/* **** Incomplete **** */
  1195. Xstruct pfile {
  1196. X    int            version;      /* Version of local finfo format   */
  1197. X    long        f_magic_no;      /* Magic number of current file    */
  1198. X    long        exp;          /* Expiration date of timeout      */
  1199. X    long        ttl;          /* Time to live after reference    */
  1200. X    long        last_ref;      /* Time of last reference          */
  1201. X    struct vlink    *forward;      /* List of forwarding pointers     */
  1202. X    struct vlink    *backlinks;      /* Partial list of back links      */
  1203. X    struct pattrib    *attributes;      /* List of file attributes         */
  1204. X    struct pfile    *previous;        /* Previous element in linked list */
  1205. X    struct pfile    *next;          /* Next element in linked list     */
  1206. X};
  1207. X
  1208. Xtypedef struct pfile *PFILE;
  1209. Xtypedef struct pfile PFILE_ST;
  1210. X
  1211. X/* Definition of structure contining an access control list entry */
  1212. X
  1213. Xstruct acl {
  1214. X    int            acetype;      /* Access Contol Entry type       */
  1215. X    char        *atype;           /* Authentication type            */
  1216. X    char        *rights;          /* Rights                         */
  1217. X    char        *principals;      /* Authorized principals          */
  1218. X    struct restrict     *restrictions;    /* Restrictions on use            */
  1219. X    struct acl        *previous;        /* Previous elt in linked list    */
  1220. X    struct acl        *next;          /* Next element in linked list    */
  1221. X};
  1222. Xtypedef struct acl *ACL;
  1223. Xtypedef struct acl ACL_ST;
  1224. X
  1225. X#define ACL_NONE        0         /* Nobody authorized by ths entry */
  1226. X#define ACL_DEFAULT        1         /* System default                 */
  1227. X#define ACL_SYSTEM        2         /* System administrator           */
  1228. X#define ACL_OWNER               3         /* Directory owner                */
  1229. X#define ACL_DIRECTORY           4         /* Same as directory              */
  1230. X#define ACL_ANY                 5         /* Any user                       */
  1231. X#define ACL_AUTHENT             6         /* Authenticated principal        */
  1232. X#define ACL_LGROUP              7         /* Local group                    */
  1233. X#define ACL_GROUP               8         /* External group                 */
  1234. X#define ACL_ASRTHOST            10        /* Check host and asserted userid */
  1235. X#define ACL_TRSTHOST            11        /* ASRTHOST from privileged port  */
  1236. X
  1237. X
  1238. X/* Definition of structure contining access restrictions */
  1239. X/* for future extensions                                 */
  1240. Xstruct restrict {
  1241. X    struct acl        *previous;        /* Previous elt in linked list    */
  1242. X    struct acl        *next;          /* Next element in linked list    */
  1243. X};
  1244. X
  1245. X/* Definitions for send_to_dirsrv */
  1246. X#define    CLIENT_DIRSRV_TIMEOUT        4    /* time between retries      */
  1247. X#define CLIENT_DIRSRV_BACKOFF(x)  (2 * x)    /* Backoff algorithm         */
  1248. X#define CLIENT_DIRSRV_RETRY        3    /* retry this many times     */
  1249. X
  1250. X/* Definitions for rd_vlink and rd_vdir */
  1251. X#define        SYMLINK_NESTING 10       /* Max nesting depth for sym links */
  1252. X
  1253. X/* Definition fo check_acl */
  1254. X#define        ACL_NESTING     10       /* Max depth for ACL group nesting */
  1255. X
  1256. X/* Flags for mk_vdir */
  1257. X#define         MKVD_LPRIV     1   /* Minimize privs for creator in new ACL    */
  1258. X
  1259. X/* Flags for get_vdir */
  1260. X#define         GVD_UNION      0    /* Do not expand union links              */
  1261. X#define      GVD_EXPAND     1   /* Expand union links locally             */
  1262. X#define         GVD_LREMEXP    3   /* Request remote expansion of local links   */
  1263. X#define         GVD_REMEXP     7   /* Request remote expansion of all links     */
  1264. X#define         GVD_VERIFY     8    /* Only verify args are for a directory      */
  1265. X#define      GVD_FIND       16   /* Stop expanding when match is found        */
  1266. X#define         GVD_ATTRIB    32   /* Request attributes from remote server     */
  1267. X#define         GVD_NOSORT       64   /* Do not sort links when adding to dir      */
  1268. X
  1269. X/* Flags for rd_vdir */
  1270. X#define         RVD_UNION      GVD_UNION
  1271. X#define         RVD_EXPAND     GVD_EXPAND 
  1272. X#define         RVD_LREMEXP    GVD_LREMEXP
  1273. X#define         RVD_REMEXP     GVD_REMEXP
  1274. X#define         RVD_DFILE_ONLY GVD_VERIFY /* Only return ptr to dir file        */
  1275. X#define      RVD_FIND       GVD_FIND   
  1276. X#define      RVD_ATTRIB     GVD_ATTRIB
  1277. X#define         RVD_NOSORT        GVD_NOSORT
  1278. X#define         RVD_NOCACHE    128
  1279. X
  1280. X/* Flags for add_vlink */
  1281. X#define         AVL_UNION      1   /* Link is a union link                      */
  1282. X
  1283. X/* Flags for vl_insert */
  1284. X#define         VLI_NOCONFLICT 0   /* Do not insert links w/ conflicting names  */
  1285. X#define      VLI_ALLOW_CONF 1   /* Allow links with conflicting names        */
  1286. X#define         VLI_NOSORT     2   /* Allow conflicts and don't sort            */
  1287. X
  1288. X/* Flags for mapname */
  1289. X#define      MAP_READWRITE  0   /* Named file to be read and written         */
  1290. X#define         MAP_READONLY   1   /* Named file to be read only                */
  1291. X
  1292. X/* Flags for modify_acl */
  1293. X#define         MACL_NOSYSTEM   0x01
  1294. X#define      MACL_NOSELF     0x02
  1295. X#define      MACL_DEFAULT    0x08
  1296. X#define      MACL_SET        0x0C
  1297. X#define      MACL_INSERT     0x14
  1298. X#define      MACL_DELETE     0x10
  1299. X#define      MACL_ADD        0x1C
  1300. X#define      MACL_SUBTRACT   0x18
  1301. X#define      MACL_LINK       0x00
  1302. X#define      MACL_DIRECTORY  0x20
  1303. X#define      MACL_OBJECT     0x60
  1304. X#define      MACL_INCLUDE    0x40
  1305. X
  1306. X#define      MACL_OP    (MACL_DEFAULT|MACL_SET|MACL_INSERT|\
  1307. X             MACL_DELETE|MACL_ADD|MACL_SUBTRACT)
  1308. X
  1309. X#define      MACL_OTYPE (MACL_LINK|MACL_DIRECTORY|MACL_OBJECT|MACL_INCLUDE)
  1310. X
  1311. X/* Access methods returned by Pget_am */
  1312. X#define P_AM_ERROR            0
  1313. X#define P_AM_FTP            1
  1314. X#define P_AM_AFTP            2  /* Anonymous FTP  */
  1315. X#define P_AM_NFS            4
  1316. X#define P_AM_KNFS            8  /* Kerberized NFS */
  1317. X#define P_AM_AFS               16
  1318. X
  1319. X/* Return codes */
  1320. X
  1321. X#define        PSUCCESS    0
  1322. X#define        PFAILURE    255
  1323. X
  1324. X/* Hush up warnings.  */
  1325. Xvoid vllfree();
  1326. X
  1327. X/* Procedures in libpfs.a */
  1328. X
  1329. Xchar *pget_wdhost(), *pget_wdfile(), *pget_wd(), *pget_hdhost();
  1330. Xchar *pget_hdfile(), *pget_hd(), *pget_rdhost(), *pget_rdfile();
  1331. Xchar *pget_dhost(), *pget_dfile(), *pget_vsname(), *nlsindex();
  1332. Xchar *sindex(), *strtok(), *nxtline(), *unquote(), *stcopy();
  1333. Xchar *stcopyr(), *readheader(), *month_sname();
  1334. X
  1335. Xlong        asntotime();
  1336. X
  1337. XPTEXT        ptalloc();
  1338. XPTEXT        dirsend();
  1339. X
  1340. XPREQ        pralloc();
  1341. XPREQ        get_next_request();
  1342. X
  1343. XVLINK        rd_slink();
  1344. XVLINK        rd_vlink();
  1345. XVLINK        vl_delete();
  1346. XVLINK        vlalloc();
  1347. XVLINK        vlcopy();
  1348. X
  1349. XPFILE        pfalloc();
  1350. X
  1351. XPATTRIB         parse_attribute();
  1352. XPATTRIB         atalloc();
  1353. XPATTRIB     pget_at();
  1354. X
  1355. XACL             acalloc();
  1356. XACL             get_acl();
  1357. X
  1358. X/* Miscellaneous useful definitions */
  1359. X#ifndef TRUE
  1360. X#define TRUE        1
  1361. X#define FALSE        0
  1362. X#endif
  1363. X
  1364. X#define AUTHORIZED      1
  1365. X#define NOT_AUTHORIZED  0
  1366. X#define NEG_AUTHORIZED  -1
  1367. X
  1368. X#ifndef NULL
  1369. X#define NULL        0
  1370. X#endif
  1371. X
  1372. X#define FAILED        -1
  1373. END_OF_FILE
  1374.   if test 13858 -ne `wc -c <'./pfs.h'`; then
  1375.     echo shar: \"'./pfs.h'\" unpacked with wrong size!
  1376.   fi
  1377.   # end of './pfs.h'
  1378. fi
  1379. if test -f './vms/network.h' -a "${1}" != "-c" ; then 
  1380.   echo shar: Will not clobber existing file \"'./vms/network.h'\"
  1381. else
  1382.   echo shar: Extracting \"'./vms/network.h'\" \(4939 characters\)
  1383.   sed "s/^X//" >'./vms/network.h' <<'END_OF_FILE'
  1384. X/* Miscellaneous things for the networking library.  */
  1385. X
  1386. X/* Actually an itemlist_3, but can be used for itemlist_2's.  */
  1387. Xstruct itemlist
  1388. X{
  1389. X  short length;
  1390. X  short code;
  1391. X  char *dataptr;
  1392. X  short *retlenptr;
  1393. X};
  1394. X
  1395. Xunion socket_addr
  1396. X{
  1397. X  struct sockaddr_in in;
  1398. X};
  1399. X
  1400. X#define   TCP$SEND        (IO$_WRITEVBLK)
  1401. X#define   TCP$RECEIVE     (IO$_READVBLK)
  1402. X#define   TCP$OPEN        (IO$_CREATE)
  1403. X#define   TCP$CLOSE       (IO$_DELETE)
  1404. X#define   TCP$ABORT       (IO$_DEACCESS)
  1405. X#define   TCP$STATUS      (IO$_ACPCONTROL)
  1406. X#define   TCP$INFO        (IO$_MODIFY)
  1407. X#define   GTHST           (IO$_SKIPFILE)
  1408. X
  1409. X#define   IO$_SEND        (IO$_WRITEVBLK)
  1410. X#define   IO$_RECEIVE     (IO$_READVBLK)
  1411. X#ifndef IO$S_FCODE
  1412. X#define IO$S_FCODE 0x0006
  1413. X#endif
  1414. X#define   IO$_SOCKET      (IO$_ACCESS | (0 << IO$S_FCODE))
  1415. X#define   IO$_BIND        (IO$_ACCESS | (1 << IO$S_FCODE))
  1416. X#define   IO$_LISTEN      (IO$_ACCESS | (2 << IO$S_FCODE))
  1417. X#define   IO$_ACCEPT      (IO$_ACCESS | (3 << IO$S_FCODE))
  1418. X#define   IO$_CONNECT     (IO$_ACCESS | (4 << IO$S_FCODE))
  1419. X#define   IO$_SETSOCKOPT  (IO$_ACCESS | (5 << IO$S_FCODE))
  1420. X#define   IO$_GETSOCKOPT  (IO$_ACCESS | (6 << IO$S_FCODE))
  1421. X#define   IO$_IOCTL       (IO$_ACCESS | (8 << IO$S_FCODE))
  1422. X#define   IO$_ACCEPT_WAIT (IO$_ACCESS | (10 << IO$S_FCODE))
  1423. X#define   IO$_NETWORK_PTY (IO$_ACCESS | (11 << IO$S_FCODE))
  1424. X#define   IO$_SHUTDOWN    (IO$_ACCESS | (12 << IO$S_FCODE))
  1425. X#define   IO$_GETSOCKNAME (IO$_ACCESS | (13 << IO$S_FCODE))
  1426. X#define      SETCHAR_HANDOFF (1<<2)
  1427. X
  1428. X#define   NFB$C_DECLNAME   0x15
  1429. X
  1430. X#define TIMER_EFN 1
  1431. X#define TERM_EFN  2
  1432. X#define BUF_SIZE 2000
  1433. X
  1434. X#define INITIALISED 0
  1435. X#define ACTIVE_CONNECTION 1
  1436. X#define PASSIVE_CONNECTION 2
  1437. X#define LISTENING 3
  1438. X#define HANDED_OFF 4
  1439. X
  1440. Xstatic struct fd_entry
  1441. X{
  1442. X  unsigned short int channel;    /* vms channel assigned to this socket */
  1443. X  unsigned short int iosb[4];    /* returned status block */
  1444. X  int fd_buff_size;        /* number of chrs in buffer still to be read */
  1445. X  int accept_pending;        /* a call is waiting to be accepted */
  1446. X  int connect_pending;        /* a connect is outstanding*/
  1447. X  int connected;        /* this descriptor is connected */
  1448. X  unsigned char *fd_buff;    /* pointer to buffer dyn assigned */
  1449. X  unsigned char *fd_leftover;    /* pointer to any chrs still to be read */
  1450. X  FILE *fptr;            /* we need to assgn a file ptr for stream io */
  1451. X  int s;            /* socket number - needed in the ast's */
  1452. X  int namelen;            /* our socket address name */
  1453. X  union socket_addr name;
  1454. X  short int fromdummy;        /* wg - accept wants an int - recvfrom wants a short!!*/
  1455. X  short int fromlen;        /* the from socket address name */
  1456. X  union socket_addr from;
  1457. X  int tolen;            /* wg - sendto wants an int*/
  1458. X  union socket_addr to;        /* the to socket address name */
  1459. X  int passive;            /* still needed because of x25 close ambig */
  1460. X  int backlog;            /* backlog - not handled well! */
  1461. X  int domain;            /* domain of socket AF_INET or AF_X25 */
  1462. X  int type;            /* type of socket stream or datagram */
  1463. X  int protocol;            /* protocol of socket - ignored */
  1464. X  int mbx_channel;        /* mailbox channel - needed for x25 */
  1465. X  unsigned char mbx_buff[255];    /* mailbox buffer */
  1466. X  unsigned short int miosb[4];    /* mailbox status block */
  1467. X  int ncb_size;            /* x25 connection information */
  1468. X  unsigned char ncb[128];
  1469. X  unsigned char masklen;    /* x25 user data mask */
  1470. X  unsigned char mask[16];
  1471. X  int need_header;        /* x25 header field gives data status if req*/
  1472. X  int send_type;        /* x25 data packet type eg more bit set etc */
  1473. X  int status;            /* status of socket */
  1474. X  int closed_by_remote;        /* flag for remote dropouts */
  1475. X  int read_outstanding;        /* flag so we don't hang two reads */
  1476. X  int cmu_open;            /* flag to say whether a cmu open was hung */
  1477. X  int x25_listener;        /* flag to say we are an x25 listener */
  1478. X  int oob_type;            /* handles interrupt messages */
  1479. X  int mother;            /* mother socket for X25 accepts */
  1480. X  int child;            /* child socket for X25 accepts */
  1481. X  int no_more_accepts;        /* don't accept anymore calls */
  1482. X  char int_data;        /* interrupt data - only 1 char supported */
  1483. X  int non_blocking;        /* don't block on a read if no data */
  1484. X  int sig_req;            /* generate SIGIO on data ready */
  1485. X  struct itemlist rhost;    /* descriptor pointing to "p[].from" info for UCX */
  1486. X  unsigned short ucx_accept_chan;    /* Channel returned by a UCX accept via hang_an_accept */
  1487. X} p[32];
  1488. X
  1489. X/* So we can handle select on terminal input.  */
  1490. Xstatic struct term_entry
  1491. X{
  1492. X  int chan;
  1493. X  short int iosb[4];
  1494. X  short int char_available;
  1495. X  short int read_outstanding;
  1496. X  char c[1];
  1497. X} terminal =
  1498. X
  1499. X{
  1500. X  -1, 0, 0, 0, 0, 0, 0
  1501. X};
  1502. X
  1503. X#define CMU 1
  1504. X#define WG  2
  1505. X#define NONE 3
  1506. X#define TGV 4
  1507. X#define UCX 5
  1508. Xstatic int tcp_make = 0;
  1509. X
  1510. Xstruct descriptor
  1511. X{
  1512. X  int size;
  1513. X  char *ptr;
  1514. X};
  1515. X
  1516. X/* Initialize certain things 1st time thru.  */
  1517. Xstatic int p_initialised = 0;
  1518. X
  1519. X/* A routine to point SIGALRM and SIGURG at.  */
  1520. Xstatic int 
  1521. Xsi_dummy ()
  1522. X{
  1523. X}
  1524. Xstatic int (*alarm_function) () = si_dummy;
  1525. Xstatic int (*sigurg_function) () = si_dummy;
  1526. X
  1527. XFILE *fdopen ();
  1528. Xstatic set_tcp_make ();
  1529. Xstatic char *getdevicename ();
  1530. END_OF_FILE
  1531.   if test 4939 -ne `wc -c <'./vms/network.h'`; then
  1532.     echo shar: \"'./vms/network.h'\" unpacked with wrong size!
  1533.   fi
  1534.   # end of './vms/network.h'
  1535. fi
  1536. echo shar: End of archive 3 \(of 5\).
  1537. cp /dev/null ark3isdone
  1538. MISSING=""
  1539. for I in 1 2 3 4 5 ; do
  1540.     if test ! -f ark${I}isdone ; then
  1541.     MISSING="${MISSING} ${I}"
  1542.     fi
  1543. done
  1544. if test "${MISSING}" = "" ; then
  1545.     echo You have unpacked all 5 archives.
  1546.     rm -f ark[1-9]isdone
  1547. else
  1548.     echo You still must unpack the following archives:
  1549.     echo "        " ${MISSING}
  1550. fi
  1551. exit 0
  1552. exit 0 # Just in case...
  1553.