Aittvax.115
net.unix-wizards
utzoo!decvax!ittvax!swatt
Sun Aug 30 18:17:36 1981
recovering blown-away .nindex files
A while back, Mark at ucbvax mentioned that they had lost their
nindex file.  Well we just did too -- boy what a pain!.  If
any of you have run into that problem you might already have a
program that does this, but for the rest, here is some insurance.


       - Alan S. Watt (decvax!ittvax!swatt)

::::::::::::::::::
newsrecover.c:
::::::::::::::::::
/* Yuck, recover ".nindex" files that got clobbered by
* a news malfunction.
*
* Usage:
*      newsrecover [-submit]
*
*      -submit argument causes date to be taken from the submission
*      date of article, file modification time otherwise.
*/
#include <STDIO.H>
#include <SYS/TYPES.H>
#include <DIR.H>
#include <STAT.H>

#ifndef NEWSDIR
# define NEWSDIR        "/usr/spool/news"
#endif

#ifdef lint
# define IGNORE(X)      __void__=(int)(X)
 int __void__;
#else
# define IGNORE(X)      X
#endif
#define EOS     '\0'
#define NO      0
#define YES     1

char    newsdir[]       = NEWSDIR;
struct {
       char    fmtid[80];
       char    ngrp[80];
       char    contrb[80];
       char    date[32];
} H;
char *index(), *rindex();
int submit = NO;

main(argc, argv)
char **argv;
{
       long timeret, timenow;
       register FILE *filef, *dirf;
       struct dir dirbuf;
       struct stat sb;

       if (argc > 1 && strcmp (argv[1], "-submit") == 0)
               submit = YES;
       IGNORE (time (&timenow));
       if (chdir (newsdir))
               fperror ("cannot change directory to %s", newsdir);
       if ((dirf = fopen (".", "r"))
<HR>
This Usenet Oldnews Archive
article may be copied and distributed freely, provided:
<P>
1. There is no money collected for the text(s) of the articles.
<BR>
2. The following notice remains appended to each copy:
<P>
<EM>The Usenet Oldnews Archive: Compilation Copyright&copy 1981, 1996
<BR> Bruce Jones, Henry Spencer, David Wiseman.</EM>
<P>
<HR>
Goto <A HREF="81.08.31_duke.1025_net.unix-wizards.html">NEXT</A> article in NET.unix-wizards Newsgroup
<BR>Return to <A HREF="NET.unix-wizards-index.html">NET.unix-wizards index</A>
<BR>Return to the
       <A HREF="../index.html">Usenet Oldnews Archive index</A>
</HTML>

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.