home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / xarchie / part15 < prev    next >
Encoding:
Text File  |  1993-06-14  |  50.4 KB  |  1,879 lines

  1. Newsgroups: comp.sources.x
  2. From: ferguson@cs.rochester.edu (George Ferguson)
  3. Subject: v20i043:  xarchie - An X browser interface to Archie, v2.0.6, Part15/24
  4. Message-ID: <1993Jun15.223419.1067@sparky.imd.sterling.com>
  5. X-Md4-Signature: bfe14d006f8fe8afdcf6d00d5d6a588f
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 15 Jun 1993 22:34:19 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: ferguson@cs.rochester.edu (George Ferguson)
  12. Posting-number: Volume 20, Issue 43
  13. Archive-name: xarchie/part15
  14. Environment: X11
  15. Supersedes: xarchie: Volume 14, Issue 82-90
  16.  
  17. Submitted-by: ferguson@cs.rochester.edu
  18. Archive-name: xarchie-2.0.6/part15
  19.  
  20. #!/bin/sh
  21. # this is Part.15 (part 15 of xarchie-2.0.6)
  22. # do not concatenate these parts, unpack them in order with /bin/sh
  23. # file xarchie-2.0.6/settings.c continued
  24. #
  25. if test ! -r _shar_seq_.tmp; then
  26.     echo 'Please unpack part 1 first!'
  27.     exit 1
  28. fi
  29. (read Scheck
  30.  if test "$Scheck" != 15; then
  31.     echo Please unpack part "$Scheck" next!
  32.     exit 1
  33.  else
  34.     exit 0
  35.  fi
  36. ) < _shar_seq_.tmp || exit 1
  37. if test ! -f _shar_wnt_.tmp; then
  38.     echo 'x - still skipping xarchie-2.0.6/settings.c'
  39. else
  40. echo 'x - continuing file xarchie-2.0.6/settings.c'
  41. sed 's/^X//' << 'SHAR_EOF' >> 'xarchie-2.0.6/settings.c' &&
  42. X
  43. X    if (*num_params != 1) {
  44. X    alert0("Incorrect number of arguments to set-sort-type()");
  45. X    return;
  46. X    }
  47. X    from.addr = *params;
  48. X    from.size = sizeof(String);
  49. X    to.addr = NULL;
  50. X    XtConvert(w,XtRString,&from,GfRSortType,&to);
  51. X    if (to.addr != NULL)
  52. X    updateSettingsSortType((SortType)(*(to.addr)));
  53. X    setSettingsChangedFlag(True);
  54. }
  55. X
  56. /*
  57. X * setNiceLevelAction() : Action procedure to set rdgram_priority
  58. X */
  59. /*ARGSUSED*/
  60. static
  61. ACTION_PROC(setNiceLevelAction)
  62. {
  63. X    char buf[8];
  64. X    int n;
  65. X
  66. X    if (*num_params != 1) {
  67. X    alert0("Incorrect number of arguments to set-nice-level()");
  68. X    return;
  69. X    }
  70. X    if (setNiceText == NULL) {
  71. X       alert0("set-nice-level() has no effect since niceText was not created");
  72. X    return;
  73. X    }
  74. X    n = atoi(*params);
  75. X    if (n < RDGRAM_MIN_PRI) {
  76. X    alert1("Nice level too negative: %d",(char *)n);
  77. X    sprintf(buf,"%d",RDGRAM_MIN_PRI);
  78. X    setWidgetString(setNiceText,buf);
  79. X    } else if (n > RDGRAM_MAX_PRI) {
  80. X    alert1("Nice level too positive: %d",(char *)n);
  81. X    sprintf(buf,"%d",RDGRAM_MAX_PRI);
  82. X    setWidgetString(setNiceText,buf);
  83. X    } else {
  84. X    setWidgetString(setNiceText,*params);
  85. X    }
  86. X    setSettingsChangedFlag(True);
  87. }
  88. X
  89. /*    -    -    -    -    -    -    -    -    */
  90. /* These actions are like their non-Now counterparts, expect that
  91. X * (a) they set appResources immediately rather than waiting for
  92. X *     apply-settings() to be called, and
  93. X * (b) they do not set the changedFlag since they have made the change
  94. X *     globally already.
  95. X * Still, they really aren't meant to be used when the settingsPanel is
  96. X * being displayed.
  97. X */
  98. X
  99. /*ARGSUSED*/
  100. static
  101. ACTION_PROC(setSearchTypeNowAction)
  102. {
  103. X    XrmValue from,to;
  104. X    SearchType type;
  105. X
  106. X    if (*num_params != 1) {
  107. X    alert0("Incorrect number of arguments to set-search-type-now()");
  108. X    return;
  109. X    }
  110. X    from.addr = *params;
  111. X    from.size = sizeof(String);
  112. X    to.addr = NULL;
  113. X    XtConvertAndStore(w,XtRString,&from,GfRSearchType,&to);
  114. X    if (to.addr != NULL) {
  115. X    type = (SearchType)(*(to.addr));
  116. X    appResources.searchType = type;
  117. X    status1("Set search type to %s",*params);
  118. X    updateSettingsSearchType(type);
  119. X    }
  120. }
  121. X
  122. /*ARGSUSED*/
  123. static
  124. ACTION_PROC(setSortTypeNowAction)
  125. {
  126. X    XrmValue from,to;
  127. X    SortType type;
  128. X
  129. X    if (*num_params != 1) {
  130. X    alert0("Incorrect number of arguments to set-sort-type-now()");
  131. X    return;
  132. X    }
  133. X    from.addr = *params;
  134. X    from.size = sizeof(String);
  135. X    to.addr = NULL;
  136. X    XtConvertAndStore(w,XtRString,&from,GfRSortType,&to);
  137. X    if (to.addr != NULL) {
  138. X    type = (SortType)(*(to.addr));
  139. X    appResources.sortType = type;
  140. X    status1("Set sort type to %s",*params);
  141. X    updateSettingsSortType(type);
  142. X    }
  143. }
  144. X
  145. /*ARGSUSED*/
  146. static
  147. ACTION_PROC(setHostNowAction)
  148. {
  149. X    if (*num_params != 1) {
  150. X    alert0("Incorrect number of arguments to set-host-now()");
  151. X    return;
  152. X    }
  153. X    XtFree(appResources.archieHost);
  154. X    appResources.archieHost = XtNewString(*params);
  155. X    status1("Set host to %s",*params);
  156. X    setWidgetString(setHostText,*params);
  157. }
  158. X
  159. /*ARGSUSED*/
  160. static
  161. ACTION_PROC(setNiceLevelNowAction)
  162. {
  163. X    int n;
  164. X
  165. X    if (*num_params != 1) {
  166. X    alert0("Incorrect number of arguments to set-nice-level-now()");
  167. X    return;
  168. X    }
  169. X    n = atoi(*params);
  170. X    if (n < RDGRAM_MIN_PRI) {
  171. X    alert1("Nice level too negative: %d -- not set",(char *)n);
  172. X    } else if (n > RDGRAM_MAX_PRI) {
  173. X    alert1("Nice level too positive: %d -- not set",(char *)n);
  174. X    } else {
  175. X    appResources.niceLevel = n;
  176. X    status1("Set niceLevel to %d",(char *)n);
  177. X    setWidgetString(setNiceText,*params);
  178. X    }
  179. }
  180. X
  181. /*    -    -    -    -    -    -    -    -    */
  182. /*
  183. X * textEventProc() : Called whenever the user types in any Text item.
  184. X *      Note that this does NOT detect, eg., selection pastes, as
  185. X *    documented in the BUGS section of the man page.
  186. X */
  187. /*ARGSUSED*/
  188. static void
  189. textEventProc(w,client_data,event,continue_flag)
  190. Widget w;
  191. XXtPointer client_data;
  192. XXEvent *event;
  193. Boolean *continue_flag;
  194. {
  195. X    setSettingsChangedFlag(True);
  196. }
  197. X
  198. /*    -    -    -    -    -    -    -    -    */
  199. X
  200. void
  201. updateSettingsHost(str)
  202. char *str;
  203. {
  204. X    setWidgetString(setHostText,str);
  205. }
  206. X
  207. void
  208. updateSettingsSearchType(type)
  209. SearchType type;
  210. {
  211. X    currentSearchType = type;
  212. X    setWidgetLabel(setSearchLabel,searchTypeToString(type));
  213. }
  214. X
  215. void
  216. updateSettingsSortType(type)
  217. SortType type;
  218. {
  219. X    currentSortType = type;
  220. X    setWidgetLabel(setSortLabel,sortTypeToString(type));
  221. X    if (type == GfWeight) {
  222. X    XtMapWidget(setHostWeightsLabel);
  223. X    XtMapWidget(setHostWeightsText);
  224. X    } else {
  225. X    XtUnmapWidget(setHostWeightsLabel);
  226. X    XtUnmapWidget(setHostWeightsText);
  227. X    }
  228. }
  229. X
  230. void
  231. updateSettingsNiceLevel(level)
  232. int level;
  233. {
  234. X    char buf[16];
  235. X
  236. X    sprintf(buf,"%d",level);
  237. X    setWidgetString(setNiceText,buf);
  238. }
  239. X
  240. void
  241. updateSettingsAutoScroll(flag)
  242. Boolean flag;
  243. {
  244. X    currentAutoScroll = flag;
  245. X    setWidgetLabel(setAutoScrollLabel,(flag?"yes":"no"));
  246. }
  247. X
  248. void
  249. updateSettingsFtpType(type)
  250. String type;
  251. {
  252. X    setWidgetLabel(ftpTypeLabel,type);
  253. }
  254. X
  255. void
  256. updateSettingsFtpPrompt(flag)
  257. Boolean flag;
  258. {
  259. X    currentFtpPrompt = flag;
  260. X    setWidgetLabel(ftpPromptLabel,(flag?"yes":"no"));
  261. }
  262. X
  263. void
  264. updateSettingsFtpTrace(flag)
  265. Boolean flag;
  266. {
  267. X    currentFtpTrace = flag;
  268. X    setWidgetLabel(ftpTraceLabel,(flag?"yes":"no"));
  269. }
  270. X
  271. void
  272. updateSettingsFtpStrip(flag)
  273. Boolean flag;
  274. {
  275. X    currentFtpStrip = flag;
  276. X    setWidgetLabel(ftpStripLabel,(flag?"yes":"no"));
  277. }
  278. X
  279. /*    -    -    -    -    -    -    -    -    */
  280. X
  281. void
  282. setSettingsChangedFlag(value)
  283. Boolean value;
  284. {
  285. X    if (setApplyButton != NULL)
  286. X    XtSetSensitive(setApplyButton,value);
  287. X    settingsChanged = value;
  288. }
  289. X
  290. /*    -    -    -    -    -    -    -    -    */
  291. /* Routines for the popup Dismiss confirmer */
  292. X
  293. static Widget settingsConfirmShell;
  294. static int settingsConfirmResult;
  295. X
  296. static int
  297. settingsConfirm()
  298. {
  299. X    if (settingsConfirmShell == NULL)
  300. X    settingsConfirmShell =
  301. X        createPopup("settingsConfirm",3,settingsConfirmCallback);
  302. X    setPopupLabel(settingsConfirmShell,"settingsConfirm",
  303. X          "Dismiss without applying changes?");
  304. X    popupMainLoop(settingsConfirmShell);
  305. X    return(settingsConfirmResult);
  306. }
  307. /*ARGSUSED*/
  308. static void
  309. settingsConfirmCallback(w,client_data,call_data)
  310. Widget w;
  311. XXtPointer client_data;        /* button number */
  312. XXtPointer call_data;
  313. {
  314. X    switch ((int)client_data) {
  315. X      case 0:            /* Dismiss */
  316. X    settingsConfirmResult = 1;
  317. X    break;
  318. X      case 1:            /* Apply */
  319. X    applySettingsAction(w,NULL,NULL,0);
  320. X    settingsConfirmResult = 1;
  321. X    break;
  322. X      case 2:            /* Cancel */
  323. X    settingsConfirmResult = 0;
  324. X    break;
  325. X    }
  326. X    popupDone();
  327. }
  328. SHAR_EOF
  329. echo 'File xarchie-2.0.6/settings.c is complete' &&
  330. chmod 0644 xarchie-2.0.6/settings.c ||
  331. echo 'restore of xarchie-2.0.6/settings.c failed'
  332. Wc_c="`wc -c < 'xarchie-2.0.6/settings.c'`"
  333. test 22108 -eq "$Wc_c" ||
  334.     echo 'xarchie-2.0.6/settings.c: original size 22108, current size' "$Wc_c"
  335. rm -f _shar_wnt_.tmp
  336. fi
  337. # ============= xarchie-2.0.6/settings.h ==============
  338. if test -f 'xarchie-2.0.6/settings.h' -a X"$1" != X"-c"; then
  339.     echo 'x - skipping xarchie-2.0.6/settings.h (File already exists)'
  340.     rm -f _shar_wnt_.tmp
  341. else
  342. > _shar_wnt_.tmp
  343. echo 'x - extracting xarchie-2.0.6/settings.h (Text)'
  344. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/settings.h' &&
  345. /*
  346. X * settings.h : External defs for the settings panel
  347. X *
  348. X * George Ferguson, ferguson@cs.rochester.edu, 22 Oct 1991.
  349. X * Version 2.0: 23 Apr 1993.
  350. X */
  351. X
  352. #ifndef SETTINGS_H
  353. #define SETTINGS_H
  354. X
  355. extern void initSettings(),reinitSettings();
  356. extern void setSettingsShellState();
  357. extern void updateSettingsHost(),updateSettingsSearchType();
  358. extern void updateSettingsSortType(),updateSettingsNiceLevel();
  359. extern void updateSettingsAutoScroll();
  360. extern void updateSettingsFtpType(),updateSettingsFtpPrompt();
  361. extern void updateSettingsFtpTrace(),updateSettingsFtpStrip();
  362. extern void setSettingsChangedFlag();
  363. X
  364. #endif /* SETTINGS_H */
  365. SHAR_EOF
  366. chmod 0644 xarchie-2.0.6/settings.h ||
  367. echo 'restore of xarchie-2.0.6/settings.h failed'
  368. Wc_c="`wc -c < 'xarchie-2.0.6/settings.h'`"
  369. test 628 -eq "$Wc_c" ||
  370.     echo 'xarchie-2.0.6/settings.h: original size 628, current size' "$Wc_c"
  371. rm -f _shar_wnt_.tmp
  372. fi
  373. # ============= xarchie-2.0.6/status.c ==============
  374. if test -f 'xarchie-2.0.6/status.c' -a X"$1" != X"-c"; then
  375.     echo 'x - skipping xarchie-2.0.6/status.c (File already exists)'
  376.     rm -f _shar_wnt_.tmp
  377. else
  378. > _shar_wnt_.tmp
  379. echo 'x - extracting xarchie-2.0.6/status.c (Text)'
  380. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/status.c' &&
  381. /*
  382. X * status.c : Display-independent status indication routines
  383. X *
  384. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  385. X */
  386. X
  387. #include <stdio.h>
  388. extern void setStatusText();        /* display.c */
  389. X
  390. /*
  391. X * Functions defined here:
  392. X */
  393. void status0(), status1(), status2();
  394. X
  395. /*    -    -    -    -    -    -    -    -    */
  396. X
  397. void
  398. status0(str)
  399. char *str;
  400. {
  401. X    setStatusText(str);
  402. }
  403. X
  404. void
  405. status1(fmt,arg)
  406. char *fmt,*arg;
  407. {
  408. X    char buf[256];
  409. X
  410. X    sprintf(buf,fmt,arg);
  411. X    status0(buf);
  412. }
  413. X
  414. void
  415. status2(fmt,arg1,arg2)
  416. char *fmt,*arg1,*arg2;
  417. {
  418. X    char buf[256];
  419. X
  420. X    sprintf(buf,fmt,arg1,arg2);
  421. X    status0(buf);
  422. }
  423. SHAR_EOF
  424. chmod 0644 xarchie-2.0.6/status.c ||
  425. echo 'restore of xarchie-2.0.6/status.c failed'
  426. Wc_c="`wc -c < 'xarchie-2.0.6/status.c'`"
  427. test 584 -eq "$Wc_c" ||
  428.     echo 'xarchie-2.0.6/status.c: original size 584, current size' "$Wc_c"
  429. rm -f _shar_wnt_.tmp
  430. fi
  431. # ============= xarchie-2.0.6/status.h ==============
  432. if test -f 'xarchie-2.0.6/status.h' -a X"$1" != X"-c"; then
  433.     echo 'x - skipping xarchie-2.0.6/status.h (File already exists)'
  434.     rm -f _shar_wnt_.tmp
  435. else
  436. > _shar_wnt_.tmp
  437. echo 'x - extracting xarchie-2.0.6/status.h (Text)'
  438. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/status.h' &&
  439. /*
  440. X * status.h
  441. X *
  442. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  443. X */
  444. X
  445. extern void status0(), status1(), status2();
  446. SHAR_EOF
  447. chmod 0644 xarchie-2.0.6/status.h ||
  448. echo 'restore of xarchie-2.0.6/status.h failed'
  449. Wc_c="`wc -c < 'xarchie-2.0.6/status.h'`"
  450. test 128 -eq "$Wc_c" ||
  451.     echo 'xarchie-2.0.6/status.h: original size 128, current size' "$Wc_c"
  452. rm -f _shar_wnt_.tmp
  453. fi
  454. # ============= xarchie-2.0.6/stcopy.c ==============
  455. if test -f 'xarchie-2.0.6/stcopy.c' -a X"$1" != X"-c"; then
  456.     echo 'x - skipping xarchie-2.0.6/stcopy.c (File already exists)'
  457.     rm -f _shar_wnt_.tmp
  458. else
  459. > _shar_wnt_.tmp
  460. echo 'x - extracting xarchie-2.0.6/stcopy.c (Text)'
  461. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/stcopy.c' &&
  462. /*
  463. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  464. X *
  465. X * For copying and distribution information, please see the file
  466. X * <copyright.h>.
  467. X *
  468. X * v1.2.0 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
  469. X */
  470. X
  471. #include <copyright.h>
  472. #include <stdio.h>
  473. X
  474. #include "config.h"                /* gf */
  475. #include "stringdefs.h"                /* gf */
  476. X
  477. #if defined(MSDOS)
  478. # include <stdlib.h>
  479. #endif
  480. X
  481. char    *stcopyr();
  482. X
  483. int    string_count = 0;
  484. int    string_max = 0;
  485. X
  486. /*
  487. X * stcopy - allocate space for and copy a string
  488. X *
  489. X *     STCOPY takes a string as an argument, allocates space for
  490. X *     a copy of the string, copies the string to the allocated space,
  491. X *     and returns a pointer to the copy.
  492. X */
  493. X
  494. char *
  495. stcopy(st)
  496. X    char    *st;
  497. X    {
  498. X      if (!st) return(NULL);
  499. X      if (string_max < ++string_count) string_max = string_count;
  500. X
  501. X      return strcpy((char *)malloc(strlen(st) + 1), st);
  502. X    }
  503. X
  504. /*
  505. X * stcopyr - copy a string allocating space if necessary
  506. X *
  507. X *     STCOPYR takes a string, S, as an argument, and a pointer to a second
  508. X *     string, R, which is to be replaced by S.  If R is long enough to
  509. X *     hold S, S is copied.  Otherwise, new space is allocated, and R is
  510. X *     freed.  S is then copied to the newly allocated space.  If S is
  511. X *     NULL, then R is freed and NULL is returned.
  512. X *
  513. X *     In any event, STCOPYR returns a pointer to the new copy of S,
  514. X *     or a NULL pointer.
  515. X */
  516. char *
  517. stcopyr(s,r)
  518. X    char    *s;
  519. X    char    *r;
  520. X    {
  521. X    int    sl;
  522. X
  523. X    if(!s && r) {
  524. X        free(r);
  525. X        string_count--;
  526. X        return(NULL);
  527. X    }
  528. X    else if (!s) return(NULL);
  529. X
  530. X    sl = strlen(s) + 1;
  531. X
  532. X    if(r) {
  533. X        if ((strlen(r) + 1) < sl) {
  534. X        free(r);
  535. X        r = (char *) malloc(sl);
  536. X        }
  537. X    }
  538. X    else {
  539. X        r = (char *) malloc(sl);
  540. X        string_count++;
  541. X        if(string_max < string_count) string_max = string_count;
  542. X    }
  543. X        
  544. X    return strcpy(r,s);
  545. X    }
  546. X
  547. /*
  548. X * stfree - free space allocated by stcopy or stalloc
  549. X *
  550. X *     STFREE takes a string that was returned by stcopy or stalloc 
  551. X *     and frees the space that was allocated for the string.
  552. X */
  553. void
  554. stfree(st)
  555. X    char *st;
  556. X    {
  557. X    if(st) {
  558. X        free(st);
  559. X        string_count--;
  560. X    }
  561. X    }
  562. X
  563. X
  564. SHAR_EOF
  565. chmod 0644 xarchie-2.0.6/stcopy.c ||
  566. echo 'restore of xarchie-2.0.6/stcopy.c failed'
  567. Wc_c="`wc -c < 'xarchie-2.0.6/stcopy.c'`"
  568. test 2123 -eq "$Wc_c" ||
  569.     echo 'xarchie-2.0.6/stcopy.c: original size 2123, current size' "$Wc_c"
  570. rm -f _shar_wnt_.tmp
  571. fi
  572. # ============= xarchie-2.0.6/strcasecmp.c ==============
  573. if test -f 'xarchie-2.0.6/strcasecmp.c' -a X"$1" != X"-c"; then
  574.     echo 'x - skipping xarchie-2.0.6/strcasecmp.c (File already exists)'
  575.     rm -f _shar_wnt_.tmp
  576. else
  577. > _shar_wnt_.tmp
  578. echo 'x - extracting xarchie-2.0.6/strcasecmp.c (Text)'
  579. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/strcasecmp.c' &&
  580. /*
  581. X * strcasecmp.c : Case-insensitive string comparison routines
  582. X *
  583. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  584. X */
  585. X
  586. #define ISUPPER(C) ((C) >= 'A' && (C) <= 'Z')
  587. #define TOLOWER(C) ((C) - 'A' + 'a')
  588. #define NORMAL(C) (ISUPPER(C) ? TOLOWER(C) : (C))
  589. X
  590. int
  591. strcasecmp(s1,s2)
  592. char *s1,*s2;
  593. {
  594. X    char c1,c2;
  595. X
  596. X    while (1) {
  597. X    c1 = NORMAL(*s1);
  598. X    c2 = NORMAL(*s2);
  599. X    if (c1 != c2)
  600. X        return(c1-c2);
  601. X    else if (c1 == '\0')
  602. X        return(0);
  603. X    else {
  604. X        s1 += 1;
  605. X        s2 += 1;
  606. X    }
  607. X    }
  608. X    /*NOTREACHED*/
  609. }
  610. X
  611. int
  612. strncasecmp(s1,s2,n)
  613. char *s1,*s2;
  614. int n;
  615. {
  616. X    char c1,c2;
  617. X
  618. X    while (n-- > 0) {
  619. X    c1 = NORMAL(*s1);
  620. X    c2 = NORMAL(*s2);
  621. X    if (c1 != c2)
  622. X        return(c1-c2);
  623. X    else if (c1 == '\0')
  624. X        return(0);
  625. X    else {
  626. X        s1 += 1;
  627. X        s2 += 1;
  628. X    }
  629. X    }
  630. X    return(0);
  631. }
  632. SHAR_EOF
  633. chmod 0644 xarchie-2.0.6/strcasecmp.c ||
  634. echo 'restore of xarchie-2.0.6/strcasecmp.c failed'
  635. Wc_c="`wc -c < 'xarchie-2.0.6/strcasecmp.c'`"
  636. test 776 -eq "$Wc_c" ||
  637.     echo 'xarchie-2.0.6/strcasecmp.c: original size 776, current size' "$Wc_c"
  638. rm -f _shar_wnt_.tmp
  639. fi
  640. # ============= xarchie-2.0.6/stringdefs.h ==============
  641. if test -f 'xarchie-2.0.6/stringdefs.h' -a X"$1" != X"-c"; then
  642.     echo 'x - skipping xarchie-2.0.6/stringdefs.h (File already exists)'
  643.     rm -f _shar_wnt_.tmp
  644. else
  645. > _shar_wnt_.tmp
  646. echo 'x - extracting xarchie-2.0.6/stringdefs.h (Text)'
  647. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/stringdefs.h' &&
  648. /*
  649. X * stringdefs.h : Include defs of string functions
  650. X *
  651. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  652. X *
  653. X * This is based on the example from the Autoconf manual.
  654. X */
  655. X
  656. #include "config.h"
  657. X
  658. #if STDC_HEADERS || HAVE_STRING_H
  659. # include <string.h>
  660. /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
  661. # if !STDC_HEADERS && HAVE_MEMORY_H
  662. #  include <memory.h>
  663. # endif /* not STDC_HEADERS and HAVE_MEMORY_H */
  664. # ifndef index
  665. #  define index strchr
  666. # endif
  667. # ifndef rindex
  668. #  define rindex strrchr
  669. # endif
  670. # ifndef bcopy
  671. #  define bcopy(s, d, n) memcpy ((d), (s), (n))
  672. #  define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
  673. #  define bzero(s, n) memset ((s), 0, (n))
  674. # endif
  675. #else /* not STDC_HEADERS and not HAVE_STRING_H */
  676. # include <strings.h>
  677. /* memory.h and strings.h conflict on some systems.  */
  678. #endif /* not STDC_HEADERS and not HAVE_STRING_H */
  679. X
  680. #ifndef HAVE_STRCASECMP
  681. #if NeedFunctionPrototypes || defined(FUNCPROTO)
  682. #include <sys/types.h>
  683. extern int strcasecmp(const char *, const char *);
  684. extern int strncasecmp(const char *, const char *, size_t);
  685. #else
  686. extern int strcasecmp(),strncasecmp();
  687. #endif
  688. #endif
  689. SHAR_EOF
  690. chmod 0644 xarchie-2.0.6/stringdefs.h ||
  691. echo 'restore of xarchie-2.0.6/stringdefs.h failed'
  692. Wc_c="`wc -c < 'xarchie-2.0.6/stringdefs.h'`"
  693. test 1136 -eq "$Wc_c" ||
  694.     echo 'xarchie-2.0.6/stringdefs.h: original size 1136, current size' "$Wc_c"
  695. rm -f _shar_wnt_.tmp
  696. fi
  697. # ============= xarchie-2.0.6/support.c ==============
  698. if test -f 'xarchie-2.0.6/support.c' -a X"$1" != X"-c"; then
  699.     echo 'x - skipping xarchie-2.0.6/support.c (File already exists)'
  700.     rm -f _shar_wnt_.tmp
  701. else
  702. > _shar_wnt_.tmp
  703. echo 'x - extracting xarchie-2.0.6/support.c (Text)'
  704. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/support.c' &&
  705. /*
  706. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  707. X *
  708. X * For copying and distribution information, please see the file
  709. X * <copyright.h>.
  710. X *
  711. X * gf xarchie v2.0 - Sync with archie v1.4.1.
  712. X *             Changed to include stringdefs.h.
  713. X *             Changed to use HAVE_STRSPN from config.h.
  714. X */
  715. X
  716. /*
  717. X * Miscellaneous routines pulled from ~beta/lib/pfs and ~beta/lib/filters
  718. X */
  719. X
  720. #include <copyright.h>
  721. #include <stdio.h>
  722. #include <errno.h>
  723. X
  724. #ifdef VMS
  725. # ifdef WOLLONGONG
  726. #  include "twg$tcp:[netdist.include]netdb.h"
  727. # else /* not Wollongong */
  728. #  ifdef UCX
  729. #   include <netdb.h>
  730. #  else /* Multinet */
  731. #   include "multinet_root:[multinet.include]netdb.h"
  732. #  endif
  733. # endif
  734. # include <vms.h>
  735. #else /* not VMS */
  736. # include <sys/types.h>
  737. # include "config.h"                /* gf */
  738. # include "stringdefs.h"            /* gf */
  739. # ifndef CUTCP
  740. #  include <netdb.h>
  741. # endif
  742. # if !defined(MSDOS) || defined(OS2)
  743. #  include <sys/file.h>
  744. #  include <sys/param.h>
  745. # endif
  746. #endif /* VMS */
  747. X
  748. #include <pfs.h>
  749. #include <pprot.h>
  750. #include <perrno.h>
  751. #include <pcompat.h>
  752. #include <pauthent.h>
  753. X
  754. #include "regex.h"
  755. X
  756. int    pfs_enable = PMAP_ATSIGN;
  757. X
  758. #ifndef FALSE
  759. # define TRUE     1
  760. # define FALSE   0
  761. #endif
  762. X
  763. /* 
  764. X * wcmatch - Match string s against template containing widlcards
  765. X *
  766. X *         WCMATCH takes a string and a template, and returns
  767. X *         true if the string matches the template, and 
  768. X *         FALSE otherwise.
  769. X *
  770. X *    ARGS:  s        - string to be tested
  771. X *           template - Template containing optional wildcards
  772. X *
  773. X * RETURNS:  TRUE (non-zero) on match.  FALSE (0) otherwise.
  774. X *
  775. X *    NOTE:  If template is NULL, will return TRUE.
  776. X *
  777. X */
  778. int
  779. wcmatch(s,template)
  780. X    char    *s;
  781. X    char    *template;
  782. X    {
  783. X    char    temp[200];
  784. X    char    *p = temp;
  785. X
  786. X    if(!template) return(TRUE);
  787. X    *p++ = '^';
  788. X
  789. X    while(*template) {
  790. X        if(*template == '*') {*(p++)='.'; *(p++) = *(template++);}
  791. X        else if(*template == '?') {*(p++)='.';template++;}
  792. X        else if(*template == '.') {*(p++)='\\';*(p++)='.';template++;}
  793. X        else if(*template == '[') {*(p++)='\\';*(p++)='[';template++;}
  794. X        else if(*template == '$') {*(p++)='\\';*(p++)='$';template++;}
  795. X        else if(*template == '^') {*(p++)='\\';*(p++)='^';template++;}
  796. X        else if(*template == '\\') {*(p++)='\\';*(p++)='\\';template++;}
  797. X        else *(p++) = *(template++);
  798. X    }
  799. X        
  800. X    *p++ = '$';
  801. X    *p++ = '\0';
  802. X
  803. X    if(re_comp(temp)) return(FALSE);
  804. X
  805. #ifdef AUX
  806. X    if (re_exec(s) == (char *)NULL)
  807. X      return 0;
  808. X    return 1;
  809. #else
  810. X    return(re_exec(s));
  811. #endif
  812. X    }
  813. X
  814. /*
  815. X * ul_insert - Insert a union link at the right location
  816. X *
  817. X *             UL_INSERT takes a directory and a union link to be added
  818. X *             to a the list of union links in the directory.  It then
  819. X *             inserts the union link in the right spot in the linked
  820. X *             list of union links associated with that directory.
  821. X *
  822. X *           If an identical link already exists, then the link which
  823. X *             would be evaluated earlier (closer to the front of the list)
  824. X *             wins and the other one is freed.  If this happens, an error
  825. X *             will also be returned.
  826. X *        
  827. X *    ARGS:    ul    - link to be inserted
  828. X *           vd    - directory to get link
  829. X *             p     - vl that this link will apper after
  830. X *                     NULL - This vl will go at end of list
  831. X *                     vd   - This vl will go at head of list
  832. X *
  833. X * RETURNS:    Success, or UL_INSERT_ALREADY_THERE or UL_INSERT_SUPERSEDING
  834. X */
  835. int
  836. ul_insert(ul,vd,p)
  837. X    VLINK    ul;        /* Link to be inserted                   */
  838. X    PVDIR    vd;        /* Directory to receive link             */
  839. X    VLINK    p;        /* Union link to appear prior to new one */
  840. X    {
  841. X    VLINK    current;
  842. X
  843. X    /* This is the first ul in the directory */
  844. X    if(vd->ulinks == NULL) {
  845. X        vd->ulinks = ul;
  846. X        ul->previous = NULL;
  847. X        ul->next = NULL;
  848. X        return(PSUCCESS);
  849. X    }
  850. X
  851. X    /* This ul will go at the head of the list */
  852. X    if(p == (VLINK) vd) {
  853. X        ul->next = vd->ulinks;
  854. X        ul->next->previous = ul;
  855. X        vd->ulinks = ul;
  856. X        ul->previous = NULL;
  857. X    }
  858. X    /* Otherwise, decide if it must be inserted at all  */
  859. X    /* If an identical link appears before the position */
  860. X    /* at which the new one is to be inserted, we can   */
  861. X    /* return without inserting it                 */
  862. X    else {
  863. X        current = vd->ulinks;
  864. X
  865. X        while(current) {
  866. X        /* p == NULL means we insert after last link */
  867. X        if(!p && (current->next == NULL))
  868. X            p = current;
  869. X
  870. X        if(vl_comp(current,ul) == 0) {
  871. X            vlfree(ul);
  872. X            return(UL_INSERT_ALREADY_THERE);
  873. X        }
  874. X
  875. X        if(current == p) break;
  876. X        current = current->next;
  877. X        }
  878. X
  879. X        /* If current is null, p was not found */
  880. X        if(current == NULL)
  881. X        return(UL_INSERT_POS_NOTFOUND);
  882. X
  883. X        /* Insert ul */
  884. X        ul->next = p->next;
  885. X        p->next = ul;
  886. X        ul->previous = p;
  887. X        if(ul->next) ul->next->previous = ul;
  888. X    }
  889. X
  890. X    /* Check for identical links after ul */
  891. X    current = ul->next;
  892. X
  893. X    while(current) {
  894. X        if(vl_comp(current,ul) == 0) {
  895. X        current->previous->next = current->next;
  896. X        if(current->next)
  897. X            current->next->previous = current->previous;
  898. X        vlfree(current);
  899. X        return(UL_INSERT_SUPERSEDING);
  900. X        }
  901. X        current = current->next;
  902. X    }
  903. X    
  904. X    return(PSUCCESS);
  905. X    }
  906. X
  907. /*
  908. X * vl_insert - Insert a directory link at the right location
  909. X *
  910. X *             VL_INSERT takes a directory and a link to be added to a 
  911. X *             directory and inserts it in the linked list of links for
  912. X *             that directory.  
  913. X *
  914. X *             If a link already exists with the same name, and if the
  915. X *             information associated with the new link matches that in
  916. X *             the existing link, an error is returned.  If the information
  917. X *             associated with the new link is different, but the magic numbers
  918. X *             match, then the new link will be added as a replica of the
  919. X *             existing link.  If the magic numbers do not match, the new
  920. X *             link will only be added to the list of "replicas" if the
  921. X *             allow_conflict flag has been set.
  922. X * 
  923. X *             If the link is not added, an error is returned and the link
  924. X *             is freed.  Ordering for the list of links is by the link name.  
  925. X *        
  926. X *             If vl is a union link, then VL_INSERT calls ul_insert with an
  927. X *           added argument indicating the link is to be included at the
  928. X *             end of the union link list.
  929. X * 
  930. X *    ARGS:    vl - Link to be inserted, vd - directory to get link
  931. X *             allow_conflict - insert links with conflicting names
  932. X *
  933. X * RETURNS:    Success, or VL_INSERT_ALREADY_THERE
  934. X */
  935. int
  936. vl_insert(vl,vd,allow_conflict)
  937. X    VLINK    vl;        /* Link to be inserted               */
  938. X    PVDIR    vd;        /* Directory to receive link         */
  939. X    int        allow_conflict;    /* Allow duplicate names             */
  940. X    {
  941. X    VLINK    current;    /* To step through list             */
  942. X    VLINK    crep;        /* To step through list of replicas  */
  943. X    int    retval;        /* Temp for checking returned values */
  944. X
  945. X    /* This can also be used to insert union links at end of list */
  946. X    if(vl->linktype == 'U') return(ul_insert(vl,vd,NULL));
  947. X
  948. X    /* If this is the first link in the directory */
  949. X    if(vd->links == NULL) {
  950. X        vd->links = vl;
  951. X        vl->previous = NULL;
  952. X        vl->next = NULL;
  953. X        vd->lastlink = vl;
  954. X        return(PSUCCESS);
  955. X    }
  956. X
  957. X    /* If no sorting is to be done, just insert at end of list */
  958. X    if(allow_conflict == VLI_NOSORT) {
  959. X        vd->lastlink->next = vl;
  960. X        vl->previous = vd->lastlink;
  961. X        vl->next = NULL;
  962. X        vd->lastlink = vl;
  963. X        return(PSUCCESS);
  964. X    }
  965. X
  966. X    /* If it is to be inserted at start of list */
  967. X    if(vl_comp(vl,vd->links) < 0) {
  968. X        vl->next = vd->links;
  969. X        vl->previous = NULL;
  970. X        vl->next->previous = vl;
  971. X        vd->links = vl;
  972. X        return(PSUCCESS);
  973. X    }
  974. X
  975. X    current = vd->links;
  976. X
  977. X    /* Otherwise, we must find the right spot to insert it */
  978. X    while((retval = vl_comp(vl,current)) > 0) {
  979. X        if(!current->next) {
  980. X        /* insert at end */
  981. X        vl->previous = current;
  982. X        vl->next = NULL;
  983. X        current->next = vl;
  984. X        vd->lastlink = vl;
  985. X        return(PSUCCESS);
  986. X        }
  987. X        current = current->next;
  988. X    }
  989. X
  990. X    /* If we found an equivilant entry already in list */
  991. X    if(!retval) {
  992. X        if(vl_equal(vl,current)) {
  993. X        vlfree(vl);
  994. X        return(VL_INSERT_ALREADY_THERE);
  995. X        }
  996. X        if((allow_conflict == VLI_NOCONFLICT) &&
  997. X           ((vl->f_magic_no != current->f_magic_no) ||
  998. X        (vl->f_magic_no==0)))
  999. X        return(VL_INSERT_CONFLICT);
  1000. X        /* Insert the link into the list of "replicas" */
  1001. X        /* If magic is 0, then create a pseudo magic number */
  1002. X        if(vl->f_magic_no == 0) vl->f_magic_no = -1;
  1003. X        crep = current->replicas;
  1004. X        if(!crep) {
  1005. X        current->replicas = vl;
  1006. X        vl->next = NULL;
  1007. X        vl->previous = NULL;
  1008. X        }
  1009. X        else {
  1010. X        while(crep->next) {
  1011. X            /* If magic was 0, then we need a unique magic number */
  1012. X            if((crep->f_magic_no < 0) && (vl->f_magic_no < 1))
  1013. X            (vl->f_magic_no)--;
  1014. X            crep = crep->next;
  1015. X        }
  1016. X        /* If magic was 0, then we need a unique magic number */
  1017. X        if((crep->f_magic_no < 0) && (vl->f_magic_no < 1))
  1018. X            (vl->f_magic_no)--;
  1019. X        crep->next = vl;
  1020. X        vl->previous = crep;
  1021. X        vl->next = NULL;
  1022. X        }
  1023. X        return(PSUCCESS);
  1024. X    }
  1025. X
  1026. X    /* We found the spot where vl is to be inserted */
  1027. X    vl->next = current;
  1028. X    vl->previous = current->previous;
  1029. X    current->previous = vl;
  1030. X    vl->previous->next = vl;
  1031. X    return(PSUCCESS);
  1032. X    }
  1033. X
  1034. /*
  1035. X * nlsindex - Find first instance of string 2 in string 1 following newline
  1036. X *
  1037. X *          NLSINDEX scans string 1 for the first instance of string
  1038. X *          2 that immediately follows a newline.  If found, NLSINDEX
  1039. X *          returns a pointer to the first character of that instance.
  1040. X *          If no instance is found, NLSINDEX returns NULL (0).
  1041. X *
  1042. X *    NOTE:   This function is only useful for searching strings that
  1043. X *            consist of multiple lines.  s1 is assumed to be preceeded
  1044. X *           by a newline.  Thus, if s2 is at the start of s1, it will
  1045. X *          be found.
  1046. X *    ARGS:   s1 - string to be searched
  1047. X *            s2 - string to be found
  1048. X * RETURNS:   First instance of s2 in s1, or NULL (0) if not found
  1049. X */
  1050. char *
  1051. nlsindex(s1,s2)
  1052. X    char    *s1;        /* String to be searched */
  1053. X    char    *s2;        /* String to be found    */
  1054. X    {
  1055. X    register int s2len = strlen(s2);
  1056. X    char    *curline = s1;    /* Pointer to start of current line */
  1057. X
  1058. X    /* In case s2 appears at start of s1 */
  1059. X    if(strncmp(curline,s2,s2len) == 0)
  1060. X        return(curline);
  1061. X
  1062. X    /* Check remaining lines of s1 */
  1063. X    while((curline = (char *) index(curline,'\n')) != NULL) {
  1064. X        curline++;
  1065. X        if(strncmp(curline,s2,s2len) == 0)
  1066. X        return(curline);
  1067. X    }
  1068. X
  1069. X    /* We didn't find it */
  1070. X    return(NULL);
  1071. X    }
  1072. X
  1073. /*
  1074. X * month_sname - Return a month name from it's number
  1075. X *
  1076. X *               MONTH_SNAME takes a number in the range 0
  1077. X *               to 12 and returns a pointer to a string
  1078. X *               representing the three letter abbreviation
  1079. X *             for that month.  If the argument is out of 
  1080. X *         range, MONTH_SNAME returns a pointer to "Unk".
  1081. X *
  1082. X *       ARGS:   n - Number of the month
  1083. X *    RETURNS:   Abbreviation for selected month
  1084. X */
  1085. char *month_sname(n)
  1086. X    int n;        /* Month number */
  1087. {
  1088. X    static char *name[] = { "Unk",
  1089. X        "Jan","Feb","Mar","Apr","May","Jun",
  1090. X        "Jul","Aug","Sep","Oct","Nov","Dec"
  1091. X    };
  1092. X    return((n < 1 || n > 12) ? name[0] : name[n]);
  1093. }
  1094. X
  1095. /*
  1096. X * sindex - Find first instance of string 2 in string 1 
  1097. X *
  1098. X *          SINDEX scans string 1 for the first instance of string
  1099. X *          2.  If found, SINDEX returns a pointer to the first
  1100. X *          character of that instance.  If no instance is found, 
  1101. X *          SINDEX returns NULL (0).
  1102. X *
  1103. X *    ARGS:   s1 - string to be searched
  1104. X *            s2 - string to be found
  1105. X * RETURNS:   First instance of s2 in s1, or NULL (0) if not found
  1106. X */
  1107. char *
  1108. sindex(s1,s2)
  1109. X    char    *s1;        /* String to be searched   */
  1110. X    char    *s2;        /* String to be found      */
  1111. X    {
  1112. X    register int s2len = strlen(s2);
  1113. X    char    *s = s1;    /* Temp pointer to string  */
  1114. X
  1115. X    /* Check for first character of s2 */
  1116. X    while((s = (char *) index(s,*s2)) != NULL) {
  1117. X        if(strncmp(s,s2,s2len) == 0)
  1118. X        return(s);
  1119. X        s++;
  1120. X    }
  1121. X
  1122. X    /* We didn't find it */
  1123. X    return(NULL);
  1124. X    }
  1125. X
  1126. int
  1127. scan_error(erst)
  1128. X    char    *erst;
  1129. X    {
  1130. X    *p_err_string = '\0';
  1131. X
  1132. X    if(strncmp(erst,"NOT-A-DIRECTORY",15) == 0) 
  1133. X        return(DIRSRV_NOT_DIRECTORY);
  1134. X
  1135. X    if(strncmp(erst,"UNIMPLEMENTED",13) == 0) {
  1136. X        perrno = DIRSRV_UNIMPLEMENTED;
  1137. X        sscanf(erst+13,"%*[^\n \t\r]%*[ \t]%[^\n]",p_err_string);
  1138. X        return(perrno);
  1139. X    }
  1140. X
  1141. X    if(strncmp(erst,"WARNING ",8) == 0) {
  1142. X        erst += 8;
  1143. X        *p_warn_string = '\0';
  1144. X        sscanf(erst,"%*[^\n \t\r]%*[ \t]%[^\n]",p_warn_string);
  1145. X        /* Return values for warnings are negative */
  1146. X        if(strncmp(erst,"OUT-OF-DATE",11) == 0) {
  1147. X        pwarn = PWARN_OUT_OF_DATE;
  1148. X        return(PSUCCESS);
  1149. X        }
  1150. X        if(strncmp(erst,"MESSAGE",7) == 0) {
  1151. X        pwarn = PWARN_MSG_FROM_SERVER;
  1152. X        return(PSUCCESS);
  1153. X        }
  1154. X        pwarn = PWARNING;
  1155. X        sscanf(erst,"%[^\n]",p_warn_string);
  1156. X        return(PSUCCESS);
  1157. X    }
  1158. X    else if(strncmp(erst,"ERROR",5) == 0) {
  1159. X        if(*(erst+5)) sscanf(erst+6,"%[^\n]",p_err_string);
  1160. X        perrno = DIRSRV_ERROR;
  1161. X        return(perrno);
  1162. X    }
  1163. X    /* The rest start with "FAILURE" */
  1164. X    else if(strncmp(erst,"FAILURE",7) != 0) {
  1165. X        /* Unrecognized - Give warning, but return PSUCCESS */
  1166. X        if(pwarn == 0) {
  1167. X        *p_warn_string = '\0';
  1168. X        pwarn = PWARN_UNRECOGNIZED_RESP;
  1169. X        sscanf(erst,"%[^\n]",p_warn_string);
  1170. X        }
  1171. X        return(PSUCCESS);
  1172. X    }
  1173. X
  1174. X    if(strncmp(erst,"FAILURE ",8) != 0) {
  1175. X        perrno = PFAILURE;
  1176. X        return(perrno);
  1177. X    }    
  1178. X    erst += 8;
  1179. X    
  1180. X    sscanf(erst,"%*[^\n \t\r]%*[ \t]%[^\n]",p_err_string);
  1181. X
  1182. X    /* Still to add               */
  1183. X    /* DIRSRV_AUTHENT_REQ     242 */
  1184. X    /* DIRSRV_BAD_VERS        245 */
  1185. X
  1186. X    if(strncmp(erst,"NOT-FOUND",9) == 0) 
  1187. X        perrno = DIRSRV_NOT_FOUND;
  1188. X    else if(strncmp(erst,"NOT-AUTHORIZED",13) == 0) 
  1189. X        perrno = DIRSRV_NOT_AUTHORIZED;
  1190. X    else if(strncmp(erst,"ALREADY-EXISTS",14) == 0) 
  1191. X        perrno = DIRSRV_ALREADY_EXISTS;
  1192. X    else if(strncmp(erst,"NAME-CONFLICT",13) == 0) 
  1193. X        perrno = DIRSRV_NAME_CONFLICT;
  1194. X    else if(strncmp(erst,"SERVER-FAILED",13) == 0) 
  1195. X        perrno = DIRSRV_SERVER_FAILED;
  1196. X     /* Use it whether it starts with FAILURE or not */
  1197. X    else if(strncmp(erst,"NOT-A-DIRECTORY",15) == 0) 
  1198. X        perrno = DIRSRV_NOT_DIRECTORY;
  1199. X    else perrno = PFAILURE;
  1200. X
  1201. X    return(perrno);
  1202. X    }
  1203. X
  1204. PATTRIB 
  1205. parse_attribute(line)
  1206. X    char    *line;
  1207. X    {
  1208. X    char    l_precedence[MAX_DIR_LINESIZE];
  1209. X    char    l_name[MAX_DIR_LINESIZE];
  1210. X    char    l_type[MAX_DIR_LINESIZE];
  1211. X    char    l_value[MAX_DIR_LINESIZE];
  1212. X    PATTRIB    at;
  1213. X    int    tmp;
  1214. X
  1215. X    tmp = sscanf(line,"OBJECT-INFO %s %s %[^\n]", l_name, l_type, l_value);
  1216. X    
  1217. X    if(tmp < 3) {
  1218. X        tmp = sscanf(line,"LINK-INFO %s %s %s %[^\n]", l_precedence,
  1219. X             l_name, l_type, l_value);
  1220. X        if(tmp < 4) {
  1221. X        perrno = DIRSRV_BAD_FORMAT;
  1222. X        return(NULL);
  1223. X        }
  1224. X    }
  1225. X
  1226. X    at = atalloc();
  1227. X
  1228. X    if(tmp == 4) {
  1229. X        if(strcmp(l_precedence,"CACHED") == 0) 
  1230. X        at->precedence = ATR_PREC_CACHED;
  1231. X        else if(strcmp(l_precedence,"LINK") == 0) 
  1232. X        at->precedence = ATR_PREC_LINK;
  1233. X        else if(strcmp(l_precedence,"REPLACEMENT") == 0) 
  1234. X        at->precedence = ATR_PREC_REPLACE;
  1235. X        else if(strcmp(l_precedence,"ADDITIONAL") == 0) 
  1236. X        at->precedence = ATR_PREC_ADD;
  1237. X    }
  1238. X
  1239. X    at->aname = stcopy(l_name);
  1240. X    at->avtype = stcopy(l_type);
  1241. X    if(strcmp(l_type,"ASCII") == 0) 
  1242. X        at->value.ascii = stcopy(l_value);
  1243. X    else if(strcmp(l_type,"LINK") == 0) {
  1244. X        char        ftype[MAX_DIR_LINESIZE];
  1245. X        char        lname[MAX_DIR_LINESIZE];
  1246. X        char        htype[MAX_DIR_LINESIZE];
  1247. X        char        host[MAX_DIR_LINESIZE];
  1248. X        char        ntype[MAX_DIR_LINESIZE];
  1249. X        char        fname[MAX_DIR_LINESIZE];
  1250. X        VLINK        al;
  1251. X
  1252. X        al = vlalloc();
  1253. X        at->value.link = al;
  1254. X
  1255. X        tmp = sscanf(l_value,"%c %s %s %s %s %s %s %d %d",
  1256. X             &(al->linktype),
  1257. X             ftype,lname,htype,host,ntype,fname,
  1258. X             &(al->version),
  1259. X             &(al->f_magic_no));
  1260. X        if(tmp == 9) {
  1261. X        al->type = stcopyr(ftype,al->type);
  1262. X        al->name = stcopyr(unquote(lname),al->name);
  1263. X        al->hosttype = stcopyr(htype,al->hosttype);
  1264. X        al->host = stcopyr(host,al->host);
  1265. X        al->nametype = stcopyr(ntype,al->nametype);
  1266. X        al->filename = stcopyr(fname,al->filename);
  1267. X        }
  1268. X        else {
  1269. X        perrno = DIRSRV_BAD_FORMAT;
  1270. X        return(NULL);
  1271. X        }
  1272. X        
  1273. X    }
  1274. X
  1275. X    return(at);
  1276. X    }
  1277. X
  1278. /*
  1279. X * nxtline - Find the next line in the string
  1280. X *
  1281. X *          NXTLINE takes a string and returns a pointer to
  1282. X *          the character immediately following the next newline.
  1283. X *
  1284. X *    ARGS:   s - string to be searched
  1285. X *
  1286. X * RETURNS:   Next line or NULL (0) on failure
  1287. X */
  1288. char *
  1289. nxtline(s)
  1290. X    char    *s;        /* String to be searched */
  1291. X {
  1292. X    s = (char *) index(s,'\n');
  1293. X    if(s) return(++s);
  1294. X    else return(NULL);
  1295. X    }
  1296. X
  1297. X
  1298. /*
  1299. X * unquote - unquote string if necessary
  1300. X *
  1301. X *          UNQUOTE takes a string and unquotes it if it has been quoted.
  1302. X *
  1303. X *    ARGS:   s - string to be unquoted
  1304. X *            
  1305. X * RETURNS:   The original string.  If the string has been quoted, then the
  1306. X *            result appears in static storage, and must be copied if 
  1307. X *            it is to last beyond the next call to quote.
  1308. X *
  1309. X */
  1310. char *
  1311. unquote(s)
  1312. X    char    *s;        /* String to be quoted */
  1313. X    {
  1314. X    static char    unquoted[200];
  1315. X    char        *c = unquoted;
  1316. X
  1317. X    if(*s != '\'') return(s);
  1318. X
  1319. X    s++;
  1320. X
  1321. X    /* This should really treat a quote followed by other */
  1322. X    /* than a quote or a null as an error                 */
  1323. X    while(*s) {
  1324. X        if(*s == '\'') s++;
  1325. X        if(*s) *c++ = *s++;
  1326. X    }
  1327. X
  1328. X    *c++ = '\0';
  1329. X
  1330. X    return(unquoted);
  1331. X    }
  1332. X
  1333. #if defined(DEBUG) && !defined(HAVE_STRSPN)
  1334. /* needed for -D option parsing */
  1335. /*
  1336. X * strspn - Count initial characters from chrs in s
  1337. X *
  1338. X *          STRSPN counts the occurances of chacters from chrs
  1339. X *            in the string s preceeding the first occurance of
  1340. X *            a character not in s.
  1341. X *
  1342. X *    ARGS:   s    - string to be checked
  1343. X *            chrs - string of characters we are looking for
  1344. X *
  1345. X * RETURNS:   Count of initial characters from chrs in s
  1346. X */
  1347. strspn(s,chrs)
  1348. X    char    *s;    /* String to search                         */
  1349. X    char    *chrs; /* String of characters we are looking for  */
  1350. X    {
  1351. X    char    *cp;   /* Pointer to the current character in chrs */
  1352. X    int    count; /* Count of characters seen so far          */
  1353. X    
  1354. X    count = 0;
  1355. X
  1356. X    while(*s) {
  1357. X        for(cp = chrs;*cp;cp++)
  1358. X        if(*cp == *s) {
  1359. X            s++;
  1360. X            count++;
  1361. X            goto done;
  1362. X        }
  1363. X        return(count);
  1364. X    done:
  1365. X        ;
  1366. X    }
  1367. X    return(count);
  1368. X    }
  1369. #endif
  1370. X
  1371. #ifdef CUTCP
  1372. char
  1373. *inet_ntoa(struct in_addr in)
  1374. {
  1375. X    static    char    buff[36];
  1376. X
  1377. X    unsigned char    *c = (char *) &in.address;
  1378. X    sprintf(buff,"%d.%d.%d.%d",*c,*(c+1),*(c+2),*(c+3));
  1379. X    return(buff);
  1380. }
  1381. X
  1382. long
  1383. inet_addr(char *cp)
  1384. {
  1385. X    long    value = 0;
  1386. X    unsigned    v1,v2,v3,v4;
  1387. X
  1388. X    v1 = v2 = v3 = v4 = 0xff;
  1389. X    sscanf(cp,"%d.%d.%d.%d",&v1,&v2,&v3,&v4);
  1390. X    value = (v1 << 24) | (v2 << 16) | (v3 << 8) | v4;
  1391. X    return(value);
  1392. }
  1393. X
  1394. struct    hostent
  1395. *gethostbyname(char *name)
  1396. {
  1397. X    struct machinfo    *mp;
  1398. X    int    mnum;
  1399. X    unsigned long    now;
  1400. X    static    struct hostent    ht;
  1401. X    extern int pfs_debug;
  1402. X
  1403. X    mp = Shostlook(name);
  1404. X    if(!mp || (!mp->hostip[0])) {    /* DNS lookup */
  1405. #ifdef DEBUG
  1406. X        if (pfs_debug)
  1407. X        fprintf(stderr, "Domain name lookup of %s\n", name);
  1408. #endif
  1409. X        mnum = Sdomain(name);        /* start a DNS lookup */
  1410. X        now = time(NULL) + NS_TIMEOUT;
  1411. X        while(now > time(NULL)) {
  1412. X            int    i, class, dat;
  1413. X
  1414. X            Stask();
  1415. X            i = Sgetevent(USERCLASS, &class, &dat);
  1416. X            if(i == DOMOK) {    /* domain lookup ok */
  1417. X                mp = Slooknum(mnum);
  1418. #ifdef DEBUG
  1419. X        if (pfs_debug)
  1420. X        fprintf(stderr, "Domain name lookup of %s Completed OK\n", name);
  1421. #endif
  1422. X                break;
  1423. X            }
  1424. X        }
  1425. X        if(!mp)    {    /* get here if timeout */
  1426. #ifdef DEBUG
  1427. X        if (pfs_debug)
  1428. X        fprintf(stderr, "Domain name lookup of %s Failed\n", name);
  1429. #endif
  1430. X            return(NULL);
  1431. X        }
  1432. X    }
  1433. X    ht.h_addr = *((unsigned long *) mp->hostip);
  1434. X    ht.h_length = 4;
  1435. X    ht.h_addrtype = AF_INET;
  1436. X    return(&ht);
  1437. X
  1438. }
  1439. #endif /* CUTCP */
  1440. X
  1441. #ifdef GETENV
  1442. /*
  1443. X * Copyright (c) 1987 Regents of the University of California.
  1444. X * All rights reserved.
  1445. X *
  1446. X * Redistribution and use in source and binary forms are permitted
  1447. X * provided that: (1) source distributions retain this entire copyright
  1448. X * notice and comment, and (2) distributions including binaries display
  1449. X * the following acknowledgement:  ``This product includes software
  1450. X * developed by the University of California, Berkeley and its contributors''
  1451. X * in the documentation or other materials provided with the distribution
  1452. X * and in all advertising materials mentioning features or use of this
  1453. X * software. Neither the name of the University nor the names of its
  1454. X * contributors may be used to endorse or promote products derived
  1455. X * from this software without specific prior written permission.
  1456. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1457. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1458. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1459. X */
  1460. X
  1461. #if defined(LIBC_SCCS) && !defined(lint)
  1462. static char sccsid[] = "@(#)getenv.c    5.7 (Berkeley) 6/1/90";
  1463. #endif /* LIBC_SCCS and not lint */
  1464. X
  1465. #include <stdlib.h>
  1466. #include <stddef.h>
  1467. X
  1468. /*
  1469. X * getenv --
  1470. X *    Returns ptr to value associated with name, if any, else NULL.
  1471. X */
  1472. char *
  1473. getenv(name)
  1474. X    char *name;
  1475. {
  1476. X    int offset;
  1477. X    char *_findenv();
  1478. X
  1479. X    return(_findenv(name, &offset));
  1480. }
  1481. X
  1482. /*
  1483. X * _findenv --
  1484. X *    Returns pointer to value associated with name, if any, else NULL.
  1485. X *    Sets offset to be the offset of the name/value combination in the
  1486. X *    environmental array, for use by setenv(3) and unsetenv(3).
  1487. X *    Explicitly removes '=' in argument name.
  1488. X *
  1489. X *    This routine *should* be a static; don't use it.
  1490. X */
  1491. char *
  1492. _findenv(name, offset)
  1493. X    register char *name;
  1494. X    int *offset;
  1495. {
  1496. X    extern char **environ;
  1497. X    register int len;
  1498. X    register char **P, *C;
  1499. X
  1500. X    for (C = name, len = 0; *C && *C != '='; ++C, ++len);
  1501. X    for (P = environ; *P; ++P)
  1502. X        if (!strncmp(*P, name, len))
  1503. X            if (*(C = *P + len) == '=') {
  1504. X                *offset = P - environ;
  1505. X                return(++C);
  1506. X            }
  1507. X    return(NULL);
  1508. }
  1509. #endif
  1510. SHAR_EOF
  1511. chmod 0644 xarchie-2.0.6/support.c ||
  1512. echo 'restore of xarchie-2.0.6/support.c failed'
  1513. Wc_c="`wc -c < 'xarchie-2.0.6/support.c'`"
  1514. test 21453 -eq "$Wc_c" ||
  1515.     echo 'xarchie-2.0.6/support.c: original size 21453, current size' "$Wc_c"
  1516. rm -f _shar_wnt_.tmp
  1517. fi
  1518. # ============= xarchie-2.0.6/syntax.c ==============
  1519. if test -f 'xarchie-2.0.6/syntax.c' -a X"$1" != X"-c"; then
  1520.     echo 'x - skipping xarchie-2.0.6/syntax.c (File already exists)'
  1521.     rm -f _shar_wnt_.tmp
  1522. else
  1523. > _shar_wnt_.tmp
  1524. echo 'x - extracting xarchie-2.0.6/syntax.c (Text)'
  1525. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/syntax.c' &&
  1526. /*
  1527. X * syntax.c : The usage message for xarchie
  1528. X *
  1529. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1530. X */
  1531. X
  1532. #include <stdio.h>
  1533. X
  1534. void
  1535. syntax(argc,argv)
  1536. int argc;
  1537. char **argv;
  1538. {
  1539. X    char *program;
  1540. X
  1541. X    program = *argv;
  1542. X    argv += 1;
  1543. X    if (argc > 2 || (strcmp(*argv,"-help") != 0 && strcmp(*argv,"-?") != 0)) {
  1544. X    fprintf(stderr,"%s: bad argument(s): ",program);
  1545. X    while (--argc)
  1546. X        fprintf(stderr,"%s ",*argv++);
  1547. X    fprintf(stderr,"\n");
  1548. X    }
  1549. X    fprintf(stderr,"Valid options (in addition to X Toolkit options) are:\n");
  1550. X    fprintf(stderr,"  -host host\tConnect to Archie at host\n");
  1551. X    fprintf(stderr,"  -search type\tSet query type\n");
  1552. X    fprintf(stderr,"  -e\t\tSet query type to exact\n");
  1553. X    fprintf(stderr,"  -c\t\tSet query type to subcase\n");
  1554. X    fprintf(stderr,"  -s\t\tSet query type to substr\n");
  1555. X    fprintf(stderr,"  -r\t\tSet query type to regexp\n");
  1556. X    fprintf(stderr,"  -ec\t\tSet query type to exactSubcase\n");
  1557. X    fprintf(stderr,"  -es\t\tSet query type to exactSubstr\n");
  1558. X    fprintf(stderr,"  -er\t\tSet query type to exactRegexp\n");
  1559. X    fprintf(stderr,"  -sort type\tSet sort mode\n");
  1560. X    fprintf(stderr,"  -t\t\tSet sort mode to date\n");
  1561. X    fprintf(stderr,"  -w\t\tSet sort mode to weight\n");
  1562. X    fprintf(stderr,"  -maxhits num\tSet maximum number of matches per query\n");
  1563. X    fprintf(stderr,"  -offset off\tSet Prospero offset\n");
  1564. X    fprintf(stderr,"  -[nice|N] #\tSet query niceness\n");
  1565. X    fprintf(stderr,"  -noscroll\tDon't scroll browser lists\n");
  1566. X    fprintf(stderr,"  -mono\t\tUse monochrome color resources\n");
  1567. X    fprintf(stderr,"  -gray\t\tUse gray-scale color resources\n");
  1568. X    fprintf(stderr,"  -color\t\tUse color resources\n");
  1569. X    fprintf(stderr,"  -[debug|D] #\tSet Prospero debugging level\n");
  1570. X    fprintf(stderr,"  -help\t\tPrint this message\n");
  1571. X    fprintf(stderr,"  -xrm 'resource: value'  Pass arbitrary resources\n");
  1572. X    fprintf(stderr,"Options can be abbreviated to their shortest unique prefix.\n");
  1573. }
  1574. SHAR_EOF
  1575. chmod 0644 xarchie-2.0.6/syntax.c ||
  1576. echo 'restore of xarchie-2.0.6/syntax.c failed'
  1577. Wc_c="`wc -c < 'xarchie-2.0.6/syntax.c'`"
  1578. test 1983 -eq "$Wc_c" ||
  1579.     echo 'xarchie-2.0.6/syntax.c: original size 1983, current size' "$Wc_c"
  1580. rm -f _shar_wnt_.tmp
  1581. fi
  1582. # ============= xarchie-2.0.6/syntax.h ==============
  1583. if test -f 'xarchie-2.0.6/syntax.h' -a X"$1" != X"-c"; then
  1584.     echo 'x - skipping xarchie-2.0.6/syntax.h (File already exists)'
  1585.     rm -f _shar_wnt_.tmp
  1586. else
  1587. > _shar_wnt_.tmp
  1588. echo 'x - extracting xarchie-2.0.6/syntax.h (Text)'
  1589. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/syntax.h' &&
  1590. /*
  1591. X * syntax.h : Defs for printing the usage message (anal aren't we)
  1592. X *
  1593. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1594. X */
  1595. X
  1596. extern void syntax();
  1597. SHAR_EOF
  1598. chmod 0644 xarchie-2.0.6/syntax.h ||
  1599. echo 'restore of xarchie-2.0.6/syntax.h failed'
  1600. Wc_c="`wc -c < 'xarchie-2.0.6/syntax.h'`"
  1601. test 160 -eq "$Wc_c" ||
  1602.     echo 'xarchie-2.0.6/syntax.h: original size 160, current size' "$Wc_c"
  1603. rm -f _shar_wnt_.tmp
  1604. fi
  1605. # ============= xarchie-2.0.6/sysdefs.h ==============
  1606. if test -f 'xarchie-2.0.6/sysdefs.h' -a X"$1" != X"-c"; then
  1607.     echo 'x - skipping xarchie-2.0.6/sysdefs.h (File already exists)'
  1608.     rm -f _shar_wnt_.tmp
  1609. else
  1610. > _shar_wnt_.tmp
  1611. echo 'x - extracting xarchie-2.0.6/sysdefs.h (Text)'
  1612. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/sysdefs.h' &&
  1613. /*
  1614. X * sysdefs.h : System functions that are tricky to get declared...
  1615. X *
  1616. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1617. X */
  1618. X
  1619. /* #include <stdlib.h> */
  1620. #ifdef __STDC__
  1621. extern char *malloc(unsigned ptr);
  1622. extern char *calloc(unsigned nelem, unsigned size);
  1623. extern int free(char *ptr);
  1624. extern char *getenv(const char *str);
  1625. extern void exit(int status);
  1626. extern void abort(void);
  1627. #else
  1628. extern char *malloc(),*calloc();
  1629. extern int free();
  1630. extern char *getenv();
  1631. extern void exit();
  1632. extern void abort();
  1633. #endif
  1634. SHAR_EOF
  1635. chmod 0644 xarchie-2.0.6/sysdefs.h ||
  1636. echo 'restore of xarchie-2.0.6/sysdefs.h failed'
  1637. Wc_c="`wc -c < 'xarchie-2.0.6/sysdefs.h'`"
  1638. test 517 -eq "$Wc_c" ||
  1639.     echo 'xarchie-2.0.6/sysdefs.h: original size 517, current size' "$Wc_c"
  1640. rm -f _shar_wnt_.tmp
  1641. fi
  1642. # ============= xarchie-2.0.6/syserr.c ==============
  1643. if test -f 'xarchie-2.0.6/syserr.c' -a X"$1" != X"-c"; then
  1644.     echo 'x - skipping xarchie-2.0.6/syserr.c (File already exists)'
  1645.     rm -f _shar_wnt_.tmp
  1646. else
  1647. > _shar_wnt_.tmp
  1648. echo 'x - extracting xarchie-2.0.6/syserr.c (Text)'
  1649. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/syserr.c' &&
  1650. /*
  1651. X * syserr.c : Routines for system errors (like perror()). This puts
  1652. X *    together an error string based on errno (if the system has
  1653. X *    errno) and then calls the interface function alert0() to
  1654. X *    display it.
  1655. X *
  1656. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1657. X * 13 May 1993: Use HAVE_SYS_ERRLIST properly and correct comments.
  1658. X *
  1659. X * Compile-time parameters (config.h)
  1660. X *    HAVE_STRERROR:    ANSI function strerror() exists
  1661. X *    HAVE_SYS_ERRLIST: char *sys_errlist[] exists
  1662. X *    HAVE_ERRNO:       int errno exists (it better!)
  1663. X */
  1664. #include <stdio.h>
  1665. #include "config.h"
  1666. X
  1667. #ifdef HAVE_ERRNO
  1668. #include <errno.h>
  1669. # ifndef MSDOS
  1670. X  extern int errno;        /* MSDOS doesn't like this, apparently */
  1671. # endif /* !MSDOS */
  1672. #else /* !NO_ERRNO */
  1673. int errno;            /* Make our own, pretty useless */
  1674. #endif /* !NO_ERRNO */
  1675. X
  1676. #ifdef HAVE_STRERROR
  1677. /* This is the same as NeedFunctionPrototypes for an X file */
  1678. #if defined(FUNCPROTO) || __STDC__ || defined(__cplusplus) || defined(c_plusplus)
  1679. X   extern char *strerror(int);
  1680. # else
  1681. X   extern char *strerror();
  1682. # endif /* !NeedFunctionPrototypes */
  1683. #else /* !HAVE_STRERROR */
  1684. # ifdef HAVE_SYS_ERRLIST
  1685. X   extern char *sys_errlist[];
  1686. # endif /* !HAVE_SYS_ERRLIST */
  1687. #endif /* !HAVE_STRERROR */
  1688. X
  1689. extern void alert0();        /* Function to display the error message */
  1690. X
  1691. /*    -    -    -    -    -    -    -    -    */
  1692. X
  1693. void
  1694. sysError(str)
  1695. char *str;
  1696. {
  1697. X    char buf[256];
  1698. X
  1699. #ifdef HAVE_STRERROR
  1700. X    sprintf(buf,"%s: %s",str,strerror(errno));
  1701. #else
  1702. #ifdef HAVE_SYS_ERRLIST
  1703. X    sprintf(buf,"%s: %s",str,sys_errlist[errno]);
  1704. #else
  1705. #ifdef HAVE_ERRNO
  1706. X    sprintf(buf,"%s: Errno = %d",str,errno);
  1707. #else
  1708. X    sprintf(buf,"%s: System error.");
  1709. #endif /* !HAVE_ERRNO */
  1710. #endif /* !HAVE_SYS_ERRLIST */
  1711. #endif /* !HAVE_STRERROR */
  1712. X    alert0(buf);
  1713. }
  1714. SHAR_EOF
  1715. chmod 0644 xarchie-2.0.6/syserr.c ||
  1716. echo 'restore of xarchie-2.0.6/syserr.c failed'
  1717. Wc_c="`wc -c < 'xarchie-2.0.6/syserr.c'`"
  1718. test 1727 -eq "$Wc_c" ||
  1719.     echo 'xarchie-2.0.6/syserr.c: original size 1727, current size' "$Wc_c"
  1720. rm -f _shar_wnt_.tmp
  1721. fi
  1722. # ============= xarchie-2.0.6/syserr.h ==============
  1723. if test -f 'xarchie-2.0.6/syserr.h' -a X"$1" != X"-c"; then
  1724.     echo 'x - skipping xarchie-2.0.6/syserr.h (File already exists)'
  1725.     rm -f _shar_wnt_.tmp
  1726. else
  1727. > _shar_wnt_.tmp
  1728. echo 'x - extracting xarchie-2.0.6/syserr.h (Text)'
  1729. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/syserr.h' &&
  1730. /*
  1731. X * syserr.h : Portable interface to system error messages.
  1732. X *
  1733. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1734. X *
  1735. X */
  1736. X
  1737. /* Either the real errno or one of our making, for external use. */
  1738. #ifndef MSDOS
  1739. extern int errno;        /* MSDOS doesn't like this, apparently */
  1740. #endif /* !MSDOS */
  1741. X
  1742. extern void sysError();
  1743. SHAR_EOF
  1744. chmod 0644 xarchie-2.0.6/syserr.h ||
  1745. echo 'restore of xarchie-2.0.6/syserr.h failed'
  1746. Wc_c="`wc -c < 'xarchie-2.0.6/syserr.h'`"
  1747. test 321 -eq "$Wc_c" ||
  1748.     echo 'xarchie-2.0.6/syserr.h: original size 321, current size' "$Wc_c"
  1749. rm -f _shar_wnt_.tmp
  1750. fi
  1751. # ============= xarchie-2.0.6/tilde.c ==============
  1752. if test -f 'xarchie-2.0.6/tilde.c' -a X"$1" != X"-c"; then
  1753.     echo 'x - skipping xarchie-2.0.6/tilde.c (File already exists)'
  1754.     rm -f _shar_wnt_.tmp
  1755. else
  1756. > _shar_wnt_.tmp
  1757. echo 'x - extracting xarchie-2.0.6/tilde.c (Text)'
  1758. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/tilde.c' &&
  1759. /*
  1760. X * tilde.c : Tilde expansion for filenames
  1761. X *
  1762. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1763. X * 13 May 1993: Cleanups.
  1764. X *
  1765. X */
  1766. X
  1767. #include <stdio.h>
  1768. #include <sys/types.h>
  1769. #include <pwd.h>
  1770. #include "config.h"
  1771. #ifdef HAVE_SYS_PARAM_H
  1772. # include <sys/param.h>
  1773. #endif
  1774. #include "alert.h"
  1775. #include "sysdefs.h"
  1776. #include "stringdefs.h"
  1777. extern uid_t getuid();        /* not in stdlib.h, but is in unistd.h */
  1778. X
  1779. char *
  1780. tildeExpand(file)
  1781. char *file;
  1782. {
  1783. X    static char filename[MAXPATHLEN];
  1784. X    struct passwd *pwe;
  1785. X    char *name,*home;
  1786. X
  1787. X    /* Must start with tilde */
  1788. X    if (*file != '~')
  1789. X    return(file);
  1790. X    /* Set default return value in case tilde expansion fails */
  1791. X    strcpy(filename,file);
  1792. X    /* Skip tilde */
  1793. X    name = ++file;
  1794. X    /* Gather name following tilde (if any) */
  1795. X    while (*file != '\0' && *file != '/')
  1796. X    file += 1;
  1797. X    if (*file != '\0')
  1798. X    *file++ = '\0';
  1799. X    if (*name == '\0') {                /* ~/... */
  1800. X    if ((pwe=getpwuid(getuid())) != NULL) {
  1801. X        home = pwe->pw_dir;
  1802. X    } else if ((home=getenv("HOME")) == NULL) {
  1803. X        alert0("Couldn't find homedir, you should set $HOME");
  1804. X        return(filename);
  1805. X    }
  1806. X    } else {                        /* ~user/... */
  1807. X    if ((pwe=getpwnam(name)) != NULL) {
  1808. X        home = pwe->pw_dir;
  1809. X    } else {
  1810. X        alert1("Couldn't find homedir for \"%s\"",name);
  1811. X        return(filename);
  1812. X    }
  1813. X    }
  1814. X    sprintf(filename,"%s/%s",home,file);
  1815. X    return(filename);
  1816. }
  1817. SHAR_EOF
  1818. chmod 0644 xarchie-2.0.6/tilde.c ||
  1819. echo 'restore of xarchie-2.0.6/tilde.c failed'
  1820. Wc_c="`wc -c < 'xarchie-2.0.6/tilde.c'`"
  1821. test 1368 -eq "$Wc_c" ||
  1822.     echo 'xarchie-2.0.6/tilde.c: original size 1368, current size' "$Wc_c"
  1823. rm -f _shar_wnt_.tmp
  1824. fi
  1825. # ============= xarchie-2.0.6/tilde.h ==============
  1826. if test -f 'xarchie-2.0.6/tilde.h' -a X"$1" != X"-c"; then
  1827.     echo 'x - skipping xarchie-2.0.6/tilde.h (File already exists)'
  1828.     rm -f _shar_wnt_.tmp
  1829. else
  1830. > _shar_wnt_.tmp
  1831. echo 'x - extracting xarchie-2.0.6/tilde.h (Text)'
  1832. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/tilde.h' &&
  1833. /*
  1834. X * tilde.h : Defs for tilde expansion routine
  1835. X *
  1836. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1837. X *
  1838. X */
  1839. X
  1840. extern char *tildeExpand(/* char *file */);
  1841. SHAR_EOF
  1842. chmod 0644 xarchie-2.0.6/tilde.h ||
  1843. echo 'restore of xarchie-2.0.6/tilde.h failed'
  1844. Wc_c="`wc -c < 'xarchie-2.0.6/tilde.h'`"
  1845. test 164 -eq "$Wc_c" ||
  1846.     echo 'xarchie-2.0.6/tilde.h: original size 164, current size' "$Wc_c"
  1847. rm -f _shar_wnt_.tmp
  1848. fi
  1849. # ============= xarchie-2.0.6/types.c ==============
  1850. if test -f 'xarchie-2.0.6/types.c' -a X"$1" != X"-c"; then
  1851.     echo 'x - skipping xarchie-2.0.6/types.c (File already exists)'
  1852.     rm -f _shar_wnt_.tmp
  1853. else
  1854. > _shar_wnt_.tmp
  1855. echo 'x - extracting xarchie-2.0.6/types.c (Text)'
  1856. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/types.c' &&
  1857. /*
  1858. X * types.c : Converters for SearchType and SortType, a converter for
  1859. X *    fonts that allows per-application defaults, and an improved
  1860. X *    converter for Widget that allows "NULL" to be specified.
  1861. X *
  1862. X * George Ferguson, ferguson@cs.rochester.edu, 12 Sep 1991.
  1863. X * Version 2.0: 23 Apr 1993: For pre-R5 systems, we include the string-
  1864. SHAR_EOF
  1865. true || echo 'restore of xarchie-2.0.6/types.c failed'
  1866. fi
  1867. echo 'End of xarchie-2.0.6 part 15'
  1868. echo 'File xarchie-2.0.6/types.c is continued in part 16'
  1869. echo 16 > _shar_seq_.tmp
  1870. exit 0
  1871.  
  1872. exit 0 # Just in case...
  1873. -- 
  1874.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  1875. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  1876.  "It's intuitively obvious to the |
  1877.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1878.