Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / support / bboards / RCS / bbtar.c,v
1 head    1.6;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.6
9 date    92.12.15.00.20.22;      author jromine; state Exp;
10 branches;
11 next    1.5;
12
13 1.5
14 date    92.02.03.17.51.44;      author jromine; state Exp;
15 branches;
16 next    1.4;
17
18 1.4
19 date    90.04.05.15.32.54;      author sources; state Exp;
20 branches;
21 next    1.3;
22
23 1.3
24 date    90.04.05.14.50.42;      author sources; state Exp;
25 branches;
26 next    1.2;
27
28 1.2
29 date    90.03.20.16.25.34;      author sources; state Exp;
30 branches;
31 next    1.1;
32
33 1.1
34 date    90.03.20.16.25.17;      author sources; state Exp;
35 branches;
36 next    ;
37
38
39 desc
40 @@
41
42
43 1.6
44 log
45 @endif sugar
46 @
47 text
48 @/* bbtar.c - generate the names of archive files to be put to tape */
49 #ifndef lint
50 static char ident[] = "@@(#)$Id: bbtar.c,v 1.5 1992/02/03 17:51:44 jromine Exp jromine $";
51 #endif  /* lint */
52
53 /* Usage:
54
55         % cd ~bboards/archive           # followed by one of:
56
57         % tar cv `bbtar private`        # to save private BBoard archives
58         % tar cv `bbtar public`         # to save public BBoard archives
59         % tar cv `bbtar`                # to save all BBoard archives
60
61  */
62
63
64 #include <pwd.h>
65 #include <stdio.h>
66 #include <sys/types.h>
67 #include <sys/stat.h>
68 #include "../zotnet/bboards.h"
69
70
71 #define NOTOK   (-1)
72
73
74 static int  priv = 0;
75
76 static char archives[BUFSIZ];
77
78 static  process();
79
80 #ifndef __STDC__
81 #ifdef  SYS5
82 struct passwd  *getpwnam ();
83 #endif
84 #endif
85
86 /* \f */
87
88 /* ARGSUSED */
89
90 main (argc, argv)
91 int     argc;
92 char  **argv;
93 {
94     struct bboard  *bb;
95     struct passwd  *pw;
96
97     if ((pw = getpwnam (BBOARDS)) == NULL)
98         exit (1);
99     (void) sprintf (archives, "%s/archive/", pw -> pw_dir);
100
101     if (argc > 1)
102         priv = strcmp (argv[1], "private") == 0 ? 1
103             : strcmp (argv[1], "public") == 0 ? -1
104             : 0;
105
106     (void) setbbent (SB_STAY);
107     while (bb = getbbent ())
108         process (bb);
109     (void) endbbent ();
110
111     exit (0);
112 }
113
114 /* \f */
115
116 static  process (bb)
117 struct bboard  *bb;
118 {
119     struct stat st;
120
121     if (stat (bb -> bb_archive, &st) == NOTOK)
122         return;
123     if (strncmp (archives, bb -> bb_archive, strlen (archives)) == 0)
124         bb -> bb_archive += strlen (archives);
125
126     if (priv == 0)
127         printf ("%s\n", bb -> bb_archive);
128     else
129         if ((st.st_mode & 0444) != 0444 ? (priv > 0) : (priv < 0))
130             printf ("%s\n", bb -> bb_archive);
131 }
132 @
133
134
135 1.5
136 log
137 @STDC
138 SYS5
139 @
140 text
141 @d3 2
142 a4 2
143 static char ident[] = "@@(#)$Id: bbtar.c,v 1.4 1990/04/05 15:32:54 sources Exp jromine $";
144 #endif  lint
145 @
146
147
148 1.4
149 log
150 @add ID
151 @
152 text
153 @d3 1
154 a3 1
155 static char ident[] = "@@(#)$Id:$";
156 d33 2
157 d36 2
158 @
159
160
161 1.3
162 log
163 @add ID
164 @
165 text
166 @d3 1
167 a3 1
168 static char ident[] = "$Id:";
169 @
170
171
172 1.2
173 log
174 @ansi fixup
175 @
176 text
177 @d2 3
178 @
179
180
181 1.1
182 log
183 @Initial revision
184 @
185 text
186 @d28 1
187 @