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

  1. Newsgroups: comp.sources.x
  2. From: ferguson@cs.rochester.edu (George Ferguson)
  3. Subject: v20i044:  xarchie - An X browser interface to Archie, v2.0.6, Part16/24
  4. Message-ID: <1993Jun15.223431.1197@sparky.imd.sterling.com>
  5. X-Md4-Signature: 75361862115bc76d47bad84e28719b59
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 15 Jun 1993 22:34:31 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: ferguson@cs.rochester.edu (George Ferguson)
  12. Posting-number: Volume 20, Issue 44
  13. Archive-name: xarchie/part16
  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/part16
  19.  
  20. #!/bin/sh
  21. # this is Part.16 (part 16 of xarchie-2.0.6)
  22. # do not concatenate these parts, unpack them in order with /bin/sh
  23. # file xarchie-2.0.6/types.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" != 16; 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/types.c'
  39. else
  40. echo 'x - continuing file xarchie-2.0.6/types.c'
  41. sed 's/^X//' << 'SHAR_EOF' >> 'xarchie-2.0.6/types.c' &&
  42. X *                     to-font-struct converter.
  43. X */
  44. X
  45. #include <X11/IntrinsicP.h>
  46. #include <X11/StringDefs.h>
  47. #include <X11/Xaw/Form.h>
  48. #include <X11/Xaw/Cardinals.h>
  49. #include "types.h"
  50. #include "xarchie.h"
  51. #include "appres.h"
  52. #include "stringdefs.h"
  53. extern void XmuCvtStringToWidget();    /* original old-style converter */
  54. X
  55. /*
  56. X * In R5, more of the default converters are available externally.
  57. X * For R4 however, the string-to-font converters are static, so we
  58. X * include the appropriate code below.
  59. X */
  60. #if XtSpecificationRelease<5
  61. static Boolean CvtStringToFontStruct();        /* original static converter */
  62. static int CompareISOLatin1();
  63. #else
  64. extern Boolean XtCvtStringToFontStruct();    /* original converter */
  65. #endif
  66. X
  67. /*
  68. X * Functions defined here:
  69. X */
  70. void initConverters();
  71. SearchType stringToSearchType();
  72. SortType stringToSortType();
  73. char *searchTypeToString(),*sortTypeToString();
  74. X
  75. static void strcpyLowered();
  76. static Boolean cvtStringToSearchType(),cvtStringToSortType();
  77. static Boolean cvtStringToFontStruct();
  78. static void cvtStringToWidget(); /* old-style converter */
  79. X
  80. /* Straight from the Xt manual... */
  81. #define done(TYPE,VALUE)\
  82. {                            \
  83. X    if (toVal->addr != NULL) {                \
  84. X    if (toVal->size < sizeof(TYPE)) {        \
  85. X        toVal->size = sizeof(TYPE);            \
  86. X        return(False);                \
  87. X    }                        \
  88. X    *(TYPE *)(toVal->addr) = (VALUE);        \
  89. X    } else {                        \
  90. X    static TYPE static_val;                \
  91. X    static_val = (VALUE);                \
  92. X    toVal->addr = (XtPointer)&static_val;        \
  93. X    }                            \
  94. X    toVal->size = sizeof(TYPE);                \
  95. X    return(True);                    \
  96. }
  97. X                            
  98. void
  99. initConverters(appContext)
  100. XXtAppContext appContext;
  101. {
  102. X    static XtConvertArgRec parentCvtArgs[] = {
  103. X        {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent), sizeof(Widget)}
  104. X    };
  105. X    static XtConvertArgRec displayCvtArgs[] = {
  106. X    {XtAddress, (XtPointer)&display, sizeof(Display*)},
  107. X    };
  108. X
  109. X    /* Specify XtCacheNone for some reason, broke otherwise */
  110. X    XtSetTypeConverter(XtRString,GfRSearchType,cvtStringToSearchType,
  111. X               NULL,ZERO,XtCacheNone,NULL);
  112. X    XtSetTypeConverter(XtRString,GfRSortType,cvtStringToSortType,
  113. X               NULL,ZERO,XtCacheNone,NULL);
  114. X    /* Override default here */
  115. X    XtSetTypeConverter(XtRString,XtRFontStruct,cvtStringToFontStruct,
  116. X               displayCvtArgs,XtNumber(displayCvtArgs),
  117. X               XtCacheByDisplay,NULL);
  118. X    /* Have to initialize Form class first or our converter will be    */
  119. X    /* overidden by the class initialization function.            */
  120. X    /* Use the old style here on purpose since that what the default is.*/
  121. X    XtInitializeWidgetClass(formWidgetClass);
  122. X    XtAppAddConverter(appContext,XtRString,XtRWidget,cvtStringToWidget,
  123. X                    parentCvtArgs,XtNumber(parentCvtArgs));
  124. }
  125. X
  126. /*    -    -    -    -    -    -    -    -    */
  127. /* Xt converters */
  128. static void
  129. strcpyLowered(dst,src)
  130. char *dst,*src;
  131. {
  132. X    do {
  133. X    if (*src >= 'A' && *src <= 'Z')
  134. X        *dst++ = *src - 'A' + 'a';
  135. X    else
  136. X        *dst++ = *src;
  137. X    } while (*src++);
  138. }
  139. X
  140. /* ARGSUSED */
  141. static Boolean
  142. cvtStringToSearchType(display,args,num_args,fromVal,toVal,data)
  143. X    Display *display;
  144. X    XrmValuePtr args;        /* unused */
  145. X    Cardinal    *num_args;      /* unused */
  146. X    XrmValuePtr fromVal;
  147. X    XrmValuePtr toVal;
  148. X    XtPointer *data;        /* unused */
  149. {
  150. X    char message[256];
  151. X    SearchType type;
  152. X
  153. X    strcpyLowered(message,(char*)(fromVal->addr));
  154. X    if ((type=stringToSearchType(message)) != GfError)
  155. X    done(SearchType,type);
  156. X    XtDisplayStringConversionWarning(display,fromVal->addr,GfRSearchType);
  157. X    toVal->addr = NULL;
  158. X    toVal->size = 0;
  159. X    return(False);
  160. }
  161. X
  162. /* ARGSUSED */
  163. static Boolean
  164. cvtStringToSortType(display,args,num_args,fromVal,toVal,data)
  165. X    Display *display;
  166. X    XrmValuePtr args;        /* unused */
  167. X    Cardinal    *num_args;      /* unused */
  168. X    XrmValuePtr fromVal;
  169. X    XrmValuePtr toVal;
  170. X    XtPointer *data;        /* unused */
  171. {
  172. X    char message[256];
  173. X    SortType type;
  174. X
  175. X    strcpyLowered(message,(char*)(fromVal->addr));
  176. X    if ((type=stringToSortType(message)) != GfError)
  177. X    done(SortType,type);
  178. X    XtDisplayStringConversionWarning(display,fromVal->addr,GfRSortType);
  179. X    toVal->addr = NULL;
  180. X    toVal->size = 0;
  181. X    return(False);
  182. }
  183. X
  184. /*    -    -    -    -    -    -    -    -    */
  185. /*
  186. X * cvtStringToFontStruct() : This just checks for the two special names
  187. X *    "xarchieFont" and "xarchieBoldFont" and returns the appropriate
  188. X *    application resource. Otherwise invokes the default converter.
  189. X */
  190. X
  191. /* ARGSUSED */
  192. static Boolean
  193. cvtStringToFontStruct(display,args,num_args,fromVal,toVal,data)
  194. X    Display *display;
  195. X    XrmValuePtr args;
  196. X    Cardinal    *num_args;
  197. X    XrmValuePtr fromVal;
  198. X    XrmValuePtr toVal;
  199. X    XtPointer *data;
  200. {
  201. X    char message[256];
  202. X
  203. X    strcpyLowered(message,(char*)(fromVal->addr));
  204. X    if (strcmp(message,"xarchiefont") == 0)
  205. X    done(XFontStruct*,appResources.xarchieFont);
  206. X    if (strcmp(message,"xarchieboldfont") == 0)
  207. X    done(XFontStruct*,appResources.xarchieBoldFont);
  208. #if XtSpecificationRelease<5
  209. X    return(CvtStringToFontStruct(display,args,num_args,fromVal,toVal,data));
  210. #else
  211. X    return(XtCvtStringToFontStruct(display,args,num_args,fromVal,toVal,data));
  212. #endif
  213. }
  214. X
  215. /*    -    -    -    -    -    -    -    -    */
  216. /*
  217. X * cvtStringToWidget() : Allows us to specify "NULL" as a widget name in
  218. X *    a resource file to override compiled-in defaults for composite
  219. X *    widget layouts. Simply calls the regular converter if the string
  220. X *    is not "NULL". Note that this must be registered *after* the
  221. X *    Form class is initialized.
  222. X */
  223. static void
  224. cvtStringToWidget(args,num_args,fromVal,toVal)
  225. XXrmValuePtr args;
  226. Cardinal *num_args;
  227. XXrmValuePtr fromVal;
  228. XXrmValuePtr toVal;
  229. {
  230. X    if (strcasecmp(fromVal->addr,"null") == 0) {
  231. X    toVal->addr = NULL;
  232. X    toVal->size = 0;
  233. X    } else {
  234. X    XmuCvtStringToWidget(args,num_args,fromVal,toVal);
  235. X    }
  236. }
  237. X
  238. /*    -    -    -    -    -    -    -    -    */
  239. /* Useful generic converters */
  240. X
  241. SearchType
  242. stringToSearchType(s)
  243. char *s;
  244. {
  245. X    if (strcmp(s,GfNExact) == 0)
  246. X    return(GfExact);
  247. X    if (strcmp(s,GfNSubstr) == 0)
  248. X    return(GfSubstr);
  249. X    if (strcmp(s,GfNSubcase) == 0)
  250. X    return(GfSubcase);
  251. X    if (strcmp(s,GfNRegexp) == 0)
  252. X    return(GfRegexp);
  253. X    if (strcmp(s,GfNExactSubstr) == 0)
  254. X    return(GfExactSubstr);
  255. X    if (strcmp(s,"GfNExactSubcase") == 0)
  256. X    return(GfExactSubcase);
  257. X    if (strcmp(s,"GfNExactRegexp") == 0)
  258. X    return(GfExactRegexp);
  259. X    return(GfError);
  260. }
  261. X
  262. char *
  263. searchTypeToString(type)
  264. SearchType type;
  265. {
  266. X    switch (type) {
  267. X    case GfExact :        return(GfNExact);
  268. X    case GfSubstr :     return(GfNSubstr);
  269. X    case GfSubcase :    return(GfNSubcase);
  270. X    case GfRegexp :      return(GfNRegexp);
  271. X    case GfExactSubstr :    return(GfNExactSubstr);
  272. X    case GfExactSubcase :    return(GfNExactSubcase);
  273. X    case GfExactRegexp :    return(GfNExactRegexp);
  274. X    default: return("UNKNOWN");
  275. X    }
  276. }
  277. X
  278. SortType
  279. stringToSortType(s)
  280. char *s;
  281. {
  282. X    if (strcmp(s,GfNName) == 0)
  283. X    return(GfName);
  284. X    if (strcmp(s,GfNDate) == 0)
  285. X    return(GfDate);
  286. X    if (strcmp(s,GfNWeight) == 0)
  287. X    return(GfWeight);
  288. X    return(GfError);
  289. }
  290. X
  291. char *
  292. sortTypeToString(type)
  293. SortType type;
  294. {
  295. X    switch (type) {
  296. X    case GfName : return(GfNName);
  297. X    case GfDate : return(GfNDate);
  298. X    case GfWeight : return(GfNWeight);
  299. X    default: return("UNKNOWN");
  300. X    }
  301. }
  302. X
  303. /*    -    -    -    -    -    -    -    -    */
  304. /* The string-to-font-struct converter was static in R4 (and earlier?)
  305. X * so we include it here if necessary. This code is taken from the
  306. X * file lib/Xt/Converters.c in the R4 distribution.
  307. X */
  308. X
  309. #if XtSpecificationRelease<5
  310. /***********************************************************
  311. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  312. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  313. X
  314. X                        All Rights Reserved
  315. X
  316. Permission to use, copy, modify, and distribute this software and its 
  317. documentation for any purpose and without fee is hereby granted, 
  318. provided that the above copyright notice appear in all copies and that
  319. both that copyright notice and this permission notice appear in 
  320. supporting documentation, and that the names of Digital or MIT not be
  321. used in advertising or publicity pertaining to distribution of the
  322. software without specific, written prior permission.  
  323. X
  324. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  325. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  326. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  327. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  328. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  329. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  330. SOFTWARE.
  331. X
  332. ******************************************************************/
  333. X
  334. #include <X11/keysym.h>
  335. #include <X11/Quarks.h>
  336. X
  337. /*ARGSUSED*/
  338. static Boolean
  339. CvtStringToFontStruct(dpy, args, num_args, fromVal, toVal, closure_ret)
  340. X    Display*    dpy;
  341. X    XrmValuePtr args;
  342. X    Cardinal    *num_args;
  343. X    XrmValuePtr    fromVal;
  344. X    XrmValuePtr    toVal;
  345. X    XtPointer    *closure_ret;
  346. {
  347. X    XFontStruct        *f;
  348. X    Display*    display;
  349. X
  350. X    if (*num_args != 1)
  351. X     XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
  352. X         "wrongParameters","cvtStringToFontStruct","XtToolkitError",
  353. X             "String to font conversion needs display argument",
  354. X              (String *) NULL, (Cardinal *)NULL);
  355. X
  356. X    display = *(Display**)args[0].addr;
  357. X
  358. X    if (CompareISOLatin1((String)fromVal->addr, XtDefaultFont) != 0) {
  359. X    f = XLoadQueryFont(display, (char *)fromVal->addr);
  360. X    if (f != NULL) {
  361. X  Done:        done( XFontStruct*, f);
  362. X    }
  363. X
  364. X    XtDisplayStringConversionWarning( dpy, (char*)fromVal->addr,
  365. X                      "FontStruct" );
  366. X    }
  367. X
  368. X    /* try and get the default font */
  369. X
  370. X    {
  371. X    XrmName xrm_name[2];
  372. X    XrmClass xrm_class[2];
  373. X    XrmRepresentation rep_type;
  374. X    XrmValue value;
  375. X
  376. X    xrm_name[0] = XrmStringToName ("xtDefaultFont");
  377. X    xrm_name[1] = NULL;
  378. X    xrm_class[0] = XrmStringToClass ("XtDefaultFont");
  379. X    xrm_class[1] = NULL;
  380. X    if (XrmQGetResource(XtDatabase(dpy), xrm_name, xrm_class, 
  381. X                &rep_type, &value)) {
  382. X        if (rep_type == XtQString) {
  383. X        f = XLoadQueryFont(display, (char*)value.addr);
  384. X        if (f != NULL)
  385. X            goto Done;
  386. X        else {
  387. X            XtDisplayStringConversionWarning( dpy, (char*)value.addr,
  388. X                              "FontStruct" );
  389. X        }
  390. X        } else if (rep_type == XtQFont) {
  391. X        f = XQueryFont(dpy, *(Font*)value.addr );
  392. X        if (f != NULL) goto Done;
  393. X        } else if (rep_type == XtQFontStruct) {
  394. X        f = (XFontStruct*)value.addr;
  395. X        goto Done;
  396. X        }
  397. X    }
  398. X    }
  399. X    /* Should really do XListFonts, but most servers support this */
  400. X    f = XLoadQueryFont(dpy,"-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1");
  401. X    if (f != NULL)
  402. X    goto Done;
  403. X
  404. X    XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
  405. X         "noFont","cvtStringToFontStruct","XtToolkitError",
  406. X             "Unable to load any useable ISO8859-1 font",
  407. X              (String *) NULL, (Cardinal *)NULL);
  408. X    
  409. X    return False;
  410. }
  411. X
  412. static int CompareISOLatin1 (first, second)
  413. X    char *first, *second;
  414. {
  415. X    register unsigned char *ap, *bp;
  416. X
  417. X    for (ap = (unsigned char *) first, bp = (unsigned char *) second;
  418. X     *ap && *bp; ap++, bp++) {
  419. X    register unsigned char a, b;
  420. X
  421. X    if ((a = *ap) != (b = *bp)) {
  422. X        /* try lowercasing and try again */
  423. X
  424. X        if ((a >= XK_A) && (a <= XK_Z))
  425. X          a += (XK_a - XK_A);
  426. X        else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
  427. X          a += (XK_agrave - XK_Agrave);
  428. X        else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
  429. X          a += (XK_oslash - XK_Ooblique);
  430. X
  431. X        if ((b >= XK_A) && (b <= XK_Z))
  432. X          b += (XK_a - XK_A);
  433. X        else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis))
  434. X          b += (XK_agrave - XK_Agrave);
  435. X        else if ((b >= XK_Ooblique) && (b <= XK_Thorn))
  436. X          b += (XK_oslash - XK_Ooblique);
  437. X
  438. X        if (a != b) break;
  439. X    }
  440. X    }
  441. X    return (((int) *bp) - ((int) *ap));
  442. }
  443. #endif /* <R5 */
  444. SHAR_EOF
  445. echo 'File xarchie-2.0.6/types.c is complete' &&
  446. chmod 0644 xarchie-2.0.6/types.c ||
  447. echo 'restore of xarchie-2.0.6/types.c failed'
  448. Wc_c="`wc -c < 'xarchie-2.0.6/types.c'`"
  449. test 11840 -eq "$Wc_c" ||
  450.     echo 'xarchie-2.0.6/types.c: original size 11840, current size' "$Wc_c"
  451. rm -f _shar_wnt_.tmp
  452. fi
  453. # ============= xarchie-2.0.6/types.h ==============
  454. if test -f 'xarchie-2.0.6/types.h' -a X"$1" != X"-c"; then
  455.     echo 'x - skipping xarchie-2.0.6/types.h (File already exists)'
  456.     rm -f _shar_wnt_.tmp
  457. else
  458. > _shar_wnt_.tmp
  459. echo 'x - extracting xarchie-2.0.6/types.h (Text)'
  460. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/types.h' &&
  461. /*
  462. X * types.h : Definitions of SearchType and SortType
  463. X *
  464. X * George Ferguson, ferguson@cs.rochester.edu, 4 Sep 1991.
  465. X * Version 2.0: 23 Apr 1993.
  466. X */
  467. X
  468. #ifndef TYPES_H
  469. #define TYPES_H
  470. X
  471. /* These codes correspond to Prospero key letters */
  472. #define GfExact        '='
  473. #define GfSubstr    'S'
  474. #define GfSubcase    'C'
  475. #define GfRegexp    'R'
  476. #define GfExactSubstr    's'
  477. #define GfExactSubcase    'c'
  478. #define GfExactRegexp    'r'
  479. X
  480. typedef char SearchType;
  481. X
  482. #define GfRSearchType    "SearchType"
  483. #define GfNExact    "exact"
  484. #define GfNSubstr    "substr"
  485. #define GfNSubcase    "subcase"
  486. #define GfNRegexp    "regexp"
  487. #define GfNExactSubstr    "exactsubstr"
  488. #define GfNExactSubcase    "exactsubcase"
  489. #define GfNExactRegexp    "exactregexp"
  490. X
  491. /* This puke is so the bloody converters work. Argh! */
  492. #define GfName        '\001'
  493. #define GfDate        '\002'
  494. #define GfWeight    '\003'
  495. X
  496. typedef char SortType;
  497. X
  498. #define GfRSortType    "SortType"
  499. #define GfNName        "name"
  500. #define GfNDate        "date"
  501. #define GfNWeight    "weight"
  502. X
  503. /* Since these are both char's we can use one constant for errors */
  504. #define GfError        '\0'
  505. X
  506. extern void initConverters();
  507. extern SearchType stringToSearchType();
  508. extern SortType stringToSortType();
  509. extern char *searchTypeToString(),*sortTypeToString();
  510. X
  511. #endif /* TYPES_H */
  512. SHAR_EOF
  513. chmod 0644 xarchie-2.0.6/types.h ||
  514. echo 'restore of xarchie-2.0.6/types.h failed'
  515. Wc_c="`wc -c < 'xarchie-2.0.6/types.h'`"
  516. test 1218 -eq "$Wc_c" ||
  517.     echo 'xarchie-2.0.6/types.h: original size 1218, current size' "$Wc_c"
  518. rm -f _shar_wnt_.tmp
  519. fi
  520. # ============= xarchie-2.0.6/udp.c ==============
  521. if test -f 'xarchie-2.0.6/udp.c' -a X"$1" != X"-c"; then
  522.     echo 'x - skipping xarchie-2.0.6/udp.c (File already exists)'
  523.     rm -f _shar_wnt_.tmp
  524. else
  525. > _shar_wnt_.tmp
  526. echo 'x - extracting xarchie-2.0.6/udp.c (Text)'
  527. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/udp.c' &&
  528. /*
  529. X * udp - Check if UDP traffic is allowed on this host; we open port 1527 on
  530. X *       a system (default of cs.widener.edu), which is expecting it; the
  531. X *       date is output (e.g. very similar to the daytime service).  This
  532. X *       will conclusively tell us if UDP traffic on ports > 1000 is allowed.
  533. X *
  534. X *    It should print out the date if UDP traffic's not blocked on your
  535. X *    system.  If it just hangs, try these tests too:
  536. X *      a. run it with -d  (e.g. "udp -d"); that goes to the normal UDP port
  537. X *         to print the date.  If it works, then you can be sure that any
  538. X *         UDP traffic > port 1000 is blocked on your system.
  539. X *      b. if it hangs too, try "telnet 147.31.254.130 13" and see if
  540. X *         _that_ prints the date; if it doesn't, it's another problem (your
  541. X *         network can't get to me, e.g.).
  542. X *
  543. X * Compile by: cc -o udp udp.c
  544. X *
  545. X * Brendan Kehoe, brendan@cs.widener.edu, Oct 1991.
  546. X */
  547. X
  548. #include <stdio.h>
  549. #include <sys/types.h>
  550. #include <sys/socket.h>
  551. #include <netinet/in.h>
  552. #ifndef hpux
  553. # include <arpa/inet.h>
  554. #endif
  555. X
  556. #define    SIZE    2048
  557. #define    HOST    "147.31.254.130"    /* cs.widener.edu */
  558. #define PORT    1527
  559. X
  560. main (argc, argv)
  561. X     int argc;
  562. X     char **argv;
  563. {
  564. X  int s, len;
  565. X  struct sockaddr_in server, sa;
  566. X  char buf[SIZE];
  567. X
  568. X  if ((s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
  569. X    {
  570. X      perror ("socket()");
  571. X      exit (1);
  572. X    }
  573. X
  574. X  bzero ((char *) &sa, sizeof (sa));
  575. X  sa.sin_family = AF_INET;
  576. X  sa.sin_addr.s_addr = htonl (INADDR_ANY);
  577. X  sa.sin_port = htons (0);
  578. X
  579. X  if (bind (s, (struct sockaddr *) &sa, sizeof (sa)) < 0)
  580. X    {
  581. X      perror ("bind()");
  582. X      exit (1);
  583. X    }
  584. X
  585. X  bzero ((char *) &server, sizeof (server));
  586. X  server.sin_family = AF_INET;
  587. X  server.sin_addr.s_addr = inet_addr (HOST);
  588. X  if (argc > 1 && strcmp(*(argv + 1), "-d") == 0)
  589. X    server.sin_port = htons ((unsigned short) 13);
  590. X  else
  591. X    server.sin_port = htons ((unsigned short) PORT);
  592. X
  593. X  /* yoo hoo, we're here .. */
  594. X  if (sendto (s, "\n", 1, 0, &server, sizeof (server)) < 0)
  595. X    {
  596. X      perror ("sendto()");
  597. X      exit (1);
  598. X    }
  599. X
  600. X  /* slurp */
  601. X  len = sizeof (server);
  602. X  if (recvfrom (s, buf, sizeof (buf), 0, &server, &len) < 0)
  603. X    {
  604. X      perror ("recvfrom");
  605. X      exit (1);
  606. X    }
  607. X
  608. X  printf ("%s", buf);
  609. X  close (s);
  610. }
  611. SHAR_EOF
  612. chmod 0644 xarchie-2.0.6/udp.c ||
  613. echo 'restore of xarchie-2.0.6/udp.c failed'
  614. Wc_c="`wc -c < 'xarchie-2.0.6/udp.c'`"
  615. test 2234 -eq "$Wc_c" ||
  616.     echo 'xarchie-2.0.6/udp.c: original size 2234, current size' "$Wc_c"
  617. rm -f _shar_wnt_.tmp
  618. fi
  619. # ============= xarchie-2.0.6/username.c ==============
  620. if test -f 'xarchie-2.0.6/username.c' -a X"$1" != X"-c"; then
  621.     echo 'x - skipping xarchie-2.0.6/username.c (File already exists)'
  622.     rm -f _shar_wnt_.tmp
  623. else
  624. > _shar_wnt_.tmp
  625. echo 'x - extracting xarchie-2.0.6/username.c (Text)'
  626. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/username.c' &&
  627. /*
  628. X * username.c : Some people are tricky about this...
  629. X *
  630. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  631. X *
  632. X * Compile-time parameters (config.h):
  633. X *    HAVE_PWD :      File <pwd.h> defines getpwuid()
  634. X *    HAVE_GETLOGIN : Function char *getlogin() exists
  635. X */
  636. #include <stdio.h>
  637. #include "config.h"
  638. X
  639. #include <sys/types.h>
  640. extern uid_t getuid();        /* not in stdlib.h, but is in unistd.h */
  641. extern char *getenv();
  642. #ifdef HAVE_GETPWUID
  643. #include <pwd.h>
  644. #endif
  645. #ifdef HAVE_GETLOGIN
  646. extern char *getlogin();
  647. #endif
  648. X
  649. char *
  650. GetUsername()
  651. {
  652. X    char *username;
  653. X
  654. #ifdef HAVE_GETPWUID
  655. X    struct passwd *pwe;
  656. X    if ((pwe=getpwuid(getuid())) != NULL)
  657. X        username = pwe->pw_name;
  658. X    else
  659. #endif
  660. #ifdef HAVE_GETLOGIN
  661. X    if ((username=getlogin()) == NULL)
  662. #endif
  663. X        if ((username=getenv("USER")) == NULL) {
  664. X        fprintf(stderr,"Couldn't find username, you should set $USER");
  665. X        username = "anonymous";
  666. X        }
  667. X    return(username);
  668. }
  669. X
  670. #ifdef STANDALONE
  671. main()
  672. {
  673. X    printf("%s\n",GetUsername());
  674. X    exit(0);
  675. }
  676. #endif /* STANDALONE */
  677. SHAR_EOF
  678. chmod 0644 xarchie-2.0.6/username.c ||
  679. echo 'restore of xarchie-2.0.6/username.c failed'
  680. Wc_c="`wc -c < 'xarchie-2.0.6/username.c'`"
  681. test 1030 -eq "$Wc_c" ||
  682.     echo 'xarchie-2.0.6/username.c: original size 1030, current size' "$Wc_c"
  683. rm -f _shar_wnt_.tmp
  684. fi
  685. # ============= xarchie-2.0.6/username.h ==============
  686. if test -f 'xarchie-2.0.6/username.h' -a X"$1" != X"-c"; then
  687.     echo 'x - skipping xarchie-2.0.6/username.h (File already exists)'
  688.     rm -f _shar_wnt_.tmp
  689. else
  690. > _shar_wnt_.tmp
  691. echo 'x - extracting xarchie-2.0.6/username.h (Text)'
  692. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/username.h' &&
  693. /*
  694. X * username.h : Definition of "portable" username function
  695. X *
  696. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  697. X */
  698. X
  699. extern char *GetUsername();
  700. SHAR_EOF
  701. chmod 0644 xarchie-2.0.6/username.h ||
  702. echo 'restore of xarchie-2.0.6/username.h failed'
  703. Wc_c="`wc -c < 'xarchie-2.0.6/username.h'`"
  704. test 158 -eq "$Wc_c" ||
  705.     echo 'xarchie-2.0.6/username.h: original size 158, current size' "$Wc_c"
  706. rm -f _shar_wnt_.tmp
  707. fi
  708. # ============= xarchie-2.0.6/view-file.c ==============
  709. if test -f 'xarchie-2.0.6/view-file.c' -a X"$1" != X"-c"; then
  710.     echo 'x - skipping xarchie-2.0.6/view-file.c (File already exists)'
  711.     rm -f _shar_wnt_.tmp
  712. else
  713. > _shar_wnt_.tmp
  714. echo 'x - extracting xarchie-2.0.6/view-file.c (Text)'
  715. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/view-file.c' &&
  716. /*
  717. X * view-file.c : Routines for the windows when files are "opened" via ftp
  718. X *
  719. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  720. X */
  721. #include <stdio.h>
  722. #include <X11/Intrinsic.h>
  723. #include <X11/Shell.h>
  724. #include <X11/StringDefs.h>
  725. #include <X11/Xaw/Form.h>
  726. #include <X11/Xaw/Label.h>
  727. #include <X11/Xaw/Command.h>
  728. #include <X11/Xaw/AsciiText.h>
  729. #include "config.h"
  730. #ifdef HAVE_SYS_PARAM_H
  731. #include <sys/param.h>
  732. #endif
  733. #include "xarchie.h"
  734. #include "fchooser.h"
  735. #include "stringdefs.h"
  736. #include "xutil.h"
  737. #include "syserr.h"
  738. #include "debug.h"
  739. X
  740. /*
  741. X * Functions defined here:
  742. X */
  743. void viewFile();
  744. X
  745. static void nonmaskableEventHandler();
  746. static void viewDone(),viewDown(),viewUp(),viewSave();
  747. static void viewSaveOk(),viewSaveCancel();
  748. static int fileCopy();
  749. X
  750. /*
  751. X * Data defined here:
  752. X */
  753. typedef struct _ViewFileInfo {
  754. X    Widget shell;
  755. X    Widget text;
  756. X    String filename;
  757. } ViewFileInfo;
  758. X
  759. /*    -    -    -    -    -    -    -    -    */
  760. X
  761. void
  762. viewFile(filename)
  763. char *filename;
  764. {
  765. X    ViewFileInfo *vfinfo;
  766. X    Widget form,button;
  767. X    Arg args[2];
  768. X
  769. X    vfinfo = XtNew(ViewFileInfo);
  770. X    vfinfo->filename = XtNewString(filename);
  771. X    XtSetArg(args[0],XtNtitle,filename);
  772. X    vfinfo->shell = XtCreatePopupShell("viewShell",topLevelShellWidgetClass,
  773. X                       toplevel,args,1);
  774. X    form = XtCreateManagedWidget("viewForm",formWidgetClass,
  775. X                 vfinfo->shell,NULL,0);
  776. X    button = XtCreateManagedWidget("viewDoneButton",commandWidgetClass,
  777. X                   form,NULL,0);
  778. X    XtAddCallback(button,XtNcallback,viewDone,(XtPointer)vfinfo);
  779. X    button = XtCreateManagedWidget("viewDownButton",commandWidgetClass,
  780. X                   form,NULL,0);
  781. X    XtAddCallback(button,XtNcallback,viewDown,(XtPointer)vfinfo);
  782. X    button = XtCreateManagedWidget("viewUpButton",commandWidgetClass,
  783. X                   form,NULL,0);
  784. X    XtAddCallback(button,XtNcallback,viewUp,(XtPointer)vfinfo);
  785. X    button = XtCreateManagedWidget("viewSaveButton",commandWidgetClass,
  786. X                   form,NULL,0);
  787. X    XtAddCallback(button,XtNcallback,viewSave,(XtPointer)vfinfo);
  788. X    XtSetArg(args[0],XtNtype,XawAsciiFile);
  789. X    XtSetArg(args[1],XtNstring,filename);
  790. X    vfinfo->text = XtCreateManagedWidget("viewText",asciiTextWidgetClass,
  791. X                     form,args,2);
  792. X    XtRealizeWidget(vfinfo->shell);
  793. X    /* Allow WM_DELETE_WINDOW to the Shell to be Done */
  794. X    (void)XSetWMProtocols(XtDisplay(vfinfo->shell),XtWindow(vfinfo->shell),
  795. X              &WM_DELETE_WINDOW,1);
  796. X    XtAddEventHandler(vfinfo->shell,NoEventMask,True,
  797. X              nonmaskableEventHandler,(XtPointer)vfinfo);
  798. X    XtPopup(vfinfo->shell,XtGrabNone);
  799. }
  800. X
  801. /*
  802. X * Nonmaskable event handler for Shell: If the event is a ClientMessage
  803. X * of WM_PROTOCOLS then act as if Done had been clicked.
  804. X */
  805. /*ARGSUSED*/
  806. static void
  807. nonmaskableEventHandler(w,client_data,event,continue_to_dispatch)
  808. Widget w;
  809. XXtPointer client_data;
  810. XXEvent *event;
  811. Boolean *continue_to_dispatch;
  812. {
  813. X    DEBUG1("nonmaskableHandler: w=0x%x\n",w);
  814. X    if (event->type == ClientMessage &&
  815. X        event->xclient.data.l[0] == WM_DELETE_WINDOW) {
  816. X    DEBUG0("nonmaskableHandler: calling cancelButtonCallback\n");
  817. X    viewDone(NULL,client_data,NULL);
  818. X    }
  819. X    DEBUG0("nonmaskableHandler: done\n");
  820. }
  821. X
  822. /*    -    -    -    -    -    -    -    -    */
  823. /* Callbacks for the view window */
  824. X
  825. /*ARGSUSED*/
  826. static void
  827. viewDone(w,client_data,call_data)
  828. Widget w;
  829. XXtPointer client_data;        /* ViewFileInfo */
  830. XXtPointer call_data;        /* not used */
  831. {
  832. X    ViewFileInfo *vfinfo = (ViewFileInfo *)client_data;
  833. X    char *name;
  834. X
  835. X    DEBUG0("viewDone...\n");
  836. X    name = getWidgetString(vfinfo->text);
  837. X    if (name != NULL && *name != '\0') {
  838. X    DEBUG1("viewDone: unlinking \"%s\"\n",name);
  839. X    if (unlink(name) < 0)
  840. X        sysError(name);
  841. X    }
  842. X    XtPopdown(vfinfo->shell);
  843. X    XtUnrealizeWidget(vfinfo->shell);
  844. X    XtDestroyWidget(vfinfo->shell);
  845. X    XtFree(vfinfo->filename);
  846. X    XtFree((char*)vfinfo);
  847. X    DEBUG0("viewDone: done\n");
  848. }
  849. X
  850. /*ARGSUSED*/
  851. static void
  852. viewDown(w,client_data,call_data)
  853. Widget w;
  854. XXtPointer client_data;        /* ViewFileInfo */
  855. XXtPointer call_data;        /* not used */
  856. {
  857. X    ViewFileInfo *vfinfo = (ViewFileInfo *)client_data;
  858. X
  859. X    XtCallActionProc(vfinfo->text,"next-page",NULL,NULL,0);
  860. }
  861. X
  862. /*ARGSUSED*/
  863. static void
  864. viewUp(w,client_data,call_data)
  865. Widget w;
  866. XXtPointer client_data;        /* ViewFileInfo */
  867. XXtPointer call_data;        /* not used */
  868. {
  869. X    ViewFileInfo *vfinfo = (ViewFileInfo *)client_data;
  870. X
  871. X    XtCallActionProc(vfinfo->text,"previous-page",NULL,NULL,0);
  872. }
  873. X
  874. /*ARGSUSED*/
  875. static void
  876. viewSave(w,client_data,call_data)
  877. Widget w;
  878. XXtPointer client_data;        /* ViewFileInfo */
  879. XXtPointer call_data;        /* not used */
  880. {
  881. X    ViewFileInfo *vfinfo = (ViewFileInfo *)client_data;
  882. X    FileChooserInfo *fcinfo;
  883. X    Widget shell,form,text;
  884. X    char *name,*basename;
  885. X    Arg args[1];
  886. X
  887. X    DEBUG0("viewSave...\n");
  888. X    setBusyStatus(True);
  889. X    shell = XtCreatePopupShell("viewSaveShell",topLevelShellWidgetClass,
  890. X                   vfinfo->shell,NULL,0);
  891. X    form = XtCreateManagedWidget("viewSaveForm",formWidgetClass,
  892. X                 shell,NULL,0);
  893. X    (void)XtCreateManagedWidget("viewSaveLabel",labelWidgetClass,
  894. X                form,NULL,0);
  895. X    text = XtCreateManagedWidget("viewSaveLabelText",asciiTextWidgetClass,
  896. X                 form,NULL,0);
  897. X    name = vfinfo->filename;
  898. X    setWidgetString(text,name);
  899. X    fcinfo = createFileChooser(shell,form,"viewSave",viewSaveOk,
  900. X                   viewSaveCancel,(XtPointer)vfinfo);
  901. X    /* Adjust vertical layout */
  902. X    XtSetArg(args[0],XtNfromVert,text);
  903. #ifdef FILECHOOSER
  904. X    XtSetValues(fcinfo->fcw,args,1);
  905. #else
  906. X    XtSetValues(fcinfo->text,args,1);
  907. #endif
  908. X    /* Realize them all */
  909. X    XtRealizeWidget(shell);
  910. X    /* Set initial filename (has to be after realize for some reason) */
  911. X    if ((basename=rindex(name,'/')) != NULL)
  912. X    name = basename+1;
  913. X    setWidgetString(fcinfo->text,name);
  914. X    /* Register window for WM */
  915. X    (void)XSetWMProtocols(XtDisplay(shell),XtWindow(shell),
  916. X              &WM_DELETE_WINDOW,1);
  917. X    /* Here we go */
  918. X    XtPopup(shell,XtGrabNone);
  919. X    setBusyStatus(False);
  920. X    DEBUG0("viewSave: done\n");
  921. }
  922. X
  923. /*    -    -    -    -    -    -    -    -    */
  924. /* Callbacks from the view-save FileChooser */
  925. X
  926. /*ARGSUSED*/
  927. static void
  928. viewSaveOk(fcinfo,filename,client_data)
  929. FileChooserInfo *fcinfo;
  930. char *filename;
  931. XXtPointer client_data;        /* ViewFileInfo */
  932. {
  933. X    ViewFileInfo *vfinfo = (ViewFileInfo *)client_data;
  934. X
  935. X    DEBUG1("viewSaveOk: fcinfo=0x%x\n",fcinfo);
  936. X    DEBUG2("viewSaveOk: copying \"%s\" to \"%s\"\n",vfinfo->filename,filename);
  937. X    if (fileCopy(vfinfo->filename,filename) >= 0) {
  938. X    /* Remove the File Selector if successful */
  939. X    XtPopdown(fcinfo->shell);
  940. X    XtUnrealizeWidget(fcinfo->shell);
  941. X    XtDestroyWidget(fcinfo->shell);
  942. X    XtFree((char*)fcinfo);
  943. X    }
  944. X    DEBUG0("viewSaveOk: done\n");
  945. }
  946. X
  947. /*ARGSUSED*/
  948. static void
  949. viewSaveCancel(fcinfo,client_data)
  950. FileChooserInfo *fcinfo;
  951. XXtPointer client_data;        /* ViewFileInfo */
  952. {
  953. X    DEBUG1("viewSaveCancel: fcinfo=0x%x\n",fcinfo);
  954. X    XtPopdown(fcinfo->shell);
  955. X    XtUnrealizeWidget(fcinfo->shell);
  956. X    XtDestroyWidget(fcinfo->shell);
  957. X    XtFree((char*)fcinfo);
  958. X    DEBUG0("viewSaveCancel: done\n");
  959. }
  960. X
  961. /*    -    -    -    -    -    -    -    -    */
  962. /* Misc. functions */
  963. X
  964. static int
  965. fileCopy(path1,path2)
  966. char *path1,*path2;
  967. {
  968. X    FILE *infp,*outfp;
  969. X    char buf[BUFSIZ];
  970. X    int n,retcode;
  971. X
  972. X    DEBUG2("fileCopy: \"%s\" \"%s\"\n",path1,path2);
  973. X    if ((infp=fopen(path1,"r")) == NULL) {
  974. X    sysError(path1);
  975. X    return(-1);
  976. X    }
  977. X    if ((outfp=fopen(path2,"w")) == NULL) {
  978. X    sysError(path2);
  979. X    return(-1);
  980. X    }
  981. X    retcode = 0;
  982. X    while (!feof(infp)) {
  983. X    if ((n=fread(buf,1,sizeof(buf),infp)) <= 0) {
  984. X        sysError("read");
  985. X        retcode = -1;
  986. X        break;
  987. X    }
  988. X    if (fwrite(buf,1,n,outfp) != n) {
  989. X        sysError("write");
  990. X        retcode = -1;
  991. X        break;
  992. X    }
  993. X    }
  994. X    fclose(infp);
  995. X    fclose(outfp);
  996. X    DEBUG0("fileCopy: done\n");
  997. X    return(retcode);
  998. }
  999. SHAR_EOF
  1000. chmod 0644 xarchie-2.0.6/view-file.c ||
  1001. echo 'restore of xarchie-2.0.6/view-file.c failed'
  1002. Wc_c="`wc -c < 'xarchie-2.0.6/view-file.c'`"
  1003. test 7619 -eq "$Wc_c" ||
  1004.     echo 'xarchie-2.0.6/view-file.c: original size 7619, current size' "$Wc_c"
  1005. rm -f _shar_wnt_.tmp
  1006. fi
  1007. # ============= xarchie-2.0.6/view-file.h ==============
  1008. if test -f 'xarchie-2.0.6/view-file.h' -a X"$1" != X"-c"; then
  1009.     echo 'x - skipping xarchie-2.0.6/view-file.h (File already exists)'
  1010.     rm -f _shar_wnt_.tmp
  1011. else
  1012. > _shar_wnt_.tmp
  1013. echo 'x - extracting xarchie-2.0.6/view-file.h (Text)'
  1014. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/view-file.h' &&
  1015. /*
  1016. X * view-file.c : Defs for the popus when files are "opened" via ftp
  1017. X *
  1018. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1019. X */
  1020. X
  1021. extern void initViewerActions();
  1022. extern void viewFile();
  1023. SHAR_EOF
  1024. chmod 0644 xarchie-2.0.6/view-file.h ||
  1025. echo 'restore of xarchie-2.0.6/view-file.h failed'
  1026. Wc_c="`wc -c < 'xarchie-2.0.6/view-file.h'`"
  1027. test 196 -eq "$Wc_c" ||
  1028.     echo 'xarchie-2.0.6/view-file.h: original size 196, current size' "$Wc_c"
  1029. rm -f _shar_wnt_.tmp
  1030. fi
  1031. # ============= xarchie-2.0.6/vl_comp.c ==============
  1032. if test -f 'xarchie-2.0.6/vl_comp.c' -a X"$1" != X"-c"; then
  1033.     echo 'x - skipping xarchie-2.0.6/vl_comp.c (File already exists)'
  1034.     rm -f _shar_wnt_.tmp
  1035. else
  1036. > _shar_wnt_.tmp
  1037. echo 'x - extracting xarchie-2.0.6/vl_comp.c (Text)'
  1038. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/vl_comp.c' &&
  1039. /*
  1040. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  1041. X *
  1042. X * For copying and distribution information, please see the file
  1043. X * <copyright.h>.
  1044. X */
  1045. X
  1046. #include <copyright.h>
  1047. #include <pfs.h>
  1048. X
  1049. /*
  1050. X * vl_comp - compare the names of two virtual links
  1051. X *
  1052. X *           VL_COMP compares the names of two links.  It returns
  1053. X *           0 if they are equal, negative if vl1 < vl2, and positive if
  1054. X *           vl1 > vl2.
  1055. X *
  1056. X *    ARGS:  vl1,vl2 - Virtual links to be compared
  1057. X * 
  1058. X * RETURNS:  0 if equal, + is vl1 > vl2, - if vl1 < vl2
  1059. X *
  1060. X *   NOTES:  Order of significance is as follows.  Existence,
  1061. X *           name.  If names do not exist, then hosttype, host,
  1062. X *           native filenametype, native filename.  The only time
  1063. X *           the name will not exist if if the link is a union link.
  1064. X */
  1065. int
  1066. vl_comp(vl1,vl2)
  1067. X    VLINK    vl1;
  1068. X    VLINK    vl2;
  1069. X    {
  1070. X    int    retval;
  1071. X
  1072. X    if(vl1->name && !vl2->name) return(1);
  1073. X    if(!vl1->name && vl2->name) return(-1);
  1074. X    if(vl1->name && vl2->name && (*(vl1->name) || *(vl2->name)))
  1075. X        return(strcmp(vl1->name,vl2->name));
  1076. X
  1077. X    retval = strcmp(vl1->hosttype,vl2->hosttype);
  1078. X    if(!retval) retval = strcmp(vl1->host,vl2->host);
  1079. X    if(!retval) retval = strcmp(vl1->nametype,vl2->nametype);
  1080. X    if(!retval) retval = strcmp(vl1->filename,vl2->filename);
  1081. X    return(retval);
  1082. X    }
  1083. X
  1084. /*
  1085. X * vl_equal - compare the values of two virtual links
  1086. X *
  1087. X *           VL_EQUAL compares the values of two links.  It returns
  1088. X *           1 if all important fields are the same, and 0 otherwise.
  1089. X *
  1090. X *    ARGS:  vl1,vl2 - Virtual links to be compared
  1091. X * 
  1092. X * RETURNS:  1 if equal, 0 if not equal
  1093. X *
  1094. X */
  1095. int
  1096. vl_equal(vl1,vl2)
  1097. X    VLINK    vl1;
  1098. X    VLINK    vl2;
  1099. X    {
  1100. X      return strcmp(vl1->name, vl2->name) == 0         &&
  1101. X         vl1->linktype == vl2->linktype            &&
  1102. X         strcmp(vl1->type, vl2->type) == 0         &&
  1103. X         strcmp(vl1->hosttype, vl2->hosttype) == 0 &&
  1104. X         strcmp(vl1->host, vl2->host) == 0         &&
  1105. X         strcmp(vl1->nametype, vl2->nametype) == 0 &&
  1106. X         strcmp(vl1->filename, vl2->filename) == 0 &&
  1107. X         vl1->version == vl2->version              &&
  1108. X         vl1->f_magic_no == vl2->f_magic_no        ;
  1109. X
  1110. X    }
  1111. X
  1112. SHAR_EOF
  1113. chmod 0644 xarchie-2.0.6/vl_comp.c ||
  1114. echo 'restore of xarchie-2.0.6/vl_comp.c failed'
  1115. Wc_c="`wc -c < 'xarchie-2.0.6/vl_comp.c'`"
  1116. test 2137 -eq "$Wc_c" ||
  1117.     echo 'xarchie-2.0.6/vl_comp.c: original size 2137, current size' "$Wc_c"
  1118. rm -f _shar_wnt_.tmp
  1119. fi
  1120. # ============= xarchie-2.0.6/vlalloc.c ==============
  1121. if test -f 'xarchie-2.0.6/vlalloc.c' -a X"$1" != X"-c"; then
  1122.     echo 'x - skipping xarchie-2.0.6/vlalloc.c (File already exists)'
  1123.     rm -f _shar_wnt_.tmp
  1124. else
  1125. > _shar_wnt_.tmp
  1126. echo 'x - extracting xarchie-2.0.6/vlalloc.c (Text)'
  1127. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/vlalloc.c' &&
  1128. /*
  1129. X * Copyright (c) 1989, 1990, 1991 by the University of Washington
  1130. X *
  1131. X * For copying and distribution information, please see the file
  1132. X * <copyright.h>.
  1133. X *
  1134. X * v1.1.2 - gf  11/02/91 - renamed ZERO() to BZERO() for X
  1135. X */
  1136. X
  1137. #include <copyright.h>
  1138. #include <stdio.h>
  1139. X
  1140. #include <pfs.h>
  1141. #include "config.h"                /* gf */
  1142. #include "stringdefs.h"                /* gf */
  1143. X
  1144. static VLINK    lfree = NULL;
  1145. int        vlink_count = 0;
  1146. int        vlink_max = 0;
  1147. X
  1148. /*
  1149. X * vlalloc - allocate and initialize vlink structure
  1150. X *
  1151. X *    VLALLOC returns a pointer to an initialized structure of type
  1152. X *    VLINK.  If it is unable to allocate such a structure, it
  1153. X *    returns NULL.
  1154. X */
  1155. VLINK
  1156. vlalloc()
  1157. X    {
  1158. X    VLINK    vl;
  1159. X    if(lfree) {
  1160. X        vl = lfree;
  1161. X        lfree = lfree->next;
  1162. X    }
  1163. X    else {
  1164. X        vl = (VLINK) malloc(sizeof(VLINK_ST));
  1165. X        if (!vl) return(NULL);
  1166. X        vlink_max++;
  1167. X    }
  1168. X
  1169. X    vlink_count++;
  1170. X
  1171. X    /* Initialize and fill in default values */
  1172. X    /* Since all but four are set to a zero-value,
  1173. X       why not just wipe it clean?  */
  1174. X    BZERO(vl);
  1175. X
  1176. X    vl->linktype = 'L';
  1177. X    vl->type = stcopy("FILE");
  1178. X    vl->hosttype = stcopy("INTERNET-D");
  1179. X    vl->nametype = stcopy("ASCII");
  1180. X
  1181. X    return(vl);
  1182. X    }
  1183. X
  1184. /*
  1185. X * vlfree - free a VLINK structure
  1186. X *
  1187. X *    VLFREE takes a pointer to a VLINK structure and adds it to
  1188. X *    the free list for later reuse.
  1189. X */
  1190. void
  1191. vlfree(vl)
  1192. X    VLINK    vl;
  1193. X    {
  1194. X        extern int string_count;
  1195. X
  1196. X    if(vl->dontfree) return;
  1197. X    /* many of these don't need to call stfree(); since a check
  1198. X       for pointer validity's already done before even calling
  1199. X       it, we can just call free() here then do one big decrement
  1200. X       of string_count at the end.  */
  1201. X    if(vl->name) free(vl->name);
  1202. X    stfree(vl->type);
  1203. X    if(vl->replicas) vllfree(vl->replicas);
  1204. X    stfree(vl->hosttype);
  1205. X    if(vl->host) free(vl->host);
  1206. X    stfree(vl->nametype);
  1207. X    if(vl->filename) free(vl->filename);
  1208. X    if(vl->args) free(vl->args);
  1209. X    if(vl->lattrib) atlfree(vl->lattrib);
  1210. X    /* No allocation routines for f_info yet */
  1211. X    vl->f_info = NULL;
  1212. X    vl->next = lfree;
  1213. X    vl->previous = NULL;
  1214. X    lfree = vl;
  1215. X    vlink_count--;
  1216. X    string_count -= 4; /* freed name, host, filename, and args */
  1217. X    }
  1218. X
  1219. /*
  1220. X * vllfree - free a VLINK structure
  1221. X *
  1222. X *    VLLFREE takes a pointer to a VLINK structure frees it and any linked
  1223. X *    VLINK structures.  It is used to free an entrie list of VLINK
  1224. X *    structures.
  1225. X */
  1226. void
  1227. vllfree(vl)
  1228. X    VLINK    vl;
  1229. X    {
  1230. X    VLINK    nxt;
  1231. X
  1232. X    while((vl != NULL) && !vl->dontfree) {
  1233. X        nxt = vl->next;
  1234. X        vlfree(vl);
  1235. X        vl = nxt;
  1236. X    }
  1237. X    }
  1238. X
  1239. SHAR_EOF
  1240. chmod 0644 xarchie-2.0.6/vlalloc.c ||
  1241. echo 'restore of xarchie-2.0.6/vlalloc.c failed'
  1242. Wc_c="`wc -c < 'xarchie-2.0.6/vlalloc.c'`"
  1243. test 2430 -eq "$Wc_c" ||
  1244.     echo 'xarchie-2.0.6/vlalloc.c: original size 2430, current size' "$Wc_c"
  1245. rm -f _shar_wnt_.tmp
  1246. fi
  1247. # ============= xarchie-2.0.6/weight.c ==============
  1248. if test -f 'xarchie-2.0.6/weight.c' -a X"$1" != X"-c"; then
  1249.     echo 'x - skipping xarchie-2.0.6/weight.c (File already exists)'
  1250.     rm -f _shar_wnt_.tmp
  1251. else
  1252. > _shar_wnt_.tmp
  1253. echo 'x - extracting xarchie-2.0.6/weight.c (Text)'
  1254. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/weight.c' &&
  1255. /*
  1256. X * weight.c : Routines for ordering hosts by "weight"
  1257. X *
  1258. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1259. X * Based on a suggestion from Peter J Nilsson (pjn@ida.liu.se).
  1260. X * 13 May 1993: Add "org" to US weights and make sure others have proper
  1261. X *        US lists.
  1262. X *  7 Jun 1993: Added weights for Norway, from janl@ifi.uio.no.
  1263. X */
  1264. X
  1265. #include <stdio.h>
  1266. #include "sysdefs.h"
  1267. #include "stringdefs.h"
  1268. #include "xtypes.h"
  1269. #include "appres.h"
  1270. #include "weight.h"
  1271. #include "hostname.h"
  1272. #include "debug.h"
  1273. X
  1274. #define Number(arr) (sizeof(arr) / sizeof(arr[0]))
  1275. X
  1276. #define ISSPACE(C) ((C) == ' ' || (C) == '\t' || (C) == '\n')
  1277. #define ISDIGIT(C) ((C) >= '0' && (C) <= '9')
  1278. X
  1279. #define UNKNOWN_WEIGHT 99
  1280. X
  1281. /*
  1282. X * Functions defined here:
  1283. X */
  1284. void initHostWeights(),reinitHostWeights();
  1285. int hostWeight();
  1286. X
  1287. static int parseHostWeights();
  1288. X
  1289. /*
  1290. X * Data defined here:
  1291. X */
  1292. static HostWeightRec *hostWeightList;
  1293. static int hostWeightListLen;
  1294. X
  1295. /*
  1296. X * These weight lists are used if the hostWeights resource isn't given.
  1297. X * We attempt to determine a useful one by looking at the last component
  1298. X * of the hostname, if there is one.
  1299. X * The formatting is ugly so we don't have extra spaces on the Settings
  1300. X * panel.
  1301. X */
  1302. static struct _HostWeightDefault {
  1303. X    char *domain;
  1304. X    char *weights;
  1305. } defaults[] = {
  1306. X    /* North America, from gf (also used as default) */
  1307. X    { "us", "1   edu com net gov mil us org\n\
  1308. 2   ca\n\
  1309. 3   uk de nl fi fr eu.net\n\
  1310. 100 au nz jp" },
  1311. /* For Sweden, from Peter J Nilsson (pjn@ida.liu.se) */
  1312. X    { "se", "1   se\n\
  1313. 2   fi dk no\n\
  1314. 10  eu.net nl fr de\n\
  1315. 20  edu com gov net mil us org\n\
  1316. 100 au nz jp" },
  1317. /* For Norway, from gf (based on se) */
  1318. X    { "no", "1   no\n\
  1319. 2   fi dk se\n\
  1320. 10  eu.net nl fr de\n\
  1321. 20  edu com gov net mil us org\n\
  1322. 100 au nz jp" },
  1323. /* For Finland, from gf (based on se) */
  1324. X    { "fi", "1   si\n\
  1325. 2   se dk no\n\
  1326. 10  eu.net nl fr de\n\
  1327. 20  edu com gov net mil us org\n\
  1328. 100 au nz jp" },
  1329. /* For the UK, from gf */
  1330. X    { "uk", "1   uk\n\
  1331. 2   se fi dk no nl fr de eu.net\n\
  1332. 20  edu com gov net mil us org\n\
  1333. 100 au nz jp" },
  1334. /* For New Zealand, from Andy.Linton@comp.vuw.ac.nz */
  1335. X    { "nz", "1   nz\n\
  1336. 10  edu com gov net mil us org jp\n\
  1337. 20  se fi dk no nl fr de eu.net uk au" },
  1338. /* For Australia, from gf (based on nz) */
  1339. X    { "au", "1   au\n\
  1340. 10  edu com gov net mil us org jp\n\
  1341. 20  se fi dk no nl fr de eu.net uk nz" },
  1342. /* For Japan, from gf (a total guess) */
  1343. X    { "jp", "1   jp\n\
  1344. 10  edu com gov net mil us org\n\
  1345. 20  au nz\
  1346. 30  se fi dk no nl fr de eu.net uk" },
  1347. /* For Norway, from janl@ifi.uio.no */
  1348. X    { "no", "1   no\n\
  1349. 2   fi dk se\n\
  1350. 10  eu.net nl fr\n\
  1351. 20  edu com gov net de\n\
  1352. 100 au nz jp" },
  1353. };
  1354. X
  1355. X
  1356. /*    -    -    -    -    -    -    -    -    */
  1357. void
  1358. initHostWeights()
  1359. {
  1360. X    char *hostname,*dot;
  1361. X    int i,found;
  1362. X
  1363. X    if (appResources.hostWeights == NULL) {
  1364. X    found = 0;    /* default if none matches */
  1365. X    hostname = GetHostname();
  1366. X    if ((dot=rindex(hostname,'.')) != NULL) {
  1367. X        dot += 1;
  1368. X        for (i=0; i < Number(defaults); i++) {
  1369. X        if (strcasecmp(dot,defaults[i].domain) == 0) {
  1370. X            found = i;
  1371. X            break;
  1372. X        }
  1373. X        }
  1374. X    }
  1375. X    appResources.hostWeights = XtNewString(defaults[found].weights);
  1376. X    }
  1377. X    reinitHostWeights();
  1378. }
  1379. X
  1380. X
  1381. /*
  1382. X * This function is called whenever the weight list changes, eg, on
  1383. X * the Settings panel as well as at startup.
  1384. X */
  1385. X
  1386. void
  1387. reinitHostWeights()
  1388. {
  1389. X    /* Count how many entries there are */
  1390. X    hostWeightListLen = parseHostWeights(appResources.hostWeights,0);
  1391. X    /* Allocate the array to store them */
  1392. X    if (hostWeightList != NULL)
  1393. X    free((char*)hostWeightList);
  1394. X    hostWeightList = (HostWeightRec *)calloc(hostWeightListLen,
  1395. X                         sizeof(HostWeightRec));
  1396. X    /* Rescan and parse for real */
  1397. X    (void)parseHostWeights(appResources.hostWeights,1);
  1398. }
  1399. X
  1400. /*
  1401. X * Classes are of the form "[weight] host [host] [host] {,\n\0}"
  1402. X */
  1403. X
  1404. /* Each class of hosts is separated by this: */
  1405. #define ISCLASSSEP(C)    ((C) == ',' || (C) == '\n')
  1406. /* Within classes, each host is separated by this: */
  1407. #define ISHOSTSEP(C)    ISSPACE(C)
  1408. X
  1409. static int
  1410. parseHostWeights(s,saveit)
  1411. char *s;
  1412. int saveit;
  1413. {
  1414. X    char buf[256];
  1415. X    int i,n,weight;
  1416. X
  1417. X    n = 0;
  1418. X    weight = 0;
  1419. X    while (*s) {
  1420. X    /* Skip spaces and empty classes */
  1421. X    while (ISSPACE(*s) || ISCLASSSEP(*s))
  1422. X        s += 1;
  1423. X    /* Get the weight, if given */
  1424. X    i = 0;
  1425. X    while (ISDIGIT(*s))
  1426. X        buf[i++] = *s++;
  1427. X    buf[i] = '\0';
  1428. X    if (saveit && i > 0) {
  1429. X        weight = atoi(buf);
  1430. X    }
  1431. X    /* Get the hosts in the class */
  1432. X    while (*s && !ISCLASSSEP(*s)) {
  1433. X        /* Skip spaces, if any */
  1434. X        while (ISSPACE(*s) || ISHOSTSEP(*s))
  1435. X        s += 1;
  1436. X        /* Get the host string */
  1437. X        i = 0;
  1438. X        while (*s && !ISHOSTSEP(*s) && !ISCLASSSEP(*s))
  1439. X        buf[i++] = *s++;
  1440. X        buf[i] = '\0';
  1441. X        /* Save this host */
  1442. X        if (saveit && i > 0) {
  1443. X        XtFree(hostWeightList[n].name);
  1444. X        hostWeightList[n].name = XtMalloc(strlen(buf)+1);
  1445. X        strcpy(hostWeightList[n].name,buf);
  1446. X        hostWeightList[n].weight = weight;
  1447. X        DEBUG2("Set weight of \"%s\" = %d\n",buf,weight);
  1448. X        }
  1449. X        /* Keep track of how many */
  1450. X        n += 1;
  1451. X    }
  1452. X    }
  1453. X    /* Return total hosts */
  1454. X    return(n);
  1455. }
  1456. X
  1457. int
  1458. hostWeight(host)
  1459. char *host;
  1460. {
  1461. X    int i,offs,hostlen;
  1462. X
  1463. X    hostlen = strlen(host);
  1464. X    for (i=0; i < hostWeightListLen; i++) {
  1465. X    if ((offs=hostlen-strlen(hostWeightList[i].name)) < 0)
  1466. X        offs = 0;
  1467. X    if (!strcasecmp(host+offs,hostWeightList[i].name)) {
  1468. X        DEBUG3("Weight of \"%s\" (\"%s\") = %d\n",
  1469. X           host,host+offs,hostWeightList[i].weight);
  1470. X        return(hostWeightList[i].weight);
  1471. X    }
  1472. X    }
  1473. X    return(UNKNOWN_WEIGHT);
  1474. }
  1475. SHAR_EOF
  1476. chmod 0644 xarchie-2.0.6/weight.c ||
  1477. echo 'restore of xarchie-2.0.6/weight.c failed'
  1478. Wc_c="`wc -c < 'xarchie-2.0.6/weight.c'`"
  1479. test 5440 -eq "$Wc_c" ||
  1480.     echo 'xarchie-2.0.6/weight.c: original size 5440, current size' "$Wc_c"
  1481. rm -f _shar_wnt_.tmp
  1482. fi
  1483. # ============= xarchie-2.0.6/weight.h ==============
  1484. if test -f 'xarchie-2.0.6/weight.h' -a X"$1" != X"-c"; then
  1485.     echo 'x - skipping xarchie-2.0.6/weight.h (File already exists)'
  1486.     rm -f _shar_wnt_.tmp
  1487. else
  1488. > _shar_wnt_.tmp
  1489. echo 'x - extracting xarchie-2.0.6/weight.h (Text)'
  1490. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/weight.h' &&
  1491. /*
  1492. X * weight.h : Routines for ordering hosts by "weight"
  1493. X *
  1494. X * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  1495. X * Based on a suggestion from Peter J Nilsson (pjn@ida.liu.se).
  1496. X */
  1497. X
  1498. typedef struct _hostWeightRec {
  1499. X    char *name;
  1500. X    int weight;
  1501. } HostWeightRec;
  1502. X
  1503. extern void initHostWeights(),reinitHostWeights();
  1504. extern int hostWeight(/* char *host */);
  1505. SHAR_EOF
  1506. chmod 0644 xarchie-2.0.6/weight.h ||
  1507. echo 'restore of xarchie-2.0.6/weight.h failed'
  1508. Wc_c="`wc -c < 'xarchie-2.0.6/weight.h'`"
  1509. test 363 -eq "$Wc_c" ||
  1510.     echo 'xarchie-2.0.6/weight.h: original size 363, current size' "$Wc_c"
  1511. rm -f _shar_wnt_.tmp
  1512. fi
  1513. # ============= xarchie-2.0.6/xarchie.c ==============
  1514. if test -f 'xarchie-2.0.6/xarchie.c' -a X"$1" != X"-c"; then
  1515.     echo 'x - skipping xarchie-2.0.6/xarchie.c (File already exists)'
  1516.     rm -f _shar_wnt_.tmp
  1517. else
  1518. > _shar_wnt_.tmp
  1519. echo 'x - extracting xarchie-2.0.6/xarchie.c (Text)'
  1520. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/xarchie.c' &&
  1521. /*
  1522. X * xarchie : An X browser interface to Archie
  1523. X *
  1524. X * George Ferguson, ferguson@cs.rochester.edu, 2 Nov 1991.
  1525. X * Version 2.0: 23 Apr 1993.
  1526. X * 28 Apr 1993: Change default host to "archie.sura.net(1526)".
  1527. X * 13 May 1993: Apply icon resources to realToplevel.
  1528. X *        Don't call XtMapWidget() or -iconic is ignored.
  1529. X *        Apply tilde expansion to initial value of ftpLocalDir resource.
  1530. X */
  1531. X
  1532. #include <stdio.h>
  1533. #include <X11/Intrinsic.h>
  1534. #include <X11/StringDefs.h>
  1535. #include <X11/Shell.h>    
  1536. #include <X11/Xaw/Form.h>
  1537. #include <X11/Xaw/Label.h>
  1538. #include <X11/Xaw/Command.h>
  1539. #include <X11/Xaw/Paned.h>
  1540. #include <X11/Xaw/Viewport.h>
  1541. #include <X11/Xaw/AsciiText.h>
  1542. #include <X11/Xaw/MenuButton.h>
  1543. #include <X11/Xaw/SimpleMenu.h>
  1544. #include <X11/Xaw/Scrollbar.h>
  1545. #include <X11/Xaw/Cardinals.h>    
  1546. #include <X11/cursorfont.h>
  1547. #ifdef MULTILIST
  1548. #include <MultiList.h>
  1549. #else
  1550. #include <X11/Xaw/List.h>
  1551. #endif
  1552. #include "sysdefs.h"
  1553. #include "xarchie.h"
  1554. #include "types.h"
  1555. #include "appres.h"
  1556. #include "weight.h"
  1557. #include "db.h"
  1558. #include "actions.h"
  1559. #include "display.h"
  1560. #include "settings.h"
  1561. #include "menu.h"
  1562. #include "m-defs.h"
  1563. #include "status.h"
  1564. #include "browser.h"
  1565. #include "selection.h"
  1566. #include "file-panel.h"
  1567. #include "ftp-actions.h"
  1568. #include "about.h"
  1569. #ifdef HELP
  1570. # include "help.h"
  1571. #endif
  1572. #include "view-file.h"
  1573. #include "username.h"
  1574. #include "hostname.h"
  1575. #include "tilde.h"
  1576. #include "syntax.h"
  1577. #include "xarchie.xbm"
  1578. #include "busy.xbm"
  1579. X
  1580. /*    -    -    -    -    -    -    -    -    */
  1581. /*
  1582. X * Functions defined in this file:
  1583. X */
  1584. /* main() */
  1585. void bye();
  1586. void setBusyStatus(),setIconStatus();
  1587. X
  1588. static void initGraphics(),initColors(),initMenus(),initWidgets();
  1589. static void initErrorHandlers(), initMisc();
  1590. static void browserCallback();
  1591. static void setWindowBusyStatus();
  1592. static void iconifyEventHandler();
  1593. #ifdef DEBUG
  1594. static void xerror();
  1595. #endif
  1596. X
  1597. /*
  1598. X * Global graphics data
  1599. X */
  1600. Display *display;
  1601. Screen *screen;
  1602. Window root;
  1603. Atom WM_DELETE_WINDOW,WM_PROTOCOLS,WM_STATE;
  1604. X
  1605. /*
  1606. X * Local graphics data
  1607. X */
  1608. static Cursor busyCursor;
  1609. X
  1610. /*
  1611. X * Global widget data
  1612. X */
  1613. XXtAppContext appContext;
  1614. Widget toplevel,realToplevel;
  1615. Widget fileButton,settingsButton;
  1616. Widget queryButton,abortButton;
  1617. #ifdef HELP
  1618. Widget helpButton;
  1619. #endif
  1620. Widget statusText;
  1621. Widget browserForm;
  1622. Widget browserUpButton,browserDownButton;
  1623. Widget browserViewports[NUM_BROWSER_PANES];
  1624. Widget browserScrollbars[NUM_BROWSER_PANES];
  1625. Widget browserLists[NUM_BROWSER_PANES];
  1626. Widget searchText;
  1627. Widget hostText,locationText,fileText,sizeText,modesText,dateText;
  1628. X
  1629. /*
  1630. X * Other global data
  1631. X */
  1632. DbEntry *db;
  1633. char *program;
  1634. char *tmpDirectory;
  1635. X
  1636. /*
  1637. X * The application resources
  1638. X */
  1639. AppResources appResources;
  1640. X
  1641. /*
  1642. X * Non-widget resources obtained from resource manager
  1643. X */
  1644. static XtResource resources[] = {
  1645. X    { "searchType", "SearchType", GfRSearchType, sizeof(SearchType),
  1646. X      XtOffset(AppResources *,searchType), XtRImmediate, (XtPointer)GfExact },
  1647. X    { "sortType", "SortType", GfRSortType, sizeof(SortType),
  1648. X      XtOffset(AppResources *,sortType), XtRImmediate, (XtPointer)GfName },
  1649. X    { "archieHost", "ArchieHost", XtRString, sizeof(String),
  1650. X      XtOffset(AppResources *,archieHost), XtRImmediate, "archie.sura.net" },
  1651. X    { "numHosts", "numHosts", XtRInt, sizeof(int),
  1652. X      XtOffset(AppResources *,numHosts), XtRImmediate, (XtPointer)1 },
  1653. X    { "maxHits", "MaxHits", XtRInt, sizeof(int),
  1654. X      XtOffset(AppResources *,maxHits), XtRImmediate, (XtPointer)99 },
  1655. X    { "offset", "Offset", XtRInt, sizeof(int),
  1656. X      XtOffset(AppResources *,offset), XtRImmediate, (XtPointer)0 },
  1657. X    { "timeout", "Timeout", XtRInt, sizeof(int),
  1658. X      XtOffset(AppResources *,timeout), XtRImmediate, (XtPointer)0 },
  1659. X    { "retries", "Retries", XtRInt, sizeof(int),
  1660. X      XtOffset(AppResources *,retries), XtRImmediate, (XtPointer)0 },
  1661. X    { "niceLevel", "NiceLevel", XtRInt, sizeof(int),
  1662. X      XtOffset(AppResources *,niceLevel), XtRImmediate, (XtPointer)0 },
  1663. X    { "ftpLocalDir", "FtpLocalDir", XtRString, sizeof(String),
  1664. X      XtOffset(AppResources *,ftpLocalDir), XtRImmediate, "" },
  1665. X    { "ftpType", "FtpType", XtRString, sizeof(String),
  1666. X      XtOffset(AppResources *,ftpType), XtRImmediate, "binary" },
  1667. X    { "ftpPrompt", "FtpPrompt", XtRBoolean, sizeof(Boolean),
  1668. X      XtOffset(AppResources *,ftpPrompt), XtRImmediate, (XtPointer)False },
  1669. X    { "ftpTrace", "FtpTrace", XtRBoolean, sizeof(Boolean),
  1670. X      XtOffset(AppResources *,ftpTrace), XtRImmediate, (XtPointer)False },
  1671. X    { "ftpStrip", "FtpStrip", XtRBoolean, sizeof(Boolean),
  1672. X      XtOffset(AppResources *,ftpStrip), XtRImmediate, (XtPointer)True },
  1673. X    { "ftpMailAddress", "FtpMailAddress", XtRString, sizeof(String),
  1674. X      XtOffset(AppResources *,ftpMailAddress), XtRImmediate, "%s@%s" },
  1675. X    { "debugLevel", "DebugLevel", XtRInt, sizeof(int),
  1676. X      XtOffset(AppResources *,debugLevel), XtRImmediate, (XtPointer)0 },
  1677. X    { "fileWriteOnePerLine", "FileWriteOnePerLine", XtRBoolean,sizeof(Boolean),
  1678. X      XtOffset(AppResources *,fileWriteOnePerLine), XtRImmediate,
  1679. X                              (XtPointer)False },
  1680. X    { "xarchieFont", "Font", XtRFontStruct, sizeof(XFontStruct*),
  1681. X      XtOffset(AppResources *,xarchieFont), XtRString, XtDefaultFont },
  1682. X    { "xarchieBoldFont", "Font", XtRFontStruct, sizeof(XFontStruct*),
  1683. X      XtOffset(AppResources *,xarchieBoldFont), XtRString, XtDefaultFont },
  1684. X    { "hostWeights", "HostWeights", XtRString, sizeof(String),
  1685. X      XtOffset(AppResources *,hostWeights), XtRImmediate, NULL },
  1686. X    { "autoScroll", "AutoScroll", XtRBoolean, sizeof(Boolean),
  1687. X      XtOffset(AppResources *,autoScroll), XtRImmediate, (XtPointer)True },
  1688. X    { "pasteBuffer", "PasteBuffer", XtRBoolean, sizeof(Boolean),
  1689. X      XtOffset(AppResources *,pasteBuffer), XtRImmediate, (XtPointer)True },
  1690. X    { "visualType", "VisualType", XtRString, sizeof(String),
  1691. X      XtOffset(AppResources *,visualType), XtRImmediate, (XtPointer)"" },
  1692. X    { "defaultIcon", "Icon", XtRBitmap, sizeof(Pixmap),
  1693. X      XtOffset(AppResources *,defaultIcon), XtRImmediate, None },
  1694. X    { "busyIcon", "Icon", XtRBitmap, sizeof(Pixmap),
  1695. X      XtOffset(AppResources *,busyIcon), XtRImmediate, None },
  1696. };
  1697. X
  1698. /*
  1699. X * Non-widget resources set on command line.
  1700. X */
  1701. static XrmOptionDescRec options[] = {
  1702. X    { "-search",  ".searchType", XrmoptionSepArg, (XtPointer)"exact" },
  1703. X    { "-e",      ".searchType", XrmoptionNoArg,  (XtPointer)"exact" },
  1704. X    { "-s",      ".searchType", XrmoptionNoArg,  (XtPointer)"substr" },
  1705. X    { "-c",      ".searchType", XrmoptionNoArg,  (XtPointer)"subcase" },
  1706. X    { "-r",      ".searchType", XrmoptionNoArg,  (XtPointer)"regexp" },
  1707. X    { "-es",      ".searchType", XrmoptionNoArg,  (XtPointer)"exactSubstr" },
  1708. X    { "-ec",      ".searchType", XrmoptionNoArg,  (XtPointer)"exactSubcase" },
  1709. X    { "-er",      ".searchType", XrmoptionNoArg,  (XtPointer)"exactRegexp" },
  1710. X    { "-sort",      ".sortType",     XrmoptionSepArg, (XtPointer)"name" },
  1711. X    { "-t",      ".sortType",     XrmoptionNoArg,  (XtPointer)"date" },
  1712. X    { "-w",      ".sortType",     XrmoptionNoArg,  (XtPointer)"weight" },
  1713. X    { "-host",      ".archieHost", XrmoptionSepArg,
  1714. X                    (XtPointer)"archie.sura.ca" },
  1715. X    { "-maxhits", ".maxHits",     XrmoptionSepArg, (XtPointer)"99" },
  1716. X    { "-offset",  ".offset",     XrmoptionSepArg, (XtPointer)"0" },
  1717. X    { "-nice",      ".niceLevel",     XrmoptionSepArg, (XtPointer)"0" },
  1718. X    { "-N",      ".niceLevel",     XrmoptionSepArg, (XtPointer)"0" },
  1719. X    { "-debug",      ".debugLevel", XrmoptionSepArg, (XtPointer)"1" },
  1720. X    { "-D",      ".debugLevel", XrmoptionSepArg, (XtPointer)"1" },
  1721. X    { "-noscroll",".autoScroll", XrmoptionNoArg,  (XtPointer)"False" },
  1722. X    { "-mono",      ".visualType", XrmoptionNoArg,  (XtPointer)"mono" },
  1723. X    { "-gray",      ".visualType", XrmoptionNoArg,  (XtPointer)"gray" },
  1724. X    { "-color",      ".visualType", XrmoptionNoArg,  (XtPointer)"color" },
  1725. };
  1726. X
  1727. /*
  1728. X * Widget and non-widget resources if the application defaults
  1729. X * file can't be found.
  1730. X * Generated automatically from Xarchie.ad by "ad2c".
  1731. X * Comment out the include line (but not the NULL) if you don't want
  1732. X * any resources compiled in.
  1733. SHAR_EOF
  1734. true || echo 'restore of xarchie-2.0.6/xarchie.c failed'
  1735. fi
  1736. echo 'End of xarchie-2.0.6 part 16'
  1737. echo 'File xarchie-2.0.6/xarchie.c is continued in part 17'
  1738. echo 17 > _shar_seq_.tmp
  1739. exit 0
  1740.  
  1741. exit 0 # Just in case...
  1742. -- 
  1743.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  1744. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  1745.  "It's intuitively obvious to the |
  1746.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1747.