Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site fortune.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!fortune!stein From: stein@fortune.UUCP (Mark Stein) Newsgroups: net.notes Subject: Re: WAKEUP NOTES USERS, LETS TALK! Message-ID: <4803@fortune.UUCP> Date: Fri, 14-Dec-84 21:17:02 EST Article-I.D.: fortune.4803 Posted: Fri Dec 14 21:17:02 1984 Date-Received: Sat, 15-Dec-84 05:45:11 EST References: <1500004@bradley.UUCP> Organization: Fortune Systems, Redwood City, CA Lines: 168 When we ran notes here, I wrote a program which would create an index from the archive file. The index file remained on-line, even when the archives themselves were moved to tape. This was written for notesfiles version 1.3, and I'm not sure whether it will work for current releases. Three files are included: .index shell script run after nfarchive, invokes .lookat .lookat interface to .nfindex nfindex.c Actually does the index, invoked as '.nfindex' All three files live in /usr/spool/oldnotes. There are probably better ways to do this, but it worked ok for us. Mark Stein Fortune Systems {ihnp4,amdcad,hpda,sri-unix}!fortune!stein ===== shar format ====== cut here ========================================= echo x nfindex.c cat << __EOF__ > nfindex.c /* * program to print out useful index information for a notesfile * archive file. Based on notesfiles release 1.3. * * Mark Stein * Fortune Systems Corp * 1 March 1983 */ #include#define FSIZE 50 #define CATCH 0 #define IGNORE 1 #define NEXT nextfld(buf, CATCH) #define VAL(x) x = atoi(NEXT) #define STR(x) strcpy(x, NEXT) #define TITLE(x) strcpy(x, nextfld(buf, IGNORE)) #define SKIP(x) NEXT char buf[BUFSIZ]; main(argc, argv) char *argv[]; { int txtlen, resp, ret, ij, id; int year, month, day; char c, type, cj[FSIZE]; char sys[FSIZE], title[FSIZE], auth[FSIZE]; extern char *nextfld(); while ((type = getchar()) != EOF) { #ifdef DEBUG printf("header: read type = '%c'\n", type); #endif switch (type) { case 'N': STR(sys); VAL(id); VAL(resp); TITLE(title); STR(auth); SKIP(uid); VAL(year); VAL(month); VAL(day); SKIP(hour); SKIP(min); SKIP(n_stat); VAL(txtlen); printf("%02d/%02d/%d: %10d %s (%d resp)\n", month, day, year-1900, id, title, resp); rid(txtlen); break; case 'R': gets(buf); /* rest of first line */ gets(buf); /* author line */ gets(buf); /* date line */ gets(buf); /* size line */ ret = sscanf(buf, "%o:%d", &ij, &txtlen); if (ret != 2) fmterr("R header"); rid(txtlen); break; default: fmterr("unknown header"); } } } rid(count) { int rdcount, ret; #ifdef DEBUG printf("rid: flushing %d bytes: ", count); #endif while (count) { rdcount = (count < BUFSIZ? count : BUFSIZ); #ifdef DEBUG printf(" (%d)", rdcount); #endif ret = fread(buf, 1, rdcount, stdin); if (ret == 0) fmterr("unexpected eof"); count -= ret; } #ifdef DEBUG putchar('\n'); #endif } fmterr(s) char *s; { printf("Input format error (%s)\n", s); exit(1); } char *nextfld(s, flag) char *s; { char c; char *sret = s; if ((c = getchar()) != ':') *s++ = c; while (1) { switch (c = getchar()) { case EOF: fmterr("unexpected eof in header"); break; case ':': if (flag == IGNORE) goto store; /* else fall through to... */ case '\n': *s = '\0'; #ifdef DEBUG printf("nextfld: found '%s'\n", sret); #endif return sret; default: store: *s++ = c; } } } __EOF__ echo x .index cat << __EOF__ > .index #! /bin/csh -f # .INDEX is an empty file used as a time stamp cd /usr/spool/oldnotes foreach A (*) set log = $A/index eval test -f $log if ($status == 1) cp -tV .INDEX $log find $A -name "8*" -a -newer $log -a -exec .lookat {} $log \; end touch .INDEX __EOF__ echo x .lookat cat << __EOF__ > .lookat echo -----$1----- >> $2 .nfindex < $1 >> $2 __EOF__ echo end of shar