head 1.6; access; symbols; locks; strict; comment @ * @; 1.6 date 92.12.15.00.20.22; author jromine; state Exp; branches; next 1.5; 1.5 date 92.02.03.17.51.44; author jromine; state Exp; branches; next 1.4; 1.4 date 90.04.05.15.32.54; author sources; state Exp; branches; next 1.3; 1.3 date 90.04.05.14.50.42; author sources; state Exp; branches; next 1.2; 1.2 date 90.03.20.16.25.34; author sources; state Exp; branches; next 1.1; 1.1 date 90.03.20.16.25.17; author sources; state Exp; branches; next ; desc @@ 1.6 log @endif sugar @ text @/* bbtar.c - generate the names of archive files to be put to tape */ #ifndef lint static char ident[] = "@@(#)$Id: bbtar.c,v 1.5 1992/02/03 17:51:44 jromine Exp jromine $"; #endif /* lint */ /* Usage: % cd ~bboards/archive # followed by one of: % tar cv `bbtar private` # to save private BBoard archives % tar cv `bbtar public` # to save public BBoard archives % tar cv `bbtar` # to save all BBoard archives */ #include #include #include #include #include "../zotnet/bboards.h" #define NOTOK (-1) static int priv = 0; static char archives[BUFSIZ]; static process(); #ifndef __STDC__ #ifdef SYS5 struct passwd *getpwnam (); #endif #endif /* */ /* ARGSUSED */ main (argc, argv) int argc; char **argv; { struct bboard *bb; struct passwd *pw; if ((pw = getpwnam (BBOARDS)) == NULL) exit (1); (void) sprintf (archives, "%s/archive/", pw -> pw_dir); if (argc > 1) priv = strcmp (argv[1], "private") == 0 ? 1 : strcmp (argv[1], "public") == 0 ? -1 : 0; (void) setbbent (SB_STAY); while (bb = getbbent ()) process (bb); (void) endbbent (); exit (0); } /* */ static process (bb) struct bboard *bb; { struct stat st; if (stat (bb -> bb_archive, &st) == NOTOK) return; if (strncmp (archives, bb -> bb_archive, strlen (archives)) == 0) bb -> bb_archive += strlen (archives); if (priv == 0) printf ("%s\n", bb -> bb_archive); else if ((st.st_mode & 0444) != 0444 ? (priv > 0) : (priv < 0)) printf ("%s\n", bb -> bb_archive); } @ 1.5 log @STDC SYS5 @ text @d3 2 a4 2 static char ident[] = "@@(#)$Id: bbtar.c,v 1.4 1990/04/05 15:32:54 sources Exp jromine $"; #endif lint @ 1.4 log @add ID @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id:$"; d33 2 d36 2 @ 1.3 log @add ID @ text @d3 1 a3 1 static char ident[] = "$Id:"; @ 1.2 log @ansi fixup @ text @d2 3 @ 1.1 log @Initial revision @ text @d28 1 @