kent@sparky.imd.sterling.com (Kent Landfield) (05/10/91)
Submitted-by: Kent Landfield <kent@sparky.imd.sterling.com> Posting-number: Volume 19, Issue 20 Archive-name: rkive/patch01b Patch-To: rkive: Volume 17, Issue 17-22 #!/bin/sh # do not concatenate these parts, unpack them in order with /bin/sh # file patch2.1 continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 2; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping patch2.1' else echo 'x - continuing file patch2.1' sed 's/^X//' << 'SHAR_EOF' >> 'patch2.1' && X ! 9. Use the posted date for chronological archiving instead of the ! archived date. X ! 10. Mail on error only. X ! 11. Add a selection control-character which gives the local system article X number to put in 'log' and 'index'. Would help if one runs into trouble. + + 12. Have a post capability in which the output from rkive would be posted + to a local newsgroup instead of mailing it to a list of users or maybe + as well as. X X Well that's the direction I am heading... If you have *any* additional X ideas that are constructive, positive or negative (flames to /nev/dull) Only in .: INSTALL diff -cr ../usenet/MANIFEST ./MANIFEST *** ../usenet/MANIFEST Wed May 8 21:31:59 1991 --- ./MANIFEST Thu May 9 01:23:25 1991 *************** *** 1,9 **** ! File Name Archive # Description ! ----------------------------------------------------------- X Changes 1 General description of changes in each version. X IDEAS 1 Contains future improvement ideas. X MANIFEST 1 This shipping list ! Makefile 2 rkive make file for generating the software. X README 1 Information posting that should be read first. X article.1 2 Manual page for article command. X article.c 2 Source containing article main routines. --- 1,10 ---- ! # File Name Archive # Description ! #----------------------------------------------------------- X Changes 1 General description of changes in each version. X IDEAS 1 Contains future improvement ideas. + INSTALL 1 Instructions on installing rkive. X MANIFEST 1 This shipping list ! Makefile.dst 2 rkive distribution Makefile. X README 1 Information posting that should be read first. X article.1 2 Manual page for article command. X article.c 2 Source containing article main routines. *************** *** 16,21 **** --- 17,23 ---- X efopen.c 1 Fopen a file with error checking. X format.c 2 Formatting output for indexes, logs, articles. X header.c 3 News article header reading routines. + localize.smpl 3 Local configuration script example. X makedir.c 1 Make directory routines. X match.y 1 Matching routines for globbing support. X news_arc.c 4 News archiving gut functions. *************** *** 30,40 **** X rkive.5 2 Manual page for the rkive configuration file. X rkive.c 4 Source containing rkive main routines. X rkive.cf 3 Template configuration file. ! rkive.h 2 Include file for rkive software. X setup.c 3 Routines to read the rkive configuration file. X str.c 1 String manipulation routines. X suffix.c 1 Compression suffix addition/removal routines. X suffix.h 1 Include for suffix structure and table. X t.cf 1 Test archive config file. Not the template. X update_netdocs 1 Script to archive Usenet periodic articles. X version.c 1 Print the current version and patchlevel. --- 32,43 ---- X rkive.5 2 Manual page for the rkive configuration file. X rkive.c 4 Source containing rkive main routines. X rkive.cf 3 Template configuration file. ! rkive.h.dst 2 Distribution include file for rkive software. X setup.c 3 Routines to read the rkive configuration file. X str.c 1 String manipulation routines. X suffix.c 1 Compression suffix addition/removal routines. X suffix.h 1 Include for suffix structure and table. + sys.cf 1 Test archive config file. Could be a template. X t.cf 1 Test archive config file. Not the template. X update_netdocs 1 Script to archive Usenet periodic articles. X version.c 1 Print the current version and patchlevel. Only in ../usenet: Makefile Only in .: Makefile.dst diff -cr ../usenet/README ./README *** ../usenet/README Wed May 8 21:31:50 1991 --- ./README Thu May 9 01:33:33 1991 *************** *** 1,7 **** X X USENET Sources Archiver X ! @(#)README 2.2 2/23/91 X X Copyright (c) 1989, 1990, 1991 by Kent Landfield. X --- 1,7 ---- X X USENET Sources Archiver X ! @(#)README 2.3 5/9/91 X X Copyright (c) 1989, 1990, 1991 by Kent Landfield. X *************** *** 68,108 **** X to a specified list of users or aliases. The indexes and log file formats X are specifiable by the person configuring the rkive configuration file. X ! ------------------------------------------------------------------- ! The following defines are possible. Please note that the Directory ! Creation defines are specified in Makefile while the rest are specified ! in rkive.h. ! ! *************************** ! rkive.h - General Defines ! *************************** ! ! -D REDUCE_HEADERS : Archived article header reduction code. ! Disk space is saved by removing header lines that have no ! further use after the article is stored in the archive. ! As currently defined, all headers *except* for From:, Newsgroups:, ! Subject:, Message-ID:, Approved:, and Date: are removed if this ! is defined. ! The list of headers to be saved can be added to or reduced by ! modifying the table "hdrs" in news_arc.c. ! ! -D SUBJECT_LINE : Specify that the local mailer has -s option ! such as /usr/bin/mailx or /usr/ucb/Mail. ! ! ************************************* ! Makefile - Directory Creation Defines ! ************************************* ! ! -D HAVE_MKDIR : use the mkdir() function in the system library. ! (AT&T 5.2 or earlier systems are probably out of luck..) ! ! -D USE_SYSMKDIR : have rkive system off /bin/mkdir. ! (not recommended for *real* use...) ! ! If you do not define either, the function makedir() will create the ! directory itself. I suggest that if you do not have mkdir() in your ! system libraries, use the builtin if you can. *Please* verify you can ! use it *first*. X X --------------------------- X Archive Member Compression: --- 68,76 ---- X to a specified list of users or aliases. The indexes and log file formats X are specifiable by the person configuring the rkive configuration file. X ! Please read the file INSTALL for specifics on installation of rkive and ! is associated applications. What follows is a little background information ! that might be helpful to read prior to reading INSTALL. X X --------------------------- X Archive Member Compression: diff -cr ../usenet/article.1 ./article.1 *** ../usenet/article.1 Wed May 8 21:31:56 1991 --- ./article.1 Thu May 9 01:36:32 1991 *************** *** 1,4 **** ! 'br "@(#)article.1 2.2 2/23/91" X .op 1i X .TH ARTICLE 1 X .SH NAME --- 1,4 ---- ! 'br "@(#)article.1 2.3 5/9/91" X .op 1i X .TH ARTICLE 1 X .SH NAME *************** *** 81,89 **** X D - Print the Date line. X E - Print the Reposted-by line. X F - Print the From line. ! H - Print the Original-posting-by line. ! I - Print the Original-subject line. ! J - Print the Archive-directory. X K - Print the Keywords line. X L - Print the Lines line. X M - Print the Message-ID line. --- 81,89 ---- X D - Print the Date line. X E - Print the Reposted-by line. X F - Print the From line. ! H - Print the Comp.archives Original-posting-by line. ! I - Print the Comp.archives Original-subject line. ! J - Print the Comp.archives Archive-directory line. X K - Print the Keywords line. X L - Print the Lines line. X M - Print the Message-ID line. *************** *** 92,99 **** X Q - Print the Expires line. X R - Print the References line. X S - Print the Subject line. - T - Print the Subject Topic. - V - Print the Volume-Issue article filename. X W - Print the Architecture line. X X - Print the Version-number. X a - Print the Archive-name line. --- 92,97 ---- *************** *** 102,108 **** X d - Print the Distribution line. X e - Print the Environment line. X f - Print the Followup-to line. ! h - Print the X-Checksum-Snefru line. X o - Print the Organization line. X p - Print the Posting-number line. X r - Print the Reply-to line. --- 100,107 ---- X d - Print the Distribution line. X e - Print the Environment line. X f - Print the Followup-to line. ! h - Print the X-Md4-Signature line or ! Print the X-Checksum-Snefru line. X o - Print the Organization line. X p - Print the Posting-number line. X r - Print the Reply-to line. *************** *** 118,123 **** --- 117,124 ---- X B - Print the base file name. X G - Print the newsGroup name. X O - Print the Full path of the specified file. + Z - Print the Relative path of the file within the + newsgroup archive directory. X i - Print the issue (if archive) line. X l - Print the Author's logon address line. X n - Print the Author's name. *************** *** 126,133 **** X Additional Specification Characters X X T - Print the Subject line's topic information. X % - Print a %, no argument is converted. ! ..nr X .PP X In addition to the conversion characters, the following X characters have meaning during the formatting of the output. --- 127,135 ---- X Additional Specification Characters X X T - Print the Subject line's topic information. + V - Print the Volume-Issue article filename. X % - Print a %, no argument is converted. ! .nf X .PP X In addition to the conversion characters, the following X characters have meaning during the formatting of the output. diff -cr ../usenet/article.h ./article.h *** ../usenet/article.h Wed May 8 21:31:57 1991 --- ./article.h Thu May 9 01:36:32 1991 *************** *** 1,5 **** X /* ! ** @(#)article.h 2.2 2/23/91 X ** X */ X --- 1,5 ---- X /* ! ** @(#)article.h 2.3 5/9/91 X ** X */ X *************** *** 57,63 **** X #define ARCH_NAME 23 X #define ARTICLEID 24 X #define PATCH_TO 25 ! #define X_CHECKSUM_SNEFRU 26 X #define ORIGINAL_POSTING_BY 27 X #define ORIGINAL_SUBJECT 28 X #define ARCHIVE_SITE 29 --- 57,63 ---- X #define ARCH_NAME 23 X #define ARTICLEID 24 X #define PATCH_TO 25 ! #define X_CHECKSUM 26 X #define ORIGINAL_POSTING_BY 27 X #define ORIGINAL_SUBJECT 28 X #define ARCHIVE_SITE 29 *************** *** 103,109 **** X char posting_num[BUFLEN]; /* Posting-number: */ X char archive_name[BUFLEN]; /* Archive-name: */ X char patch_to[BUFLEN]; /* Patch-To: */ ! char x_checksum_snefru[BUFLEN]; /* X-Checksum-Snefru: */ X char orig_poster[BUFLEN]; /* Original-posting-by: */ X char orig_subject[BUFLEN]; /* Original-subject: */ X char archive_site[BUFLEN]; /* Archive-site: */ --- 103,110 ---- X char posting_num[BUFLEN]; /* Posting-number: */ X char archive_name[BUFLEN]; /* Archive-name: */ X char patch_to[BUFLEN]; /* Patch-To: */ ! char x_checksum[BUFLEN]; /* X-Checksum-Snefru: or */ ! /* X-Md4-Signature: */ X char orig_poster[BUFLEN]; /* Original-posting-by: */ X char orig_subject[BUFLEN]; /* Original-subject: */ X char archive_site[BUFLEN]; /* Archive-site: */ diff -cr ../usenet/ckconfig.c ./ckconfig.c *** ../usenet/ckconfig.c Wed May 8 21:31:57 1991 --- ./ckconfig.c Thu May 9 01:39:07 1991 *************** *** 24,30 **** X ** all ideas to me. This software is going to be maintained and X ** enhanced as deemed necessary by the community. X */ ! char sccsid[] = "@(#)ckconfig.c 2.2 2/23/91"; X X #include <sys/types.h> X #include <stdio.h> --- 24,30 ---- X ** all ideas to me. This software is going to be maintained and X ** enhanced as deemed necessary by the community. X */ ! char sccsid[] = "@(#)ckconfig.c 2.3 5/9/91"; X X #include <sys/types.h> X #include <stdio.h> *************** *** 125,135 **** X default_type == ONLY_ARCHIVE_NAME ? "Only-Archive-Name": X default_type == EXTERNAL_COMMAND ? "External-Command": X "Article-Number"); ! if (default_type == EXTERNAL_COMMAND) { ! /* Must have an ARCHIVE_CMD line... */ ! (void) fprintf(logfp,"Archive Command: %s\n", ! *arch_command ? arch_command : "ERROR - NOT SPECIFIED"); ! } X X (void) fprintf(logfp,"Patches Type: %s\n", X default_patch_type == PACKAGE ? "Package" : "Historical"); --- 125,132 ---- X default_type == ONLY_ARCHIVE_NAME ? "Only-Archive-Name": X default_type == EXTERNAL_COMMAND ? "External-Command": X "Article-Number"); ! (void) fprintf(logfp,"Archive Command: %s\n", ! *arch_command ? arch_command : "NOT SPECIFIED"); X X (void) fprintf(logfp,"Patches Type: %s\n", X default_patch_type == PACKAGE ? "Package" : "Historical"); diff -cr ../usenet/disp_grp.c ./disp_grp.c *** ../usenet/disp_grp.c Wed May 8 21:32:00 1991 --- ./disp_grp.c Thu May 9 01:41:16 1991 *************** *** 8,14 **** X ** X */ X #ifndef lint ! static char SID[] = "@(#)disp_grp.c 2.2 2/23/91"; X #endif X X #include <sys/types.h> --- 8,14 ---- X ** X */ X #ifndef lint ! static char SID[] = "@(#)disp_grp.c 2.3 5/9/91"; X #endif X X #include <sys/types.h> *************** *** 26,31 **** --- 26,32 ---- X extern char mail[]; X extern char compress[]; X extern char checkhash[]; + extern char arch_command[]; X X struct passwd *pw; X struct passwd *getpwuid(); *************** *** 88,95 **** X "Article-Number"); X if (ng->type == EXTERNAL_COMMAND) { X /* Must have an ARCHIVE_CMD line... */ ! (void) fprintf(logfp,"\tArchive Command: %s\n", ! *(ng->arch_command) ? ng->arch_command : "ERROR - NOT SPECIFIED"); X } X X (void) fprintf(logfp,"\tPatches Type: %s\n", --- 89,98 ---- X "Article-Number"); X if (ng->type == EXTERNAL_COMMAND) { X /* Must have an ARCHIVE_CMD line... */ ! (void)fprintf(logfp,"\tArchive Command: %-15s\n", ! *ng->arch_command != '\0' ? ng->arch_command : ! !*arch_command ? "ERROR - (*NO* DEFAULT)" : ! fill_in_defaults ? arch_command : "NOT SPECIFIED (DEFAULT)"); X } X X (void) fprintf(logfp,"\tPatches Type: %s\n", diff -cr ../usenet/format.c ./format.c *** ../usenet/format.c Wed May 8 21:31:53 1991 --- ./format.c Thu May 9 01:44:09 1991 *************** *** 8,14 **** X ** X */ X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)format.c 2.2 2/23/91"; X #endif X X #include <stdio.h> --- 8,14 ---- X ** X */ X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)format.c 2.3 5/9/91"; X #endif X X #include <stdio.h> *************** *** 40,45 **** --- 40,46 ---- X extern int default_modes; X # ifdef NNTP X extern char nntp[]; + extern char nntp_tmp_path[]; X # endif /*NNTP*/ X #endif /* RKIVE */ X *************** *** 243,248 **** --- 244,254 ---- X case 'X': /* Version-number */ X cp = add_string(cp, header.version_number); X continue; + #ifdef RKIVE + case 'Z': /* Relative pathname of archived file */ + cp = add_string(cp,substr(filename,newsgrp->location)?filename+strlen(newsgrp->location)+1:filename); + continue; + #endif X case 'a': /* Archive-name */ X cp = add_string(cp, header.archive_name); X continue; *************** *** 261,268 **** X case 'f': /* Followup-to */ X cp = add_string(cp, header.followup_to); X continue; ! case 'h': /* X-Checksum-Snefru */ ! cp = add_string(cp, header.x_checksum_snefru); X continue; X case 'i': /* issue (if archive) */ X cp = add_string(cp,itoa(article.issue)); --- 267,274 ---- X case 'f': /* Followup-to */ X cp = add_string(cp, header.followup_to); X continue; ! case 'h': /* X-Checksum-Snefru or X-Md4-Signature */ ! cp = add_string(cp, header.x_checksum); X continue; X case 'i': /* issue (if archive) */ X cp = add_string(cp,itoa(article.issue)); *************** *** 419,424 **** --- 425,433 ---- X cp = add_string(cp,newsgrp->mail_list); X continue; X #ifdef NNTP + case 'F': /* NNTP Temporary transfer file */ + cp = add_string(cp,nntp_tmp_path); + continue; X case 'N': /* NNTP */ X /* print out according to precedence. */ X if (*newsgrp->nntp) diff -cr ../usenet/header.c ./header.c *** ../usenet/header.c Wed May 8 21:31:51 1991 --- ./header.c Thu May 9 01:45:11 1991 *************** *** 9,15 **** X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)header.c 2.2 2/23/91"; X #endif X X #include <stdio.h> --- 9,15 ---- X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)header.c 2.3 5/9/91"; X #endif X X #include <stdio.h> *************** *** 78,93 **** X if (its("Patch-to: ")) X return PATCH_TO; X ! /* The X-Checksum-Snefru archive is being used by */ ! /* comp.sources.unix and comp.sources.misc to */ ! /* verify articles. */ X X if (its("X-Checksum-Snefru: ")) ! return X_CHECKSUM_SNEFRU; X X /* The following lines are used by comp.sources.games */ X /* currently to indicate the environmental keywords */ X /* indicating what is required by the software to run. */ X X if (its("Environment: ")) X return ENVIRONMENT; --- 78,99 ---- X if (its("Patch-to: ")) X return PATCH_TO; X ! /* The X-Checksum-Snefru archive was being used by */ ! /* comp.sources.unix and comp.sources.misc to verify */ ! /* articles. Once snefru was broken, the moderators */ ! /* of c.s.u and c.s.m switched to use X-Md4-Signature: */ ! /* which is based on MD4 (RFC1186). */ X X if (its("X-Checksum-Snefru: ")) ! return X_CHECKSUM; ! if (its("X-Md4-Signature: ")) ! return X_CHECKSUM; X X /* The following lines are used by comp.sources.games */ X /* currently to indicate the environmental keywords */ X /* indicating what is required by the software to run. */ + /* Supersedes: is also used by comp.sources.misc to */ + /* indicate when a posting totally replaces another. */ X X if (its("Environment: ")) X return ENVIRONMENT; *************** *** 288,294 **** X header.posting_num[0] = '\0'; /* Posting-number: */ X header.archive_name[0] = '\0'; /* Archive-name: */ X header.patch_to[0] = '\0'; /* Patch-To: */ ! header.x_checksum_snefru[0] = '\0'; /* X-Checksum-Snefru: */ X header.orig_poster[0] = '\0'; /* Original-posting-by: */ X header.orig_subject[0] = '\0'; /* Original-subject: */ X header.archive_site[0] = '\0'; /* Archive-site: */ --- 294,301 ---- X header.posting_num[0] = '\0'; /* Posting-number: */ X header.archive_name[0] = '\0'; /* Archive-name: */ X header.patch_to[0] = '\0'; /* Patch-To: */ ! header.x_checksum[0] = '\0'; /* X-Checksum-Snefru: or */ ! /* X-Md4-Signature */ X header.orig_poster[0] = '\0'; /* Original-posting-by: */ X header.orig_subject[0] = '\0'; /* Original-subject: */ X header.archive_site[0] = '\0'; /* Archive-site: */ *************** *** 736,743 **** X *sp = '\0'; X break; X ! case X_CHECKSUM_SNEFRU: ! data(header.x_checksum_snefru,sizeof(header.x_checksum_snefru),"X_CHECKSUM_SNEFRU:", X_CHECKSUM_SNEFRU); X break; X X case ORIGINAL_POSTING_BY: --- 743,750 ---- X *sp = '\0'; X break; X ! case X_CHECKSUM: ! data(header.x_checksum,sizeof(header.x_checksum),"X_CHECKSUM:", X_CHECKSUM); X break; X X case ORIGINAL_POSTING_BY: Only in .: localize.smpl diff -cr ../usenet/makedir.c ./makedir.c *** ../usenet/makedir.c Wed May 8 21:32:01 1991 --- ./makedir.c Thu May 9 01:48:11 1991 *************** *** 9,15 **** X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)makedir.c 2.1 2/21/91"; X #endif X X #include <sys/types.h> --- 9,15 ---- X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)makedir.c 2.2 5/9/91"; X #endif X X #include <sys/types.h> *************** *** 34,40 **** X int strlen(); X int chown(); X ! #ifndef HAVE_MKDIR X # ifndef USE_SYSMKDIR X X char *strcat(); --- 34,40 ---- X int strlen(); X int chown(); X ! #ifndef MKDIR X # ifndef USE_SYSMKDIR X X char *strcat(); *************** *** 58,69 **** X X char crnt_dir[MAXNAMLEN]; X ! #else /* HAVE_MKDIR */ X X int mkdir(); X int svmask; /* Old umask value */ X ! #endif /* HAVE_MKDIR */ X X if ((strlen(dirpath) == 0) || (dirpath[0] == '\0')) { X (void) fprintf(errfp,"%s: cannot make %s\n", progname,dirpath); --- 58,69 ---- X X char crnt_dir[MAXNAMLEN]; X ! #else /* MKDIR */ X X int mkdir(); X int svmask; /* Old umask value */ X ! #endif /* MKDIR */ X X if ((strlen(dirpath) == 0) || (dirpath[0] == '\0')) { X (void) fprintf(errfp,"%s: cannot make %s\n", progname,dirpath); *************** *** 76,82 **** X return(0); X } X ! #ifdef HAVE_MKDIR X X /* X ** mkdir function supplied in system library. --- 76,82 ---- X return(0); X } X ! #ifdef MKDIR X X /* X ** mkdir function supplied in system library. *************** *** 176,181 **** X return(-1); X } X #endif /* USE_SYSMKDIR */ ! #endif /* HAVE_MKDIR */ X return(0); X } --- 176,181 ---- X return(-1); X } X #endif /* USE_SYSMKDIR */ ! #endif /* MKDIR */ X return(0); X } diff -cr ../usenet/news_arc.c ./news_arc.c *** ../usenet/news_arc.c Wed May 8 21:31:46 1991 --- ./news_arc.c Thu May 9 01:49:47 1991 *************** *** 9,15 **** X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)news_arc.c 2.2 2/23/91"; X #endif X X #include <sys/types.h> --- 9,15 ---- X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)news_arc.c 2.3 5/9/91"; X #endif X X #include <sys/types.h> *************** *** 58,63 **** --- 58,64 ---- X void store_line(); X void dump_article(); X void record_problem(); + void write_patch_log(); X X void get_header(filename) X char *filename; *************** *** 120,125 **** --- 121,127 ---- X { "Date:", (sizeof "Date:") }, X { "Approved:", (sizeof "Approved:") }, X { "X-Checksum-Snefru:", (sizeof "X-Checksum-Snefru:") }, + { "X-Md4-Signature:", (sizeof "X-Md4-Signature:") }, X { NULL, 0 }, X }; X *************** *** 252,258 **** X char *path; X { X void write_archived(); - void write_patch_log(); X X if (copy(filename,path) != 0) { X (void) fprintf(errfp,"copy failed for %s to %s\n",filename,path); --- 254,259 ---- *************** *** 308,316 **** X */ X X /* ! ** If the Snefru header exists, check the article checksum for validity. X */ ! if (header.x_checksum_snefru[0]) { X if (*(ng->checkhash)) { X if (do_checkhash(ng->checkhash, filename) != 0) X return(do_problem(CHECKHASH_PROB,ng,filename,path)); --- 309,318 ---- X */ X X /* ! ** If the MD4 or Snefru headers exists, check the article's ! ** checksum for validity. X */ ! if (header.x_checksum[0]) { X if (*(ng->checkhash)) { X if (do_checkhash(ng->checkhash, filename) != 0) X return(do_problem(CHECKHASH_PROB,ng,filename,path)); *************** *** 421,431 **** X ** issue number to be used is available. X ** There should be no duplicates here ever... :-) X ** [ just don't blow away your .archived file... :-( ] X */ X do { ! ++inum; ! chronpath(ng->location, path, inum); ! } while (stat(path ,&sb) == 0); X break; X case ONLY_ARCHIVE_NAME: X /* --- 423,442 ---- X ** issue number to be used is available. X ** There should be no duplicates here ever... :-) X ** [ just don't blow away your .archived file... :-( ] + ** Need to assure that the compression suffix in not attached + ** as well since the prior run that day may use compression. X */ X do { ! do { ! ++inum; ! chronpath(ng->location, path, inum); ! } while (stat(path ,&sb) == 0); ! /* ! ** expand the path to the file to include the ! ** compression suffix if necessary. ! */ ! final_path = expand_name(path, ng); ! } while (stat(final_path ,&sb) == 0); X break; X case ONLY_ARCHIVE_NAME: X /* *************** *** 517,523 **** X if (*ng->arch_command) X (void) strcpy(command, ng->arch_command); X else if (*arch_command) ! (void) strcpy(command, ng->arch_command); X else X return(do_problem(EXTERNAL_PROB,ng,filename,path)); X --- 528,534 ---- X if (*ng->arch_command) X (void) strcpy(command, ng->arch_command); X else if (*arch_command) ! (void) strcpy(command, arch_command); X else X return(do_problem(EXTERNAL_PROB,ng,filename,path)); X *************** *** 643,648 **** --- 654,660 ---- X #endif /*MV_ORIGINAL */ X X char pmess[BUFSIZ]; + char *final_path; X int nm; X struct stat sb; X *************** *** 670,679 **** X (void) strcat(pmess,"has an invalid archive TYPE specified.\n"); X break; X case CHECKHASH_PROB: ! (void) strcat(pmess,"failed Snefru checkhash test.\n"); X break; X case MSNG_HASH_PROB: ! (void) strcat(pmess,"is missing expected Snefru header.\n"); X break; X case DUP_PROB: X if (article.repost != TRUE) --- 682,691 ---- X (void) strcat(pmess,"has an invalid archive TYPE specified.\n"); X break; X case CHECKHASH_PROB: ! (void) strcat(pmess,"failed article checksum verification test.\n"); X break; X case MSNG_HASH_PROB: ! (void) strcat(pmess,"is missing expected article checksum verifications header.\n"); X break; X case DUP_PROB: X if (article.repost != TRUE) *************** *** 780,789 **** X X nm = 1; X ! while (stat(path, &sb) == 0) { ! (void) sprintf(path,"%s/%s/%s.%d",problems_dir,ng->ng_path,file,nm); ! ++nm; ! } X X /* Display and record the actions */ X (void) sprintf(pmess,"\tStoring Article %s at %s\n", file, path); --- 792,812 ---- X X nm = 1; X ! do { ! final_path = expand_name(path, ng); ! /* ! ** Let's assure that neither the uncompressed or ! ** the compressed version of the article number ! ** exists where we want to put this problem. ! ** Don't need to create a different problem... ! */ ! if ((stat(path, &sb) == 0) || (stat(final_path, &sb) == 0)) { ! (void) sprintf(path,"%s/%s/%s.%d",problems_dir,ng->ng_path,file,nm); ! ++nm; ! } ! else ! nm = 0; ! } while (nm != 0); X X /* Display and record the actions */ X (void) sprintf(pmess,"\tStoring Article %s at %s\n", file, path); *************** *** 849,854 **** --- 872,878 ---- X VOLUME, now.tm_year, month[now.tm_mon], X now.tm_year,now.tm_mon+1,now.tm_mday,seqnum); X #endif /* NO_MONTH_DIR */ + article.volume = now.tm_year; X } X X void write_patch_log(ng, path) *************** *** 954,957 **** X else X return(0); X } - --- 978,980 ---- diff -cr ../usenet/nntpart.c ./nntpart.c *** ../usenet/nntpart.c Wed May 8 21:31:54 1991 --- ./nntpart.c Thu May 9 01:52:17 1991 *************** *** 9,15 **** X */ X X #if !defined(lint) && !defined(SABER) ! static char *SID = "@(#)nntpart.c 2.1 2/21/91"; X #endif X X /*LINTLIBRARY*/ --- 9,15 ---- X */ X X #if !defined(lint) && !defined(SABER) ! static char *SID = "@(#)nntpart.c 2.2 5/9/91"; X #endif X X /*LINTLIBRARY*/ *************** *** 155,161 **** --- 155,169 ---- X return; X } X + /* + ** nntp_tmp_path[] + ** + ** Holds the full pathname of the nntp transfer file. + ** For use with external command archiving... + */ X + char nntp_tmp_path[MAXNAMLEN]; + X int nntp_retrieve_article(filename,which_time) X char *filename; X int which_time; *************** *** 249,254 **** --- 257,263 ---- X ** the Article-Number form of archiving. X */ X (void) sprintf(filename,"%d",f); + (void) sprintf(nntp_tmp_path,"%s/%d",TMPDIR,f); X X /* X ** Build the nntp command string diff -cr ../usenet/patchlevel.h ./patchlevel.h *** ../usenet/patchlevel.h Wed May 8 21:32:02 1991 --- ./patchlevel.h Thu May 9 01:53:31 1991 *************** *** 1,5 **** X /* ! ** @(#)patchlevel.h 2.2 2/23/91 X */ X #define RELEASE 2 ! #define PATCHLEVEL 0 --- 1,5 ---- X /* ! ** @(#)patchlevel.h 2.3 5/9/91 X */ X #define RELEASE 2 ! #define PATCHLEVEL 1 Common subdirectories: ../usenet/port and ./port diff -cr ../usenet/record_arc.c ./record_arc.c *** ../usenet/record_arc.c Wed May 8 21:32:03 1991 --- ./record_arc.c Thu May 9 01:55:39 1991 *************** *** 9,15 **** X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)record_arc.c 2.1 2/21/91"; X #endif X X #include <sys/types.h> --- 9,15 ---- X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)record_arc.c 2.2 5/9/91"; X #endif X X #include <sys/types.h> *************** *** 130,137 **** X if (test) X return; X ! if ((stat(path ,&sb) != 0)) ! if (mkparents(path) == -1) X return; /* unable to build parent directories */ X X /* --- 130,137 ---- X if (test) X return; X ! if ((stat(newsgrp->arc_done ,&sb) != 0)) ! if (mkparents(newsgrp->arc_done) == -1) X return; /* unable to build parent directories */ X X /* diff -cr ../usenet/retrieve.c ./retrieve.c *** ../usenet/retrieve.c Wed May 8 21:31:58 1991 --- ./retrieve.c Thu May 9 01:57:18 1991 *************** *** 9,15 **** X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)retrieve.c 2.1 2/21/91"; X #endif X X #include <sys/types.h> --- 9,15 ---- X */ X X #if !defined(lint) && !defined(SABER) ! static char SID[] = "@(#)retrieve.c 2.2 5/9/91"; X #endif X X #include <sys/types.h> *************** *** 17,22 **** --- 17,24 ---- X #include <stdio.h> X #include "rkive.h" X + #define TMPDIR "/tmp" + X char newsgroup_directory[MAXNAMLEN]; X X extern FILE *inputfp; *************** *** 70,77 **** X ** to retrieve an article: X ** 1. Retrieve an article from a remote site via NNTP, X ** 2. Search the newsgroup directory for newsarticles, ! ** 3. Receive a newsarticle filename on standard input, ! ** 4. Receive newsarticle filenames from a batch file. X */ X X int retrieve_article(filename,which_time) --- 72,80 ---- X ** to retrieve an article: X ** 1. Retrieve an article from a remote site via NNTP, X ** 2. Search the newsgroup directory for newsarticles, ! ** 3. Read an article from standard input, ! ** 4. Receive a newsarticle filename on standard input, ! ** 5. Receive newsarticle filenames from a batch file. X */ X X int retrieve_article(filename,which_time) *************** *** 83,88 **** --- 86,92 ---- X int strlen(); X int unlink(); X int fclose(); + int creat(); X char *strcpy(); X X FILE *efopen(); *************** *** 95,105 **** X static DIR *dfd; X static char *dir = "."; X char ibuf[BUFSIZ]; X - #ifdef NNTP - if (retrieve == FROM_NNTP) - return(nntp_retrieve_article(filename,which_time)); - #endif /*NNTP*/ X X if (which_time == 1) { X (void) strcpy(newsgrp->ng_path, newsgrp->ng_name); --- 99,107 ---- X static DIR *dfd; X static char *dir = "."; X char ibuf[BUFSIZ]; + int len; + int tmpfp; X X X if (which_time == 1) { X (void) strcpy(newsgrp->ng_path, newsgrp->ng_name); *************** *** 115,121 **** X *rp = '/'; /* to create */ X rp++; /* the disk */ X } /* location */ ! X (void) sprintf(newsgroup_directory,"%s/%s", spooldir,newsgrp->ng_path); X X if (chdir(newsgroup_directory) != 0) { --- 117,130 ---- X *rp = '/'; /* to create */ X rp++; /* the disk */ X } /* location */ ! } ! ! #ifdef NNTP ! if (retrieve == FROM_NNTP) ! return(nntp_retrieve_article(filename,which_time)); ! #endif /*NNTP*/ ! ! if (which_time == 1) { X (void) sprintf(newsgroup_directory,"%s/%s", spooldir,newsgrp->ng_path); X X if (chdir(newsgroup_directory) != 0) { *************** *** 164,174 **** X } X X /* X ** The following code is for retrieval types FROM_NAME and FROM_BATCHFILE X ** only. Any other type is an unknown software error ... X */ X if (retrieve != FROM_NAME && retrieve != FROM_BATCHFILE) { ! (void) fprintf(errfp, "Invalid retrieval type encountered - %d\n",retrieve); X return(ERROR_ENCOUNTERED); X } X --- 173,242 ---- X } X X /* + ** FROM_STDIN archiving. + ** + ** First create a temp file name and write the information into + ** the temp file. Write the data passed on stdin into the temp file. + ** Then pass the temp file name back to rkive to use from then on. + */ + + if (retrieve == FROM_STDIN) { + if ((rp = tempnam(TMPDIR, "rkiveXXXXXX")) == NULL) { + (void) fprintf(errfp, "Can't create tmpfile name\n"); + return(ERROR_ENCOUNTERED); + } + + if ((tmpfp = creat(rp, 0644)) == NULL) { + (void) fprintf(errfp, "Can't create tmpfile\n"); + return(ERROR_ENCOUNTERED); + } + + len = -1; + + while (fgets(ibuf, BUFSIZ, inputfp) != NULL) { + len = strlen(ibuf); + if (write(tmpfp, ibuf, len) != len) + perror("write"); + } + (void) close(tmpfp); + + /* + ** If len was never assigned then stdin was closed. + ** and no reason at all to go any further, we are + ** done. Return so... + */ + if (len == -1) { + /* + ** no more filenames on inputfp... + */ + + (void) unlink(rp); + return(DONE); + } + + /* + ** Check to assure the file is available and contains + ** some data... + */ + if (!valid_disk_article(rp,rp)) { + return(ERROR_ENCOUNTERED); + } + + /* + ** We have real data here... + */ + (void) strcpy(filename,rp); + free(rp); + return(RETRIEVED); + } + + /* X ** The following code is for retrieval types FROM_NAME and FROM_BATCHFILE X ** only. Any other type is an unknown software error ... X */ X if (retrieve != FROM_NAME && retrieve != FROM_BATCHFILE) { ! (void) fprintf(errfp, "Invalid retrieval type encountered - %d\n", ! retrieve); X return(ERROR_ENCOUNTERED); X } X diff -cr ../usenet/rkive.5 ./rkive.5 *** ../usenet/rkive.5 Wed May 8 21:31:54 1991 --- ./rkive.5 Thu May 9 01:58:47 1991 *************** *** 1,4 **** ! 'br "@(#)rkive.5 2.3 2/24/91" X .TH RKIVE 5 X .SH NAME X rkive.cf \- USENET Source Archiver Configuration File. --- 1,4 ---- ! 'br "@(#)rkive.5 2.4 5/9/91" X .TH RKIVE 5 X .SH NAME X rkive.cf \- USENET Source Archiver Configuration File. *************** *** 117,125 **** X .IP "CHECKHASH =" X The location of the checkhash utility if the files are to be tested for X transit damage. Currently, only comp.sources.unix and comp.sources.misc ! supports this test with the X-Checksum-Snerfu: header. If this variable ! is specified, it must contain the full path to the command used to perform ! the test. X .IP "NNTP =" X The location of the NNTP server where the articles are to be archived from. X This can be specified globally if all or most newsgroups are archived --- 117,126 ---- X .IP "CHECKHASH =" X The location of the checkhash utility if the files are to be tested for X transit damage. Currently, only comp.sources.unix and comp.sources.misc ! supports this type of testing. The X-Checksum-Snerfu: header has been used ! in the past. This header is being phased out in favor of the X-Md4-Signature: ! header. If this variable is specified, it must contain the full path to the ! command used to perform the verification testing on the articles. X .IP "NNTP =" X The location of the NNTP server where the articles are to be archived from. X This can be specified globally if all or most newsgroups are archived *************** *** 263,271 **** X used to perform the compression. X .IP "CHECKHASH :" X The location of the checkhash utility if the files are to be tested for ! transit damage. Currently, only comp.sources.unix supports this test with ! the X-Checksum-Snerfu: header. If this variable is specified, it must contain ! the full path to the command used to perform the test. X .IP "NNTP :" X The location of the NNTP server where the articles are to be archived from. X This can be specified globally if all or most newsgroups are archived --- 264,272 ---- X used to perform the compression. X .IP "CHECKHASH :" X The location of the checkhash utility if the files are to be tested for ! transit damage. Currently, only comp.sources.unix supports this type of ! testing. If this variable is specified, it must contain the full path to ! the command used to perform the test. X .IP "NNTP :" X The location of the NNTP server where the articles are to be archived from. X This can be specified globally if all or most newsgroups are archived *************** *** 331,337 **** X .br X g - GROUP - Group id specified. X .br ! h - CHECKHASH - Path to the checkhash utility. X .br X i - INDEX - Location of the newsgroup index. X .br --- 332,338 ---- X .br X g - GROUP - Group id specified. X .br ! h - CHECKHASH - Path to checkhash or checkmd4 utility. X .br X i - INDEX - Location of the newsgroup index. X .br *************** *** 358,363 **** --- 359,366 ---- X b - Newsgroup's spool directory path. X .br X n - Newsgroup name. + .br + N - Disk path to the NNTP temporary transfer file. X .br X P - Actual disk path to the file to be archived. X .br diff -cr ../usenet/rkive.c ./rkive.c *** ../usenet/rkive.c Wed May 8 21:31:49 1991 --- ./rkive.c Thu May 9 02:00:19 1991 *************** *** 37,45 **** X #include "cfg.h" X X #ifdef NNTP ! char sccsid[] = "@(#)rkive.c 2.2 2/23/91 - NNTP Version"; X #else ! char sccsid[] = "@(#)rkive.c 2.2 2/23/91"; X #endif /*!NNTP*/ X X /* --- 37,45 ---- X #include "cfg.h" X X #ifdef NNTP ! char sccsid[] = "@(#)rkive.c 2.3 5/9/91 - NNTP Version"; X #else ! char sccsid[] = "@(#)rkive.c 2.3 5/9/91"; X #endif /*!NNTP*/ X X /* *************** *** 46,63 **** X ** This is necessary since the builtin makedir call uses X ** mknod which is a superuser only call for directories. X */ ! #if (!HAVE_MKDIR && !USE_SYSMKDIR) ! #define ROOT_ONLY X #endif X - /* - ** The following define is use for compilation - ** so that format_output can use the extended - ** fomating characters that are not available - ** in article. - */ - #define RKIVE - X char tmp_mailfile[] = "/tmp/rkive.mail"; X char global_mailfile[] = "/tmp/gbl.mail"; X --- 46,57 ---- X ** This is necessary since the builtin makedir call uses X ** mknod which is a superuser only call for directories. X */ ! #ifndef MKDIR ! # ifndef USE_SYSMKDIR ! # define ROOT_ONLY ! # endif X #endif X X char tmp_mailfile[] = "/tmp/rkive.mail"; X char global_mailfile[] = "/tmp/gbl.mail"; X *************** *** 131,136 **** --- 125,132 ---- X (void)fprintf(stderr," Specify alternate configuration file to be used.\n"); X (void)fprintf(stderr," -n newsgroup\n"); X (void)fprintf(stderr," Specify newsgroup to archive or display status for.\n"); + (void)fprintf(stderr," -A newsgroup\n"); + (void)fprintf(stderr," Take an article to archive from stdin.\n"); X (void)fprintf(stderr," -B batchfile\n"); X (void)fprintf(stderr," Read names of articles to archive from batchfile.\n"); X (void)fprintf(stderr," Note: Use of the -B option requires a newsgroup\n"); *************** *** 171,178 **** X config_file = LOCATION; X X if (argc > 1) { ! while ((c = getopt(argc, argv, "?dgstuvVn:f:B:S:y")) != EOF) { X switch (c) { X case 'B': /* take filenames from batch file */ X retrieve = FROM_BATCHFILE; X batch_file = optarg; --- 167,178 ---- X config_file = LOCATION; X X if (argc > 1) { ! while ((c = getopt(argc, argv, "?dgstuvVn:f:A:B:S:y")) != EOF) { X switch (c) { + case 'A': /* stdin article archiving */ + retrieve = FROM_STDIN; + nwsg = optarg; + break; X case 'B': /* take filenames from batch file */ X retrieve = FROM_BATCHFILE; X batch_file = optarg; *************** *** 237,242 **** --- 237,262 ---- X return(1); X } X } + /* + ** If the user has specified that the article is to be read from stdin, + ** the user must specify a a newsgroup as well. A request for status + ** on an article from stdin makes little sense to me... If I am wrong + ** let me know... + */ + else if (retrieve == FROM_STDIN) { + if (nwsg == NULL) { + (void) fprintf(errfp, "%s: Must specify a newsgroup\n",progname); + (void) fprintf(errfp,"Sample command line...\n"); + (void) fprintf(errfp,"\t%s -A newsgroup-here\n",progname); + return(1); + } + if (status_only != 0) { + (void) fprintf(errfp,"%s: can't get status for an article on stdin\n", progname); + (void) fprintf(errfp,"Sample command line...\n"); + (void) fprintf(errfp,"\t%s -A newsgroup-here\n",progname); + return(1); + } + } X X setup_defaults(); X *************** *** 387,392 **** --- 407,413 ---- X /* X ** If the user has specified that a quick status X ** listing should be produced then hop to it.... + ** FROM_STDIN is not allowed to have status requests. X */ X X if (status_only) { *************** *** 485,490 **** --- 506,516 ---- X if (retrieve == FROM_NNTP) X (void) unlink(article_name); X #endif /*NNTP*/ + /* + ** Remove the tmpfile if the article came from stdin. + */ + if (retrieve == FROM_STDIN) + (void) unlink(article_name); X continue; X } X *************** *** 502,507 **** --- 528,538 ---- X if (retrieve == FROM_NNTP) X (void) unlink(article_name); X #endif /*NNTP*/ + /* + ** Remove the tmpfile if the article came from stdin. + */ + if (retrieve == FROM_STDIN) + (void) unlink(article_name); X continue; X } X *************** *** 519,524 **** --- 550,560 ---- X if (retrieve == FROM_NNTP) X (void) unlink(article_name); X #endif /*NNTP*/ + /* + ** Remove the tmpfile if the article came from stdin. + */ + if (retrieve == FROM_STDIN) + (void) unlink(article_name); X continue; X } X } *************** *** 548,554 **** X X if (!problem_article) { X log_activities(archived_file,newsgrp); ! build_index(new_member,newsgrp); X notify_users(archived_file,newsgrp,cct++); X } X } --- 584,590 ---- X X if (!problem_article) { X log_activities(archived_file,newsgrp); ! build_index(archived_file,newsgrp); X notify_users(archived_file,newsgrp,cct++); X } X } *************** *** 566,571 **** --- 602,612 ---- X if (retrieve == FROM_NNTP) X (void) unlink(article_name); X #endif /*NNTP*/ + /* + ** Remove the tmpfile if the article came from stdin. + */ + if (retrieve == FROM_STDIN) + (void) unlink(article_name); X } X X if (!status_only) { *************** *** 833,839 **** X char *filename; X { X char *comp_cmd; - char *kp; X char cmd[BUFSIZ]; X X (void) sprintf(cmd,"%s %s", packit, filename); --- 874,879 ---- *************** *** 849,865 **** X if (!test) X (void) system(cmd); X ! /* ! ** Need to remove any compression command ! ** options if they exist. (compress -f) ! */ ! ! (void) sprintf(cmd,"%s", comp_cmd); ! ! if ((kp = strchr(cmd,' ')) != NULL) { ! *kp = '\0'; ! } ! return(suffix(cmd)); X } X X --- 889,895 ---- X if (!test) X (void) system(cmd); X ! return(suffix(comp_cmd)); X } X X *************** *** 877,883 **** X /* X ** This function is used in the event that a problem X ** has occurred during archiving. It mails a message ! ** to the newsgroup speecified list and it mails a X ** message to the globally specified users. X ** X ** It then logs the fact into both the newsgroup --- 907,913 ---- X /* X ** This function is used in the event that a problem X ** has occurred during archiving. It mails a message ! ** to the newsgroup specified list and it mails a X ** message to the globally specified users. X ** X ** It then logs the fact into both the newsgroup *************** *** 890,895 **** --- 920,932 ---- X if ( *mail ) X logit(global_mailfile, msg_fmt,filename); X + /* + ** Assure that the file you are logging information to + ** has a directory to exist in.. If it fails, oh well.. + */ + + (void)mkparents(ng->logfile); X logit(ng->logfile, msg_fmt, filename); + (void)mkparents(log); X logit(log, msg_fmt, filename); X } diff -cr ../usenet/rkive.cf ./rkive.cf *** ../usenet/rkive.cf Wed May 8 21:31:48 1991 --- ./rkive.cf Thu May 9 02:50:40 1991 *************** *** 1,5 **** X # ! # @(#)rkive.cf 2.2 2/23/91 X # X # An rkive.cf template. X # Copy and edit this to reflect the local archive conditions. --- 1,5 ---- X # ! # @(#)rkive.cf 2.3 5/9/91 X # X # An rkive.cf template. X # Copy and edit this to reflect the local archive conditions. *************** *** 82,94 **** X # the available selection format capabilities. X # COMPRESS - The location of the compression utility if the X # files are to be reduced. ! # CHECKHASH - The location of the checkhash utility if the SHAR_EOF true || echo 'restore of patch2.1 failed' fi echo 'End of part 2' echo 'File patch2.1 is continued in part 3' echo 3 > _shar_seq_.tmp exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.