[net.notes] WAKEUP NOTES USERS, LETS TALK!

brad@bradley.UUCP (12/11/84)

I am looking for ideas on archiving notes.  Currently I use nfarchive and
when the disk gets full move them to '.../oldnotes.MMYY'  MM=month, YY=year,
and then 'tar c oldnnotes.MMYY' on to tape ( and remove ).

When I need to find something I pull the directory off of tape and use
'n' (in index page) and give the new notesfile
'/usr/spool/oldnotes.MMYY/net.sources' and I can read them that way.  What I
am looking for is a was to print the index of and notesfile given the path to
that notes file.

Does anyone have this?  Are there other things out there us notesfiles people
need?  Also what type of neat things do people have.

Lets wake up this group and get some discussion

Bradley Smith			UUCP: {cepu,ihnp4,noao,uiucdcs}!bradley!brad
Text Processing			ARPA: cepu!bradley!brad@UCLA-LOCUS
Bradley University		PH: (309) 676-7611 Ext. 446
Peoria, IL 61625

stein@fortune.UUCP (Mark Stein) (12/15/84)

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 <stdio.h>
#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

brad@bradley.UUCP (12/29/84)

In looking further into it.  The archive files on version 1.6.2.13
(which is the version we run) has archives the same as those not
archived.

In looking further I realized that 'nfprint' prints and index at the
end of it.  What I am going to do is hack around nfprint and its
calls to produce an 'nfindex' which will print an index. and some
how have this incorpated in to a database.

BTW: I am not sure what version that 1.3 is, but in my old version
     of notes, archives were stored in ascii format, where is the new
     version isn't.  Also the new version has less bugs and is faster
     even though it is larger and requires 2.9BSD to run on PDP 11's

Oh, I also made an 'nfcat', works like nfprint but no headers or index.
The reason?
	% nfcat net.mod.map 1-4,6-20 | sh

Makes breaking maps up nice.


Bradley Smith			UUCP: {cepu,ihnp4,noao,uiucdcs}!bradley!brad
Text Processing			ARPA: cepu!bradley!brad@UCLA-LOCUS
Bradley University		PH: (309) 676-7611 Ext. 446
Peoria, IL 61625