home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / tin / part15 < prev    next >
Encoding:
Text File  |  1992-07-07  |  24.3 KB  |  957 lines

  1. Newsgroups: comp.sources.misc
  2. From: iain%anl433.uucp@Germany.EU.net (Iain Lea)
  3. Subject:  v31i015:  tin - threaded full screen newsreader v1.1 PL4, Part15/15
  4. Message-ID: <1992Jul7.182259.8705@sparky.imd.sterling.com>
  5. X-Md4-Signature: 60acb3a9ce8e76665a7263ee803c6a6f
  6. Date: Tue, 7 Jul 1992 18:22:59 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: iain%anl433.uucp@Germany.EU.net (Iain Lea)
  10. Posting-number: Volume 31, Issue 15
  11. Archive-name: tin/part15
  12. Environment: BSD, SCO, ISC, SUNOS, SYSVR3, SYSVR4, ULTRIX, XENIX
  13. Supersedes: tin: Volume 30, Issue 1-14
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  FTP INSTALL.NNTP common.patch prompt.c screen.c wildmat.3
  22. #   xindex.c
  23. # Wrapped by kent@sparky on Mon Jun 29 23:35:16 1992
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 15 (of 15)."'
  27. if test -f 'FTP' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'FTP'\"
  29. else
  30.   echo shar: Extracting \"'FTP'\" \(2568 characters\)
  31.   sed "s/^X//" >'FTP' <<'END_OF_FILE'
  32. XThis document informs you how to get tin source & binaries in one of 3 ways.
  33. X
  34. X1) Via FTP.
  35. X2) Source code via mail.
  36. X3) Pre-compiled Binaries. 
  37. X
  38. X--------------------------------------------------------------------------------
  39. X
  40. X1) FTP sites that carry the latest version of tin are:
  41. X  
  42. X    ftp.Germany.EU.net  [192.76.144.129]  cd pub/news/tin
  43. X    src.doc.ic.ac.uk    [146.169.2.1]     cd ??
  44. X
  45. XNOTE1: Both sites are in Europe (Germany & England respectively).
  46. XNOTE2: There will be a small time lag before each of these sites makes
  47. X       the newest version available as I post firstly to alt.sources
  48. X
  49. X--------------------------------------------------------------------------------
  50. X
  51. X2) For people that do not have FTP access I am willing to send a copy of the 
  52. X   latest released version (or a beta version of the next patchlevel if so 
  53. X   desired).
  54. X
  55. X2.1) I can handle the following media formats. Specify:
  56. X    5.25 & 3.5 inch floppy disks.
  57. X    0.25 (1/4) inch cartridge tapes (you supply it).
  58. X    5.25 inch ISO Read/Write optical disks (you supply it).
  59. X
  60. X2.2) I can handle the following software formats. Specify:
  61. X    Unix   *.tar *.tar.Z *.tar.z *.tar.zoo
  62. X    Msdos  *.zoo *.zip formats 
  63. X
  64. X2.3) I make a small handling charge for this service as listed below:
  65. X    Germany  15 Deustche Marks
  66. X    England   5 Pounds Sterling
  67. X    USA      10 Dollars 
  68. X
  69. XIf you find the above points 2.1 - 2.3 OK send money/cheque with a self-addressed
  70. Xenvelope stating which media & software format you want to the following address:
  71. X
  72. X    Iain J. Lea
  73. X    BrueckenStr. 12
  74. X    8500 Nuernberg 90
  75. X    Germany.
  76. X
  77. X    Phone. +49-911-331963 (home) +49-911-3089-407 (work) +49-911-3089-290 (FAX)
  78. X    Email. iain%anl433.uucp@Germany.EU.net
  79. X
  80. X--------------------------------------------------------------------------------
  81. X
  82. X3) For people that are having problems compiling tin I am willing to send a 
  83. X   copy of a pre-compiled binary for the following machines:
  84. X
  85. X    i386/486 + SCO Xenix 2.3
  86. X    i386/486 + SCO Unix 3.2
  87. X    i386/486 + ISC Unix 3.2 v3.0
  88. X    SunSparc + SunOS 4.1
  89. X    SonyMIPS + NewsOS 4.1
  90. X    DecMIPS  + Ultrix 4.2
  91. X    DG Avion + DG/UX 4.3
  92. X    Apollo68xxx + DomainOS10.3
  93. X    Siemens MX330 + Sinix v5.23
  94. X    Siemens MX350i + Sinix v5.4
  95. X
  96. X    NOTE: Specify how you want tin to be compiled to access news:
  97. X          1) local spool directory (specify path for newsspool & newslib)
  98. X          2) local spool directory & via NNTP
  99. X          3) via NNTP only
  100. X          4) local spool directory & via news archived on CD-ROM
  101. X    
  102. XFor conditions & shipping read points 2.1 - 2.3 above. 
  103. X
  104. XEnjoy
  105. X    Iain.
  106. END_OF_FILE
  107.   if test 2568 -ne `wc -c <'FTP'`; then
  108.     echo shar: \"'FTP'\" unpacked with wrong size!
  109.   fi
  110.   # end of 'FTP'
  111. fi
  112. if test -f 'INSTALL.NNTP' -a "${1}" != "-c" ; then 
  113.   echo shar: Will not clobber existing file \"'INSTALL.NNTP'\"
  114. else
  115.   echo shar: Extracting \"'INSTALL.NNTP'\" \(3162 characters\)
  116.   sed "s/^X//" >'INSTALL.NNTP' <<'END_OF_FILE'
  117. XThis document explains the install procedure for the supplied patch to the
  118. XNNTP server nntpd & to the TIN newsreader to retrieve index files from the
  119. XNNTP server. 
  120. X
  121. XNNTP server
  122. X-----------
  123. X1) Copy the following files to <nntp-source-dir>/server
  124. X     cp xindex.c <nntp-source-dir>/server
  125. X     cp xuser.c <nntp-source-dir>/server
  126. X
  127. X2) Copy the following files to <nntp-source-dir>
  128. X     cp server.patch <nntp-source-dir>
  129. X     cp common.patch <nntp-source-dir>
  130. X
  131. X3) Patch the files in <nntp-source-dir>/common & <nntp-source-dir>/server
  132. X     cd <nntp-source-dir>
  133. X     patch < common.patch
  134. X     patch < server.patch
  135. X
  136. X4) Copy <nntp-source-dir>/common/conf.h.dist to <nntp-source-dir>/common/conf.h
  137. X     cd <nntp-source-dir>/common
  138. X     cp conf.h.dist conf.h
  139. X
  140. X5) Edit <nntp-source-dir>/common/conf.h to suit your sites needs. The XINDEX
  141. X   & XUSER are #defined by default. You may need to change the path for
  142. X   the #define SUBSCRIBTIONS. The default is /usr/lib/news/subscriptions.
  143. X     cd <nntp-source-dir>/common
  144. X     [vi|emacs] conf.h
  145. X
  146. X6) Recompile & install the NNTP server nntpd
  147. X     cd  <nntp-source-dir>
  148. X     make server
  149. X     make install_server
  150. X
  151. XTIN client
  152. X----------
  153. X1) Edit tin Makefile to enable XINDEX & XUSER functionality.
  154. X     cd <tin-dir>
  155. X     [vi|emacs] Makefile
  156. X     Add -DNNTP_XINDEX to CFLAGS if you want tin to retrieve index files 
  157. X     from the server.
  158. X     Add -DNNTP_XUSER to CFLAGS if you want tin to log the username to
  159. X     the NNTP logfile.
  160. X     Add -DNNTP_EXTS to CFLAGS if you want both NNTP_XINDEX & NNTP_XUSER
  161. X     enabled.
  162. X
  163. X2) Recompile & install tin.
  164. X     cd <tin-dir>
  165. X     make <system>
  166. X     make install
  167. X
  168. XTIN daemon (on NNTP server)
  169. X---------------------------
  170. X1) Edit tin Makefile to enable index daemon functionality.
  171. X     cd <tin-dir>
  172. X     [vi|emacs] Makefile
  173. X     Add -DINDEX_DAEMON to CFLAGS to create a version of tin 'tind' to
  174. X     create & update index files on the NNTP server.
  175. X
  176. X2) Compile & install tind.
  177. X     cd <tin-dir>
  178. X     make <system>
  179. X     make install_daemon
  180. X
  181. X3) Add entry to crontab to start 'tind' index daemon every so often.
  182. X     cd /usr/spool/cron/crontabs
  183. X     [vi|emacs] root
  184. X     Add following line to run tind every 30 minutes: 
  185. X       0,30 * * * * su news -c '/usr/lib/news/tind'
  186. X
  187. XOK. If you have gotten this far you will have the following configuration:
  188. X  o  tind will run every 30 minutes to update a central directory (usually
  189. X     /usr/spool/news/.index) of tin index files for all groups in the active
  190. X     file. The directory can be changed by 'tind -I dir' if so desired.
  191. X
  192. X  o  The NNTP server nntpd will service all requests for tin index files
  193. X     from tin clients. It will do this by returning the contents of the
  194. X     group index file in the index directory (ie. /usr/spool/news/.index/*)
  195. X
  196. X  o  The tin client will issue requests for index files to the NNTP server
  197. X     therefore saving space on the client machine and ensuring that there
  198. X     are only one copy of index files on the whole network.  Also clients
  199. X     will not have to wait while index files are built locally as the index
  200. X     daemon tind runs frequently on the news server.
  201. X             
  202. XEnjoy & happy newsreading
  203. X
  204. X  Iain
  205. END_OF_FILE
  206.   if test 3162 -ne `wc -c <'INSTALL.NNTP'`; then
  207.     echo shar: \"'INSTALL.NNTP'\" unpacked with wrong size!
  208.   fi
  209.   # end of 'INSTALL.NNTP'
  210. fi
  211. if test -f 'common.patch' -a "${1}" != "-c" ; then 
  212.   echo shar: Will not clobber existing file \"'common.patch'\"
  213. else
  214.   echo shar: Extracting \"'common.patch'\" \(2369 characters\)
  215.   sed "s/^X//" >'common.patch' <<'END_OF_FILE'
  216. XFiles common.old/Makefile and common/Makefile are identical
  217. XFiles common.old/README and common/README are identical
  218. XFiles common.old/README.HPUX and common/README.HPUX are identical
  219. XFiles common.old/README.IRIX and common/README.IRIX are identical
  220. XFiles common.old/README.LIB and common/README.LIB are identical
  221. XFiles common.old/README.MTXNIU and common/README.MTXNIU are identical
  222. XFiles common.old/README.SYSV and common/README.SYSV are identical
  223. XFiles common.old/README.XENIX and common/README.XENIX are identical
  224. XFiles common.old/clientlib.c and common/clientlib.c are identical
  225. XFiles common.old/clientlib.h and common/clientlib.h are identical
  226. XOnly in common: conf.h
  227. Xdiff -rcs common.old/conf.h.dist common/conf.h.dist
  228. X*** common.old/conf.h.dist    Wed May  6 09:01:11 1992
  229. X--- common/conf.h.dist    Mon May  4 07:31:14 1992
  230. X***************
  231. X*** 7,12 ****
  232. X--- 7,20 ----
  233. X   * Compile time options.
  234. X   */
  235. X    
  236. X+ /*
  237. X+  * Extensions to NNTP RFC977 (I.Lea 07-03-92)
  238. X+  */
  239. X+ 
  240. X+ #define XUSER            /* log clients username to nntp logfile */
  241. X+ #define XINDEX            /* retieve tin index files from server */
  242. X+ #define SUBSCRIPTIONS_FILE    "/usr/lib/news/subscriptions"
  243. X+ 
  244. X  
  245. X  #undef    ALONE        /* True if we're running without inetd */
  246. X  
  247. XOnly in common: conf.h.dst.old
  248. XOnly in common: conf.h.norisc
  249. Xdiff -rcs common.old/nntp.h common/nntp.h
  250. X*** common.old/nntp.h    Wed May  6 09:01:11 1992
  251. X--- common/nntp.h    Tue Mar 10 08:52:12 1992
  252. X***************
  253. X*** 38,43 ****
  254. X--- 38,46 ----
  255. X  #define    OK_GOODBYE    205    /* Closing connection */
  256. X  #define    OK_GROUP    211    /* Group selected */
  257. X  #define    OK_GROUPS    215    /* Newsgroups follow */
  258. X+ #ifdef XINDEX
  259. X+ #define    OK_XINDEX    218    /* Group index file follows */
  260. X+ #endif
  261. X  #define    OK_ARTICLE    220    /* Article (head & body) follows */
  262. X  #define    OK_HEAD        221    /* Head follows */
  263. X  #define    OK_BODY        222    /* Body follows */
  264. X***************
  265. X*** 57,62 ****
  266. X--- 60,68 ----
  267. X  #define    ERR_GOODBYE    400    /* Have to hang up for some reason */
  268. X  #define    ERR_NOGROUP    411    /* No such newsgroup */
  269. X  #define    ERR_NCING    412    /* Not currently in newsgroup */
  270. X+ #ifdef XINDEX
  271. X+ #define    ERR_XINDEX    418    /* No index file for newsgroup */
  272. X+ #endif
  273. X  #define    ERR_NOCRNT    420    /* No current article selected */
  274. X  #define    ERR_NONEXT    421    /* No next article in this group */
  275. X  #define    ERR_NOPREV    422    /* No previous article in this group */
  276. XFiles common.old/version.c and common/version.c are identical
  277. END_OF_FILE
  278.   if test 2369 -ne `wc -c <'common.patch'`; then
  279.     echo shar: \"'common.patch'\" unpacked with wrong size!
  280.   fi
  281.   # end of 'common.patch'
  282. fi
  283. if test -f 'prompt.c' -a "${1}" != "-c" ; then 
  284.   echo shar: Will not clobber existing file \"'prompt.c'\"
  285. else
  286.   echo shar: Extracting \"'prompt.c'\" \(3150 characters\)
  287.   sed "s/^X//" >'prompt.c' <<'END_OF_FILE'
  288. X/*
  289. X *  Project   : tin - a threaded Netnews reader
  290. X *  Module    : prompt.c
  291. X *  Author    : I.Lea
  292. X *  Created   : 01-04-91
  293. X *  Updated   : 03-06-92
  294. X *  Notes     :
  295. X *  Copyright : (c) Copyright 1991-92 by Iain Lea
  296. X *              You may  freely  copy or  redistribute  this software,
  297. X *              so  long as there is no profit made from its use, sale
  298. X *              trade or  reproduction.  You may not change this copy-
  299. X *              right notice, and it must be included in any copy made
  300. X */
  301. X
  302. X#include    "tin.h"
  303. X
  304. X/*
  305. X *  prompt_num
  306. X *  get a number from the user
  307. X *  Return -1 if missing or bad number typed
  308. X */
  309. X
  310. Xint prompt_num (ch, prompt)
  311. X    int ch;
  312. X    char *prompt;
  313. X{
  314. X    char *p;
  315. X    int num;
  316. X
  317. X    set_alarm_clock_off ();
  318. X    
  319. X    clear_message ();
  320. X
  321. X    sprintf (msg, "%c", ch);
  322. X
  323. X    if ((p = getline (prompt, TRUE, msg)) != (char *) 0) {
  324. X        strcpy (msg, p);
  325. X        num = atoi (msg);
  326. X    } else {
  327. X        num = -1;
  328. X    }
  329. X
  330. X    clear_message ();
  331. X
  332. X    set_alarm_clock_on ();
  333. X        
  334. X    return (num);
  335. X}
  336. X
  337. X/*
  338. X *  prompt_string
  339. X *  get a string from the user
  340. X *  Return TRUE if a valid string was typed, FALSE otherwise
  341. X */
  342. X
  343. Xint prompt_string (prompt, buf)
  344. X    char *prompt;
  345. X    char *buf;
  346. X{
  347. X    char *p;
  348. X
  349. X    set_alarm_clock_off ();
  350. X    
  351. X    clear_message ();
  352. X
  353. X    if ((p = getline (prompt, FALSE, (char *) 0)) == (char *) 0) {
  354. X        buf[0] = '\0';
  355. X        clear_message ();
  356. X        set_alarm_clock_on ();
  357. X        return FALSE;
  358. X    }
  359. X    strcpy (buf, p);
  360. X    
  361. X    clear_message ();
  362. X    set_alarm_clock_on ();
  363. X    
  364. X    return TRUE;
  365. X}
  366. X
  367. X/*
  368. X *  prompt_menu_string
  369. X *  get a string from the user
  370. X *  Return TRUE if a valid string was typed, FALSE otherwise
  371. X */
  372. X
  373. Xint prompt_menu_string (line, col, var)
  374. X    int line;
  375. X    int col;
  376. X    char *var;
  377. X{
  378. X    char *p;
  379. X
  380. X    set_alarm_clock_off ();
  381. X
  382. X    MoveCursor (line, col);
  383. X
  384. X    if ((p = getline ("", FALSE, var)) == (char *) 0) {
  385. X        set_alarm_clock_on ();
  386. X        return FALSE;
  387. X    }
  388. X    strcpy (var, p);
  389. X
  390. X    set_alarm_clock_on ();
  391. X    
  392. X    return TRUE;
  393. X}
  394. X
  395. X
  396. Xint prompt_yn (line, prompt, prompt_ch)
  397. X    int line;
  398. X    char *prompt;
  399. X    int prompt_ch;
  400. X{
  401. X    char ch;
  402. X
  403. X    set_alarm_clock_off ();
  404. X
  405. X    MoveCursor (line, 0);
  406. X    CleartoEOLN ();
  407. X    printf ("%s%c", prompt, prompt_ch);
  408. X    fflush (stdout);
  409. X    MoveCursor (line, (int) strlen (prompt));
  410. X
  411. X    if ((ch = (char) ReadCh()) == CR) {
  412. X        ch = prompt_ch;
  413. X    }    
  414. X
  415. X    if (line == LINES) {
  416. X        clear_message();
  417. X    } else {
  418. X        MoveCursor (line, (int) strlen (prompt));
  419. X        if (ch == ESC) {
  420. X            fputc (prompt_ch, stdout);
  421. X        } else {
  422. X            fputc (ch, stdout);
  423. X        }
  424. X        fflush (stdout);
  425. X    }
  426. X
  427. X    set_alarm_clock_on ();
  428. X
  429. X    return (ch == 'y' ? TRUE : FALSE);
  430. X}
  431. X
  432. X
  433. Xvoid prompt_on_off (row, col, var, help_text, prompt_text)
  434. X    int row;
  435. X    int col;
  436. X    int *var;
  437. X    char *help_text;
  438. X    char *prompt_text;
  439. X{
  440. X    int ch, var_orig;
  441. X
  442. X    set_alarm_clock_off ();
  443. X
  444. X    var_orig = *var;
  445. X
  446. X    show_menu_help (help_text);
  447. X    do {
  448. X        MoveCursor (row, col + (int) strlen (prompt_text));
  449. X        if ((ch = (char) ReadCh ()) == ' ') {
  450. X            *var = !*var;
  451. X            printf ("%s", (*var ? "ON " : "OFF"));
  452. X            fflush (stdout);
  453. X        }
  454. X    } while (ch != CR && ch != ESC);
  455. X
  456. X    if (ch == ESC) {
  457. X        *var = var_orig;
  458. X        printf ("%s", (*var ? "ON " : "OFF"));
  459. X        fflush (stdout);
  460. X    }
  461. X    
  462. X    set_alarm_clock_on ();
  463. X}
  464. X
  465. X
  466. Xvoid continue_prompt ()
  467. X{
  468. X    char ch;
  469. X
  470. X    set_alarm_clock_off ();
  471. X    
  472. X    info_message (txt_hit_any_key);
  473. X    ch = (char) ReadCh ();
  474. X
  475. X    set_alarm_clock_on ();
  476. X}
  477. END_OF_FILE
  478.   if test 3150 -ne `wc -c <'prompt.c'`; then
  479.     echo shar: \"'prompt.c'\" unpacked with wrong size!
  480.   fi
  481.   # end of 'prompt.c'
  482. fi
  483. if test -f 'screen.c' -a "${1}" != "-c" ; then 
  484.   echo shar: Will not clobber existing file \"'screen.c'\"
  485. else
  486.   echo shar: Extracting \"'screen.c'\" \(2916 characters\)
  487.   sed "s/^X//" >'screen.c' <<'END_OF_FILE'
  488. X/*
  489. X *  Project   : tin - a threaded Netnews reader
  490. X *  Module    : screen.c
  491. X *  Author    : I.Lea & R.Skrenta
  492. X *  Created   : 01-04-91
  493. X *  Updated   : 18-04-92
  494. X *  Notes     :
  495. X *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  496. X *              You may  freely  copy or  redistribute  this software,
  497. X *              so  long as there is no profit made from its use, sale
  498. X *              trade or  reproduction.  You may not change this copy-
  499. X *              right notice, and it must be included in any copy made
  500. X */
  501. X
  502. X#include    "tin.h"
  503. X
  504. Xextern int errno;
  505. X
  506. Xchar msg[LEN];
  507. Xstruct screen_t *screen;
  508. X
  509. X
  510. Xvoid info_message (str)
  511. X    char *str;
  512. X{
  513. X    clear_message ();                /* Clear any old messages hanging around */
  514. X    center_line (LINES, FALSE, str);    /* center the message at screen bottom */
  515. X    if (! cmd_line) {
  516. X        MoveCursor (LINES, 0);
  517. X    }
  518. X}
  519. X
  520. X
  521. Xvoid wait_message (str)
  522. X    char *str;
  523. X{
  524. X    clear_message ();      /* Clear any old messages hanging around */
  525. X    fputs (str, stdout);
  526. X    fflush (stdout);
  527. X}
  528. X
  529. X
  530. Xvoid error_message (template, str)
  531. X    char *template;
  532. X    char *str;
  533. X{
  534. X    errno = 0;
  535. X
  536. X    clear_message ();      /* Clear any old messages hanging around */
  537. X    
  538. X    fprintf (stderr, template, str);
  539. X    fflush (stderr);
  540. X
  541. X    if (cmd_line) {
  542. X        fputc ('\n', stderr);
  543. X        fflush (stderr);
  544. X    } else {
  545. X        MoveCursor (LINES, 0);
  546. X        sleep (2);
  547. X    }
  548. X}
  549. X
  550. X
  551. Xvoid perror_message (template, str)
  552. X    char *template;
  553. X    char *str;
  554. X{
  555. X    char str2[512];
  556. X
  557. X    clear_message ();      /* Clear any old messages hanging around */
  558. X    
  559. X    sprintf (str2, template, str);
  560. X    perror (str2);
  561. X    errno = 0;
  562. X
  563. X    if (cmd_line) {
  564. X        fputc ('\n', stderr);
  565. X        fflush (stderr);
  566. X    } else {
  567. X        MoveCursor (LINES, 0);
  568. X        sleep (2);
  569. X    }
  570. X}
  571. X
  572. X
  573. Xvoid clear_message ()
  574. X{
  575. X    if (! cmd_line) {
  576. X        MoveCursor (LINES, 0);
  577. X        CleartoEOLN ();
  578. X    }
  579. X}
  580. X
  581. X
  582. Xvoid center_line (line, inverse, str)
  583. X    int line;
  584. X    int inverse;
  585. X    char *str;
  586. X{
  587. X    int pos;
  588. X
  589. X    if (! cmd_line) {
  590. X        pos = (COLS - (int) strlen (str)) / 2;
  591. X        MoveCursor (line, pos);
  592. X        if (inverse) {
  593. X            StartInverse ();
  594. X        }
  595. X    }
  596. X
  597. X    fputs (str, stdout);
  598. X    fflush (stdout);
  599. X
  600. X    if (! cmd_line) {
  601. X        if (inverse) {
  602. X            EndInverse ();
  603. X        }
  604. X    }
  605. X}
  606. X
  607. X
  608. Xvoid draw_arrow (line)
  609. X    int line;
  610. X{
  611. X    MoveCursor (line, 0);
  612. X
  613. X    if (draw_arrow_mark) {
  614. X        fputs ("->", stdout);
  615. X        fflush (stdout);
  616. X    } else {
  617. X        StartInverse ();
  618. X        fputs (screen[line-INDEX_TOP].col, stdout);
  619. X        fflush (stdout);
  620. X        EndInverse ();
  621. X    }
  622. X    MoveCursor (LINES, 0);
  623. X}
  624. X
  625. X
  626. Xvoid erase_arrow (line)
  627. X    int line;
  628. X{
  629. X    MoveCursor (line, 0);
  630. X
  631. X    if (draw_arrow_mark) {
  632. X        fputs ("  ", stdout);
  633. X    } else {
  634. X        EndInverse ();
  635. X        fputs (screen[line-INDEX_TOP].col, stdout);
  636. X    }
  637. X    fflush (stdout);
  638. X}
  639. X
  640. X
  641. Xvoid show_title (title)
  642. X    char *title;
  643. X{    
  644. X    int col;
  645. X    
  646. X    col = (COLS - (int) strlen (txt_type_h_for_help))+1;
  647. X    if (col) {
  648. X        MoveCursor (0, col);
  649. X        if (mail_check ()) {        /* you have mail message in */
  650. X            fputs (txt_you_have_mail, stdout);
  651. X        } else {
  652. X            fputs (txt_type_h_for_help, stdout);
  653. X        }
  654. X    }
  655. X    center_line (0, TRUE, title);
  656. X}
  657. X
  658. X
  659. Xvoid ring_bell ()
  660. X{
  661. X    fputc ('\007', stdout);
  662. X    fflush (stdout);
  663. X}
  664. END_OF_FILE
  665.   if test 2916 -ne `wc -c <'screen.c'`; then
  666.     echo shar: \"'screen.c'\" unpacked with wrong size!
  667.   fi
  668.   # end of 'screen.c'
  669. fi
  670. if test -f 'wildmat.3' -a "${1}" != "-c" ; then 
  671.   echo shar: Will not clobber existing file \"'wildmat.3'\"
  672. else
  673.   echo shar: Extracting \"'wildmat.3'\" \(2247 characters\)
  674.   sed "s/^X//" >'wildmat.3' <<'END_OF_FILE'
  675. X.TH WILDMAT 3
  676. X.SH NAME
  677. Xwildmat \- perform shell-style wildcard matching
  678. X.SH SYNOPSIS
  679. X.nf
  680. X.B "int"
  681. X.B "wildmat(text, pattern)"
  682. X.B "    char        *text;"
  683. X.B "    char        *pattern;"
  684. X.fi
  685. X.SH DESCRIPTION
  686. X.I Wildmat
  687. Xcompares the
  688. X.I text
  689. Xagainst the
  690. X.I pattern
  691. Xand
  692. Xreturns non-zero if the pattern matches the text.
  693. XThe pattern is interpreted similar to shell filename wildcards, and not
  694. Xas a full regular expression such as those handled by the
  695. X.IR grep (1)
  696. Xfamily of programs or the
  697. X.IR regex (3)
  698. Xor
  699. X.IR regexp (3)
  700. Xset of routines.
  701. X.PP
  702. XThe pattern is interpreted according to the following rules:
  703. X.TP
  704. X.BI \e x
  705. XTurns off the special meaning of
  706. X.I x
  707. Xand matches it directly; this is used mostly before a question mark or
  708. Xasterisk, and is not valid inside square brackets.
  709. X.TP
  710. X.B ?
  711. XMatches any single character.
  712. X.TP
  713. X.B *
  714. XMatches any sequence of zero or more characters.
  715. X.TP
  716. X.BI [ x...y ]
  717. XMatches any single character specified by the set
  718. X.IR x...y .
  719. XA minus sign may be used to indicate a range of characters.
  720. XThat is,
  721. X.I [0\-5abc]
  722. Xis a shorthand for
  723. X.IR [012345abc] .
  724. XMore than one range may appear inside a character set;
  725. X.I [0-9a-zA-Z._]
  726. Xmatches almost all of the legal characters for a host name.
  727. XThe close bracket,
  728. X.IR ] ,
  729. Xmay be used if it is the first character in the set.
  730. XThe minus sign,
  731. X.IR \- ,
  732. Xmay be used if it is either the first or last character in the set.
  733. X.TP
  734. X.BI [^ x...y ]
  735. XThis matches any character
  736. X.I not
  737. Xin the set
  738. X.IR x...y ,
  739. Xwhich is interpreted as described above.
  740. XFor example,
  741. X.I [^]\-]
  742. Xmatches any character other than a close bracket or minus sign.
  743. X.SH "BUGS AND LIMITATIONS"
  744. XThere is no way to end a range with a close bracket.
  745. X.SH HISTORY
  746. XWritten by Rich $alz <rsalz@bbn.com> in 1986, and posted to Usenet
  747. Xseveral times since then, most notably in comp.sources.misc in
  748. XMarch, 1991.
  749. X.PP
  750. XLars Mathiesen <thorinn@diku.dk> enhanced the multi-asterisk failure
  751. Xmode in early 1991.
  752. X.PP
  753. XRich and Lars increased the efficiency of star patterns and reposted it
  754. Xto comp.sources.misc in April, 1991.
  755. X.PP
  756. XRobert Elz <kre@munnari.oz.au> added minus sign and close bracket handling
  757. Xin June, 1991.
  758. X.PP
  759. X.de R$
  760. XThis is revision \\$3, dated \\$4.
  761. X..
  762. X.R$ $Id: wildmat.3,v 1.7 91/07/05 17:50:16 rsalz Exp $
  763. X.SH "SEE ALSO"
  764. Xgrep(1), regex(3), regexp(3).
  765. END_OF_FILE
  766.   if test 2247 -ne `wc -c <'wildmat.3'`; then
  767.     echo shar: \"'wildmat.3'\" unpacked with wrong size!
  768.   fi
  769.   # end of 'wildmat.3'
  770. fi
  771. if test -f 'xindex.c' -a "${1}" != "-c" ; then 
  772.   echo shar: Will not clobber existing file \"'xindex.c'\"
  773. else
  774.   echo shar: Extracting \"'xindex.c'\" \(3476 characters\)
  775.   sed "s/^X//" >'xindex.c' <<'END_OF_FILE'
  776. X/*
  777. X *  Project   : NNTP (RFC 977) extension
  778. X *  Module    : xindex.c
  779. X *  Author    : I.Lea
  780. X *  Created   : 07-03-92
  781. X *  Updated   : 22-03-92
  782. X *  Notes     : Add a command to retieve index files from the
  783. X *              NNTP server so as to save space on the client.
  784. X *              Ideas borrowed from XTHREAD nntp extension code
  785. X *              posted by Tim Iverson to alt.sources in mid'91.
  786. X *  Copyright : (c) Copyright 1992 by Iain Lea
  787. X *              You may  freely  copy or  redistribute  this software,
  788. X *              so  long as there is no profit made from its use, sale
  789. X *              trade or  reproduction.  You may not change this copy-
  790. X *              right notice, and it must be included in any copy made
  791. X */
  792. X
  793. X#include "common.h"
  794. X
  795. X#ifdef XINDEX
  796. X
  797. X#undef    DEBUG_XINDEX        /* set to define to turn on more debug info */
  798. X#define HASH_VALUE 1409        /* mod value for hashing group name */
  799. X
  800. X#ifdef __STDC__
  801. Xvoid xindex (int argc, char *argv[]);
  802. Xstatic void find_index_file (char *group, char *index_file);
  803. Xstatic long hash_groupname (char *group);
  804. X#else
  805. Xvoid xindex ();
  806. Xstatic void find_index_file ();
  807. Xstatic long hash_groupname ();
  808. X#endif
  809. X
  810. X/*
  811. X *  Usage: XINDEX GROUP
  812. X *
  813. X *  GROUP    Group for which to retrieve index file
  814. X *
  815. X *  This command is NOT documented in RFC977.
  816. X */
  817. X
  818. Xvoid xindex (argc, argv)
  819. X    int    argc;
  820. X    char    *argv[];
  821. X{
  822. X    char    line[NNTP_STRLEN];
  823. X    char    group[256];
  824. X    char    index_file[256];
  825. X    char    *cp;
  826. X    FILE    *fp;
  827. X    
  828. X    /*
  829. X     * "parse" the argument list
  830. X     */
  831. X    if (argc == 1) {
  832. X        printf("%d Usage: XINDEX group\r\n", ERR_CMDSYN);
  833. X        (void) fflush(stdout);
  834. X        return;
  835. X    } else {
  836. X        strncpy (group, argv[1], sizeof (group)-1);
  837. X#if defined(SYSLOG) && defined(DEBUG_XINDEX)
  838. X        syslog(LOG_INFO, "%s xindex %s", hostname, group);
  839. X#endif
  840. X
  841. X        find_index_file(group, index_file);
  842. X        
  843. X        if ((fp = fopen(index_file, "r")) == NULL) {
  844. X#ifdef SYSLOG
  845. X            syslog(LOG_INFO, "%s xindex cannot open %s (%s)",
  846. X                hostname, group, index_file);
  847. X#endif
  848. X            printf("%d XINDEX Cannot open %s\r\n",
  849. X                ERR_XINDEX, group);
  850. X            (void) fflush(stdout);
  851. X            return;
  852. X        }
  853. X
  854. X        printf("%d XINDEX group in index format\r\n", OK_XINDEX);
  855. X        (void) fflush(stdout);
  856. X        
  857. X        while (fgets(line, sizeof(line), fp) != NULL) {
  858. X            if ((cp = index(line, '\n')) != NULL)
  859. X                *cp = '\0';
  860. X            putline(line);
  861. X        }
  862. X        (void) fclose(fp);
  863. X    
  864. X        putline(".");
  865. X        (void) fflush(stdout);
  866. X    }
  867. X}
  868. X
  869. X/*
  870. X *  Look in <SPOOLDIR>/.index directory for the index file for the
  871. X *  given group.  Hashing the group name gets a number. See if that
  872. X *  #.1 file exists; if so, read first line. Group we want? If not,
  873. X *  try #.2.  Repeat until no such file or we find the right file.
  874. X */
  875. X
  876. Xstatic void find_index_file (group, index_file)
  877. X    char *group;
  878. X    char *index_file;
  879. X{
  880. X    char buf[256], *p;
  881. X    FILE *fp;
  882. X    int i = 1;
  883. X    unsigned long hash;
  884. X
  885. X    hash = hash_groupname (group);
  886. X
  887. X    while (1) {
  888. X        sprintf (index_file, "%s/.index/%lu.%d", SPOOLDIR, hash, i);
  889. X        
  890. X        if ((fp = fopen (index_file, "r")) == NULL) {
  891. X            return;
  892. X        }
  893. X
  894. X        if (fgets (buf, sizeof (buf), fp) == NULL) {
  895. X            fclose (fp);
  896. X            return;
  897. X        }
  898. X        fclose (fp);
  899. X
  900. X        for (p = buf; *p && *p != '\n'; p++) {
  901. X            continue;
  902. X        }    
  903. X        *p = '\0';
  904. X
  905. X        if (strcmp (buf, group) == 0) {
  906. X            return;
  907. X        }    
  908. X        i++;
  909. X    }    
  910. X}
  911. X
  912. X/*
  913. X * hash group name for filename of group
  914. X */
  915. X
  916. Xstatic long hash_groupname (group)
  917. X    char *group;
  918. X{
  919. X    unsigned long hash_value;
  920. X    unsigned char *ptr = (unsigned char *) group;
  921. X
  922. X    hash_value = *ptr++;
  923. X
  924. X    while (*ptr)
  925. X        hash_value = ((hash_value << 1) ^ *ptr++) % HASH_VALUE;
  926. X
  927. X    return (hash_value);
  928. X}
  929. X
  930. X
  931. X#endif /* XINDEX */
  932. X
  933. END_OF_FILE
  934.   if test 3476 -ne `wc -c <'xindex.c'`; then
  935.     echo shar: \"'xindex.c'\" unpacked with wrong size!
  936.   fi
  937.   # end of 'xindex.c'
  938. fi
  939. echo shar: End of archive 15 \(of 15\).
  940. cp /dev/null ark15isdone
  941. MISSING=""
  942. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  943.     if test ! -f ark${I}isdone ; then
  944.     MISSING="${MISSING} ${I}"
  945.     fi
  946. done
  947. if test "${MISSING}" = "" ; then
  948.     echo You have unpacked all 15 archives.
  949.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  950. else
  951.     echo You still must unpack the following archives:
  952.     echo "        " ${MISSING}
  953. fi
  954. exit 0
  955. exit 0 # Just in case...
  956.