1 /* bbtar.c - generate the names of archive files to be put to tape */
3 static char ident[] = "@(#)$Id: bbtar.c,v 1.6 1992/12/15 00:20:22 jromine Exp $";
8 % cd ~bboards/archive # followed by one of:
10 % tar cv `bbtar private` # to save private BBoard archives
11 % tar cv `bbtar public` # to save public BBoard archives
12 % tar cv `bbtar` # to save all BBoard archives
19 #include <sys/types.h>
21 #include "../zotnet/bboards.h"
29 static char archives[BUFSIZ];
35 struct passwd *getpwnam ();
50 if ((pw = getpwnam (BBOARDS)) == NULL)
52 (void) sprintf (archives, "%s/archive/", pw -> pw_dir);
55 priv = strcmp (argv[1], "private") == 0 ? 1
56 : strcmp (argv[1], "public") == 0 ? -1
59 (void) setbbent (SB_STAY);
60 while (bb = getbbent ())
74 if (stat (bb -> bb_archive, &st) == NOTOK)
76 if (strncmp (archives, bb -> bb_archive, strlen (archives)) == 0)
77 bb -> bb_archive += strlen (archives);
80 printf ("%s\n", bb -> bb_archive);
82 if ((st.st_mode & 0444) != 0444 ? (priv > 0) : (priv < 0))
83 printf ("%s\n", bb -> bb_archive);