home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: iain%anl433.uucp@Germany.EU.net (Iain Lea)
- Subject: v31i015: tin - threaded full screen newsreader v1.1 PL4, Part15/15
- Message-ID: <1992Jul7.182259.8705@sparky.imd.sterling.com>
- X-Md4-Signature: 60acb3a9ce8e76665a7263ee803c6a6f
- Date: Tue, 7 Jul 1992 18:22:59 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: iain%anl433.uucp@Germany.EU.net (Iain Lea)
- Posting-number: Volume 31, Issue 15
- Archive-name: tin/part15
- Environment: BSD, SCO, ISC, SUNOS, SYSVR3, SYSVR4, ULTRIX, XENIX
- Supersedes: tin: Volume 30, Issue 1-14
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: FTP INSTALL.NNTP common.patch prompt.c screen.c wildmat.3
- # xindex.c
- # Wrapped by kent@sparky on Mon Jun 29 23:35:16 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 15 (of 15)."'
- if test -f 'FTP' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'FTP'\"
- else
- echo shar: Extracting \"'FTP'\" \(2568 characters\)
- sed "s/^X//" >'FTP' <<'END_OF_FILE'
- XThis document informs you how to get tin source & binaries in one of 3 ways.
- X
- X1) Via FTP.
- X2) Source code via mail.
- X3) Pre-compiled Binaries.
- X
- X--------------------------------------------------------------------------------
- X
- X1) FTP sites that carry the latest version of tin are:
- X
- X ftp.Germany.EU.net [192.76.144.129] cd pub/news/tin
- X src.doc.ic.ac.uk [146.169.2.1] cd ??
- X
- XNOTE1: Both sites are in Europe (Germany & England respectively).
- XNOTE2: There will be a small time lag before each of these sites makes
- X the newest version available as I post firstly to alt.sources
- X
- X--------------------------------------------------------------------------------
- X
- X2) For people that do not have FTP access I am willing to send a copy of the
- X latest released version (or a beta version of the next patchlevel if so
- X desired).
- X
- X2.1) I can handle the following media formats. Specify:
- X 5.25 & 3.5 inch floppy disks.
- X 0.25 (1/4) inch cartridge tapes (you supply it).
- X 5.25 inch ISO Read/Write optical disks (you supply it).
- X
- X2.2) I can handle the following software formats. Specify:
- X Unix *.tar *.tar.Z *.tar.z *.tar.zoo
- X Msdos *.zoo *.zip formats
- X
- X2.3) I make a small handling charge for this service as listed below:
- X Germany 15 Deustche Marks
- X England 5 Pounds Sterling
- X USA 10 Dollars
- X
- XIf you find the above points 2.1 - 2.3 OK send money/cheque with a self-addressed
- Xenvelope stating which media & software format you want to the following address:
- X
- X Iain J. Lea
- X BrueckenStr. 12
- X 8500 Nuernberg 90
- X Germany.
- X
- X Phone. +49-911-331963 (home) +49-911-3089-407 (work) +49-911-3089-290 (FAX)
- X Email. iain%anl433.uucp@Germany.EU.net
- X
- X--------------------------------------------------------------------------------
- X
- X3) For people that are having problems compiling tin I am willing to send a
- X copy of a pre-compiled binary for the following machines:
- X
- X i386/486 + SCO Xenix 2.3
- X i386/486 + SCO Unix 3.2
- X i386/486 + ISC Unix 3.2 v3.0
- X SunSparc + SunOS 4.1
- X SonyMIPS + NewsOS 4.1
- X DecMIPS + Ultrix 4.2
- X DG Avion + DG/UX 4.3
- X Apollo68xxx + DomainOS10.3
- X Siemens MX330 + Sinix v5.23
- X Siemens MX350i + Sinix v5.4
- X
- X NOTE: Specify how you want tin to be compiled to access news:
- X 1) local spool directory (specify path for newsspool & newslib)
- X 2) local spool directory & via NNTP
- X 3) via NNTP only
- X 4) local spool directory & via news archived on CD-ROM
- X
- XFor conditions & shipping read points 2.1 - 2.3 above.
- X
- XEnjoy
- X Iain.
- END_OF_FILE
- if test 2568 -ne `wc -c <'FTP'`; then
- echo shar: \"'FTP'\" unpacked with wrong size!
- fi
- # end of 'FTP'
- fi
- if test -f 'INSTALL.NNTP' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'INSTALL.NNTP'\"
- else
- echo shar: Extracting \"'INSTALL.NNTP'\" \(3162 characters\)
- sed "s/^X//" >'INSTALL.NNTP' <<'END_OF_FILE'
- XThis document explains the install procedure for the supplied patch to the
- XNNTP server nntpd & to the TIN newsreader to retrieve index files from the
- XNNTP server.
- X
- XNNTP server
- X-----------
- X1) Copy the following files to <nntp-source-dir>/server
- X cp xindex.c <nntp-source-dir>/server
- X cp xuser.c <nntp-source-dir>/server
- X
- X2) Copy the following files to <nntp-source-dir>
- X cp server.patch <nntp-source-dir>
- X cp common.patch <nntp-source-dir>
- X
- X3) Patch the files in <nntp-source-dir>/common & <nntp-source-dir>/server
- X cd <nntp-source-dir>
- X patch < common.patch
- X patch < server.patch
- X
- X4) Copy <nntp-source-dir>/common/conf.h.dist to <nntp-source-dir>/common/conf.h
- X cd <nntp-source-dir>/common
- X cp conf.h.dist conf.h
- X
- X5) Edit <nntp-source-dir>/common/conf.h to suit your sites needs. The XINDEX
- X & XUSER are #defined by default. You may need to change the path for
- X the #define SUBSCRIBTIONS. The default is /usr/lib/news/subscriptions.
- X cd <nntp-source-dir>/common
- X [vi|emacs] conf.h
- X
- X6) Recompile & install the NNTP server nntpd
- X cd <nntp-source-dir>
- X make server
- X make install_server
- X
- XTIN client
- X----------
- X1) Edit tin Makefile to enable XINDEX & XUSER functionality.
- X cd <tin-dir>
- X [vi|emacs] Makefile
- X Add -DNNTP_XINDEX to CFLAGS if you want tin to retrieve index files
- X from the server.
- X Add -DNNTP_XUSER to CFLAGS if you want tin to log the username to
- X the NNTP logfile.
- X Add -DNNTP_EXTS to CFLAGS if you want both NNTP_XINDEX & NNTP_XUSER
- X enabled.
- X
- X2) Recompile & install tin.
- X cd <tin-dir>
- X make <system>
- X make install
- X
- XTIN daemon (on NNTP server)
- X---------------------------
- X1) Edit tin Makefile to enable index daemon functionality.
- X cd <tin-dir>
- X [vi|emacs] Makefile
- X Add -DINDEX_DAEMON to CFLAGS to create a version of tin 'tind' to
- X create & update index files on the NNTP server.
- X
- X2) Compile & install tind.
- X cd <tin-dir>
- X make <system>
- X make install_daemon
- X
- X3) Add entry to crontab to start 'tind' index daemon every so often.
- X cd /usr/spool/cron/crontabs
- X [vi|emacs] root
- X Add following line to run tind every 30 minutes:
- X 0,30 * * * * su news -c '/usr/lib/news/tind'
- X
- XOK. If you have gotten this far you will have the following configuration:
- X o tind will run every 30 minutes to update a central directory (usually
- X /usr/spool/news/.index) of tin index files for all groups in the active
- X file. The directory can be changed by 'tind -I dir' if so desired.
- X
- X o The NNTP server nntpd will service all requests for tin index files
- X from tin clients. It will do this by returning the contents of the
- X group index file in the index directory (ie. /usr/spool/news/.index/*)
- X
- X o The tin client will issue requests for index files to the NNTP server
- X therefore saving space on the client machine and ensuring that there
- X are only one copy of index files on the whole network. Also clients
- X will not have to wait while index files are built locally as the index
- X daemon tind runs frequently on the news server.
- X
- XEnjoy & happy newsreading
- X
- X Iain
- X
- END_OF_FILE
- if test 3162 -ne `wc -c <'INSTALL.NNTP'`; then
- echo shar: \"'INSTALL.NNTP'\" unpacked with wrong size!
- fi
- # end of 'INSTALL.NNTP'
- fi
- if test -f 'common.patch' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'common.patch'\"
- else
- echo shar: Extracting \"'common.patch'\" \(2369 characters\)
- sed "s/^X//" >'common.patch' <<'END_OF_FILE'
- XFiles common.old/Makefile and common/Makefile are identical
- XFiles common.old/README and common/README are identical
- XFiles common.old/README.HPUX and common/README.HPUX are identical
- XFiles common.old/README.IRIX and common/README.IRIX are identical
- XFiles common.old/README.LIB and common/README.LIB are identical
- XFiles common.old/README.MTXNIU and common/README.MTXNIU are identical
- XFiles common.old/README.SYSV and common/README.SYSV are identical
- XFiles common.old/README.XENIX and common/README.XENIX are identical
- XFiles common.old/clientlib.c and common/clientlib.c are identical
- XFiles common.old/clientlib.h and common/clientlib.h are identical
- XOnly in common: conf.h
- Xdiff -rcs common.old/conf.h.dist common/conf.h.dist
- X*** common.old/conf.h.dist Wed May 6 09:01:11 1992
- X--- common/conf.h.dist Mon May 4 07:31:14 1992
- X***************
- X*** 7,12 ****
- X--- 7,20 ----
- X * Compile time options.
- X */
- X
- X+ /*
- X+ * Extensions to NNTP RFC977 (I.Lea 07-03-92)
- X+ */
- X+
- X+ #define XUSER /* log clients username to nntp logfile */
- X+ #define XINDEX /* retieve tin index files from server */
- X+ #define SUBSCRIPTIONS_FILE "/usr/lib/news/subscriptions"
- X+
- X
- X #undef ALONE /* True if we're running without inetd */
- X
- XOnly in common: conf.h.dst.old
- XOnly in common: conf.h.norisc
- Xdiff -rcs common.old/nntp.h common/nntp.h
- X*** common.old/nntp.h Wed May 6 09:01:11 1992
- X--- common/nntp.h Tue Mar 10 08:52:12 1992
- X***************
- X*** 38,43 ****
- X--- 38,46 ----
- X #define OK_GOODBYE 205 /* Closing connection */
- X #define OK_GROUP 211 /* Group selected */
- X #define OK_GROUPS 215 /* Newsgroups follow */
- X+ #ifdef XINDEX
- X+ #define OK_XINDEX 218 /* Group index file follows */
- X+ #endif
- X #define OK_ARTICLE 220 /* Article (head & body) follows */
- X #define OK_HEAD 221 /* Head follows */
- X #define OK_BODY 222 /* Body follows */
- X***************
- X*** 57,62 ****
- X--- 60,68 ----
- X #define ERR_GOODBYE 400 /* Have to hang up for some reason */
- X #define ERR_NOGROUP 411 /* No such newsgroup */
- X #define ERR_NCING 412 /* Not currently in newsgroup */
- X+ #ifdef XINDEX
- X+ #define ERR_XINDEX 418 /* No index file for newsgroup */
- X+ #endif
- X #define ERR_NOCRNT 420 /* No current article selected */
- X #define ERR_NONEXT 421 /* No next article in this group */
- X #define ERR_NOPREV 422 /* No previous article in this group */
- XFiles common.old/version.c and common/version.c are identical
- END_OF_FILE
- if test 2369 -ne `wc -c <'common.patch'`; then
- echo shar: \"'common.patch'\" unpacked with wrong size!
- fi
- # end of 'common.patch'
- fi
- if test -f 'prompt.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'prompt.c'\"
- else
- echo shar: Extracting \"'prompt.c'\" \(3150 characters\)
- sed "s/^X//" >'prompt.c' <<'END_OF_FILE'
- X/*
- X * Project : tin - a threaded Netnews reader
- X * Module : prompt.c
- X * Author : I.Lea
- X * Created : 01-04-91
- X * Updated : 03-06-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- X * so long as there is no profit made from its use, sale
- X * trade or reproduction. You may not change this copy-
- X * right notice, and it must be included in any copy made
- X */
- X
- X#include "tin.h"
- X
- X/*
- X * prompt_num
- X * get a number from the user
- X * Return -1 if missing or bad number typed
- X */
- X
- Xint prompt_num (ch, prompt)
- X int ch;
- X char *prompt;
- X{
- X char *p;
- X int num;
- X
- X set_alarm_clock_off ();
- X
- X clear_message ();
- X
- X sprintf (msg, "%c", ch);
- X
- X if ((p = getline (prompt, TRUE, msg)) != (char *) 0) {
- X strcpy (msg, p);
- X num = atoi (msg);
- X } else {
- X num = -1;
- X }
- X
- X clear_message ();
- X
- X set_alarm_clock_on ();
- X
- X return (num);
- X}
- X
- X/*
- X * prompt_string
- X * get a string from the user
- X * Return TRUE if a valid string was typed, FALSE otherwise
- X */
- X
- Xint prompt_string (prompt, buf)
- X char *prompt;
- X char *buf;
- X{
- X char *p;
- X
- X set_alarm_clock_off ();
- X
- X clear_message ();
- X
- X if ((p = getline (prompt, FALSE, (char *) 0)) == (char *) 0) {
- X buf[0] = '\0';
- X clear_message ();
- X set_alarm_clock_on ();
- X return FALSE;
- X }
- X strcpy (buf, p);
- X
- X clear_message ();
- X set_alarm_clock_on ();
- X
- X return TRUE;
- X}
- X
- X/*
- X * prompt_menu_string
- X * get a string from the user
- X * Return TRUE if a valid string was typed, FALSE otherwise
- X */
- X
- Xint prompt_menu_string (line, col, var)
- X int line;
- X int col;
- X char *var;
- X{
- X char *p;
- X
- X set_alarm_clock_off ();
- X
- X MoveCursor (line, col);
- X
- X if ((p = getline ("", FALSE, var)) == (char *) 0) {
- X set_alarm_clock_on ();
- X return FALSE;
- X }
- X strcpy (var, p);
- X
- X set_alarm_clock_on ();
- X
- X return TRUE;
- X}
- X
- X
- Xint prompt_yn (line, prompt, prompt_ch)
- X int line;
- X char *prompt;
- X int prompt_ch;
- X{
- X char ch;
- X
- X set_alarm_clock_off ();
- X
- X MoveCursor (line, 0);
- X CleartoEOLN ();
- X printf ("%s%c", prompt, prompt_ch);
- X fflush (stdout);
- X MoveCursor (line, (int) strlen (prompt));
- X
- X if ((ch = (char) ReadCh()) == CR) {
- X ch = prompt_ch;
- X }
- X
- X if (line == LINES) {
- X clear_message();
- X } else {
- X MoveCursor (line, (int) strlen (prompt));
- X if (ch == ESC) {
- X fputc (prompt_ch, stdout);
- X } else {
- X fputc (ch, stdout);
- X }
- X fflush (stdout);
- X }
- X
- X set_alarm_clock_on ();
- X
- X return (ch == 'y' ? TRUE : FALSE);
- X}
- X
- X
- Xvoid prompt_on_off (row, col, var, help_text, prompt_text)
- X int row;
- X int col;
- X int *var;
- X char *help_text;
- X char *prompt_text;
- X{
- X int ch, var_orig;
- X
- X set_alarm_clock_off ();
- X
- X var_orig = *var;
- X
- X show_menu_help (help_text);
- X do {
- X MoveCursor (row, col + (int) strlen (prompt_text));
- X if ((ch = (char) ReadCh ()) == ' ') {
- X *var = !*var;
- X printf ("%s", (*var ? "ON " : "OFF"));
- X fflush (stdout);
- X }
- X } while (ch != CR && ch != ESC);
- X
- X if (ch == ESC) {
- X *var = var_orig;
- X printf ("%s", (*var ? "ON " : "OFF"));
- X fflush (stdout);
- X }
- X
- X set_alarm_clock_on ();
- X}
- X
- X
- Xvoid continue_prompt ()
- X{
- X char ch;
- X
- X set_alarm_clock_off ();
- X
- X info_message (txt_hit_any_key);
- X ch = (char) ReadCh ();
- X
- X set_alarm_clock_on ();
- X}
- END_OF_FILE
- if test 3150 -ne `wc -c <'prompt.c'`; then
- echo shar: \"'prompt.c'\" unpacked with wrong size!
- fi
- # end of 'prompt.c'
- fi
- if test -f 'screen.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'screen.c'\"
- else
- echo shar: Extracting \"'screen.c'\" \(2916 characters\)
- sed "s/^X//" >'screen.c' <<'END_OF_FILE'
- X/*
- X * Project : tin - a threaded Netnews reader
- X * Module : screen.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- X * Updated : 18-04-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- X * so long as there is no profit made from its use, sale
- X * trade or reproduction. You may not change this copy-
- X * right notice, and it must be included in any copy made
- X */
- X
- X#include "tin.h"
- X
- Xextern int errno;
- X
- Xchar msg[LEN];
- Xstruct screen_t *screen;
- X
- X
- Xvoid info_message (str)
- X char *str;
- X{
- X clear_message (); /* Clear any old messages hanging around */
- X center_line (LINES, FALSE, str); /* center the message at screen bottom */
- X if (! cmd_line) {
- X MoveCursor (LINES, 0);
- X }
- X}
- X
- X
- Xvoid wait_message (str)
- X char *str;
- X{
- X clear_message (); /* Clear any old messages hanging around */
- X fputs (str, stdout);
- X fflush (stdout);
- X}
- X
- X
- Xvoid error_message (template, str)
- X char *template;
- X char *str;
- X{
- X errno = 0;
- X
- X clear_message (); /* Clear any old messages hanging around */
- X
- X fprintf (stderr, template, str);
- X fflush (stderr);
- X
- X if (cmd_line) {
- X fputc ('\n', stderr);
- X fflush (stderr);
- X } else {
- X MoveCursor (LINES, 0);
- X sleep (2);
- X }
- X}
- X
- X
- Xvoid perror_message (template, str)
- X char *template;
- X char *str;
- X{
- X char str2[512];
- X
- X clear_message (); /* Clear any old messages hanging around */
- X
- X sprintf (str2, template, str);
- X perror (str2);
- X errno = 0;
- X
- X if (cmd_line) {
- X fputc ('\n', stderr);
- X fflush (stderr);
- X } else {
- X MoveCursor (LINES, 0);
- X sleep (2);
- X }
- X}
- X
- X
- Xvoid clear_message ()
- X{
- X if (! cmd_line) {
- X MoveCursor (LINES, 0);
- X CleartoEOLN ();
- X }
- X}
- X
- X
- Xvoid center_line (line, inverse, str)
- X int line;
- X int inverse;
- X char *str;
- X{
- X int pos;
- X
- X if (! cmd_line) {
- X pos = (COLS - (int) strlen (str)) / 2;
- X MoveCursor (line, pos);
- X if (inverse) {
- X StartInverse ();
- X }
- X }
- X
- X fputs (str, stdout);
- X fflush (stdout);
- X
- X if (! cmd_line) {
- X if (inverse) {
- X EndInverse ();
- X }
- X }
- X}
- X
- X
- Xvoid draw_arrow (line)
- X int line;
- X{
- X MoveCursor (line, 0);
- X
- X if (draw_arrow_mark) {
- X fputs ("->", stdout);
- X fflush (stdout);
- X } else {
- X StartInverse ();
- X fputs (screen[line-INDEX_TOP].col, stdout);
- X fflush (stdout);
- X EndInverse ();
- X }
- X MoveCursor (LINES, 0);
- X}
- X
- X
- Xvoid erase_arrow (line)
- X int line;
- X{
- X MoveCursor (line, 0);
- X
- X if (draw_arrow_mark) {
- X fputs (" ", stdout);
- X } else {
- X EndInverse ();
- X fputs (screen[line-INDEX_TOP].col, stdout);
- X }
- X fflush (stdout);
- X}
- X
- X
- Xvoid show_title (title)
- X char *title;
- X{
- X int col;
- X
- X col = (COLS - (int) strlen (txt_type_h_for_help))+1;
- X if (col) {
- X MoveCursor (0, col);
- X if (mail_check ()) { /* you have mail message in */
- X fputs (txt_you_have_mail, stdout);
- X } else {
- X fputs (txt_type_h_for_help, stdout);
- X }
- X }
- X center_line (0, TRUE, title);
- X}
- X
- X
- Xvoid ring_bell ()
- X{
- X fputc ('\007', stdout);
- X fflush (stdout);
- X}
- END_OF_FILE
- if test 2916 -ne `wc -c <'screen.c'`; then
- echo shar: \"'screen.c'\" unpacked with wrong size!
- fi
- # end of 'screen.c'
- fi
- if test -f 'wildmat.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'wildmat.3'\"
- else
- echo shar: Extracting \"'wildmat.3'\" \(2247 characters\)
- sed "s/^X//" >'wildmat.3' <<'END_OF_FILE'
- X.TH WILDMAT 3
- X.SH NAME
- Xwildmat \- perform shell-style wildcard matching
- X.SH SYNOPSIS
- X.nf
- X.B "int"
- X.B "wildmat(text, pattern)"
- X.B " char *text;"
- X.B " char *pattern;"
- X.fi
- X.SH DESCRIPTION
- X.I Wildmat
- Xcompares the
- X.I text
- Xagainst the
- X.I pattern
- Xand
- Xreturns non-zero if the pattern matches the text.
- XThe pattern is interpreted similar to shell filename wildcards, and not
- Xas a full regular expression such as those handled by the
- X.IR grep (1)
- Xfamily of programs or the
- X.IR regex (3)
- Xor
- X.IR regexp (3)
- Xset of routines.
- X.PP
- XThe pattern is interpreted according to the following rules:
- X.TP
- X.BI \e x
- XTurns off the special meaning of
- X.I x
- Xand matches it directly; this is used mostly before a question mark or
- Xasterisk, and is not valid inside square brackets.
- X.TP
- X.B ?
- XMatches any single character.
- X.TP
- X.B *
- XMatches any sequence of zero or more characters.
- X.TP
- X.BI [ x...y ]
- XMatches any single character specified by the set
- X.IR x...y .
- XA minus sign may be used to indicate a range of characters.
- XThat is,
- X.I [0\-5abc]
- Xis a shorthand for
- X.IR [012345abc] .
- XMore than one range may appear inside a character set;
- X.I [0-9a-zA-Z._]
- Xmatches almost all of the legal characters for a host name.
- XThe close bracket,
- X.IR ] ,
- Xmay be used if it is the first character in the set.
- XThe minus sign,
- X.IR \- ,
- Xmay be used if it is either the first or last character in the set.
- X.TP
- X.BI [^ x...y ]
- XThis matches any character
- X.I not
- Xin the set
- X.IR x...y ,
- Xwhich is interpreted as described above.
- XFor example,
- X.I [^]\-]
- Xmatches any character other than a close bracket or minus sign.
- X.SH "BUGS AND LIMITATIONS"
- XThere is no way to end a range with a close bracket.
- X.SH HISTORY
- XWritten by Rich $alz <rsalz@bbn.com> in 1986, and posted to Usenet
- Xseveral times since then, most notably in comp.sources.misc in
- XMarch, 1991.
- X.PP
- XLars Mathiesen <thorinn@diku.dk> enhanced the multi-asterisk failure
- Xmode in early 1991.
- X.PP
- XRich and Lars increased the efficiency of star patterns and reposted it
- Xto comp.sources.misc in April, 1991.
- X.PP
- XRobert Elz <kre@munnari.oz.au> added minus sign and close bracket handling
- Xin June, 1991.
- X.PP
- X.de R$
- XThis is revision \\$3, dated \\$4.
- X..
- X.R$ $Id: wildmat.3,v 1.7 91/07/05 17:50:16 rsalz Exp $
- X.SH "SEE ALSO"
- Xgrep(1), regex(3), regexp(3).
- END_OF_FILE
- if test 2247 -ne `wc -c <'wildmat.3'`; then
- echo shar: \"'wildmat.3'\" unpacked with wrong size!
- fi
- # end of 'wildmat.3'
- fi
- if test -f 'xindex.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xindex.c'\"
- else
- echo shar: Extracting \"'xindex.c'\" \(3476 characters\)
- sed "s/^X//" >'xindex.c' <<'END_OF_FILE'
- X/*
- X * Project : NNTP (RFC 977) extension
- X * Module : xindex.c
- X * Author : I.Lea
- X * Created : 07-03-92
- X * Updated : 22-03-92
- X * Notes : Add a command to retieve index files from the
- X * NNTP server so as to save space on the client.
- X * Ideas borrowed from XTHREAD nntp extension code
- X * posted by Tim Iverson to alt.sources in mid'91.
- X * Copyright : (c) Copyright 1992 by Iain Lea
- X * You may freely copy or redistribute this software,
- X * so long as there is no profit made from its use, sale
- X * trade or reproduction. You may not change this copy-
- X * right notice, and it must be included in any copy made
- X */
- X
- X#include "common.h"
- X
- X#ifdef XINDEX
- X
- X#undef DEBUG_XINDEX /* set to define to turn on more debug info */
- X#define HASH_VALUE 1409 /* mod value for hashing group name */
- X
- X#ifdef __STDC__
- Xvoid xindex (int argc, char *argv[]);
- Xstatic void find_index_file (char *group, char *index_file);
- Xstatic long hash_groupname (char *group);
- X#else
- Xvoid xindex ();
- Xstatic void find_index_file ();
- Xstatic long hash_groupname ();
- X#endif
- X
- X/*
- X * Usage: XINDEX GROUP
- X *
- X * GROUP Group for which to retrieve index file
- X *
- X * This command is NOT documented in RFC977.
- X */
- X
- Xvoid xindex (argc, argv)
- X int argc;
- X char *argv[];
- X{
- X char line[NNTP_STRLEN];
- X char group[256];
- X char index_file[256];
- X char *cp;
- X FILE *fp;
- X
- X /*
- X * "parse" the argument list
- X */
- X if (argc == 1) {
- X printf("%d Usage: XINDEX group\r\n", ERR_CMDSYN);
- X (void) fflush(stdout);
- X return;
- X } else {
- X strncpy (group, argv[1], sizeof (group)-1);
- X#if defined(SYSLOG) && defined(DEBUG_XINDEX)
- X syslog(LOG_INFO, "%s xindex %s", hostname, group);
- X#endif
- X
- X find_index_file(group, index_file);
- X
- X if ((fp = fopen(index_file, "r")) == NULL) {
- X#ifdef SYSLOG
- X syslog(LOG_INFO, "%s xindex cannot open %s (%s)",
- X hostname, group, index_file);
- X#endif
- X printf("%d XINDEX Cannot open %s\r\n",
- X ERR_XINDEX, group);
- X (void) fflush(stdout);
- X return;
- X }
- X
- X printf("%d XINDEX group in index format\r\n", OK_XINDEX);
- X (void) fflush(stdout);
- X
- X while (fgets(line, sizeof(line), fp) != NULL) {
- X if ((cp = index(line, '\n')) != NULL)
- X *cp = '\0';
- X putline(line);
- X }
- X (void) fclose(fp);
- X
- X putline(".");
- X (void) fflush(stdout);
- X }
- X}
- X
- X/*
- X * Look in <SPOOLDIR>/.index directory for the index file for the
- X * given group. Hashing the group name gets a number. See if that
- X * #.1 file exists; if so, read first line. Group we want? If not,
- X * try #.2. Repeat until no such file or we find the right file.
- X */
- X
- Xstatic void find_index_file (group, index_file)
- X char *group;
- X char *index_file;
- X{
- X char buf[256], *p;
- X FILE *fp;
- X int i = 1;
- X unsigned long hash;
- X
- X hash = hash_groupname (group);
- X
- X while (1) {
- X sprintf (index_file, "%s/.index/%lu.%d", SPOOLDIR, hash, i);
- X
- X if ((fp = fopen (index_file, "r")) == NULL) {
- X return;
- X }
- X
- X if (fgets (buf, sizeof (buf), fp) == NULL) {
- X fclose (fp);
- X return;
- X }
- X fclose (fp);
- X
- X for (p = buf; *p && *p != '\n'; p++) {
- X continue;
- X }
- X *p = '\0';
- X
- X if (strcmp (buf, group) == 0) {
- X return;
- X }
- X i++;
- X }
- X}
- X
- X/*
- X * hash group name for filename of group
- X */
- X
- Xstatic long hash_groupname (group)
- X char *group;
- X{
- X unsigned long hash_value;
- X unsigned char *ptr = (unsigned char *) group;
- X
- X hash_value = *ptr++;
- X
- X while (*ptr)
- X hash_value = ((hash_value << 1) ^ *ptr++) % HASH_VALUE;
- X
- X return (hash_value);
- X}
- X
- X
- X#endif /* XINDEX */
- X
- END_OF_FILE
- if test 3476 -ne `wc -c <'xindex.c'`; then
- echo shar: \"'xindex.c'\" unpacked with wrong size!
- fi
- # end of 'xindex.c'
- fi
- echo shar: End of archive 15 \(of 15\).
- cp /dev/null ark15isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 15 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-