static char *sccsid
= "@(#)note.c 1.2 2/2/83";
* Take the given text, and make put it into the note file.
* make the note header record
* write the note header info
* rewrite the correct text header info
* Delnote(io, noteno): marks the status word as deleted.
* Original authors: Rob Kolstad and Ray Essick Winter 1980
* modified; Ray Essick December 1981
putnote (io
, where
, title
, status
, note
, auth
, policy
, lockit
, addid
, fromsys
, addtime
)
/* policy = true if this is the policy note */
/* addid = fales if we already have an id for the note */
/* addtime = false if we already have a time for the note */
char *fromsys
; /* whom we recieved it from (routing) */
note
->n_nresp
= 0; /* no responses yet */
if (addtime
) { /* dont if compressing... */
gettime(¬e
->n_lmod
); /* date of last mod is same */
copyauth(auth
, ¬e
->n_auth
); /* move author over */
strmove(fromsys
, note
->n_from
); /* who gave it to us */
note
->n_rindx
= -1; /* no place for responses yet */
note
->n_stat
= status
; /* director message, deleted, etc */
note
->n_addr
.addr
= where
->addr
; /* where on disk */
*p
++ = *title
++; /* move title over */
lock(io
, 'n'); /* CRITICAL */
getdscr(io
, &io
->descr
); /* grab notesfile header */
if (io
->descr
.d_stat
& NFINVALID
) {
unlock(io
, 'n'); /* CRITICAL */
opennf(io
, io
->nf
); /* get new links */
printf("Sorry, your note has been lost in a compression");
strmove(io
->descr
.d_id
.sys
, note
->n_id
.sys
);
note
->n_id
.uniqid
= ++(io
->descr
.d_id
.uniqid
);
note
->n_id
.uniqid
+= UNIQPLEX
* io
->descr
.d_nfnum
;
io
->descr
.d_plcy
= 1; /* mark as having a policy note */
notenum
= ++io
->descr
.d_nnote
; /* this note's number */
if (addtime
) { /* see if want timestamp */
gettime(&io
->descr
.d_lastm
); /* last time file modified */
putnrec(io
, notenum
, note
); /* write note info */
putdscr(io
, &io
->descr
); /* rewrite header info */
unlock(io
, 'n'); /* CRITICAL */
io
->nnotwrit
++; /* bump count of writes */
return(io
->descr
.d_nnote
); /* tell which slot it is in */
delnote (io
, noteno
, lockit
)
lock(io
, 'n'); /* CRITICAL */
getnrec(io
, noteno
, ¬e
); /* get the note */
note
.n_stat
|= DELETED
; /* deleted */
putnrec(io
, noteno
, ¬e
);
unlock(io
, 'n'); /* CRITICAL */