|
|
1.1 ! root 1: #include "parms.h" ! 2: #include "structs.h" ! 3: ! 4: #ifdef RCSIDENT ! 5: static char rcsid[] = "$Header: delete.c,v 1.7 85/01/18 15:08:35 notes Rel $"; ! 6: #endif RCSIDENT ! 7: ! 8: /* ! 9: * mdelete(io, first, last) ! 10: * deletes all the notes in the specified range in the notefile. ! 11: * ! 12: * no verification of the desire to delete the notes is performed. ! 13: * It just goes and zaps them.. ! 14: * ! 15: * returns 0 if all goes well, -1 if it didn't like something ! 16: * ! 17: * Original coding: Ray Essick Jan 1982 ! 18: */ ! 19: mdelete (io, first, last, zapping) ! 20: struct io_f *io; ! 21: int first, ! 22: last, /* range */ ! 23: zapping; /* delete/undelete */ ! 24: { ! 25: int which; ! 26: struct note_f note; /* for undelete */ ! 27: ! 28: x (first > last, "mdelete: nonsense first/last"); ! 29: locknf (io, DSCRLOCK); /* lock for duration */ ! 30: getdscr (io, &io -> descr); ! 31: if (last > io -> descr.d_nnote) ! 32: last = io -> descr.d_nnote; ! 33: if (first > io -> descr.d_nnote) ! 34: first = io -> descr.d_nnote; ! 35: for (which = first; which <= last; which++) ! 36: { ! 37: if (zapping) /* deletion */ ! 38: { ! 39: delnote (io, which, NOLOCKIT); ! 40: } ! 41: else ! 42: { ! 43: getnrec (io, which, ¬e); /* get the note */ ! 44: note.n_stat &= NOT DELETED; /* un-deleted */ ! 45: putnrec (io, which, ¬e); ! 46: } ! 47: } ! 48: unlocknf (io, DSCRLOCK); /* release the lock */ ! 49: return 0; ! 50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.