summaryrefslogtreecommitdiffstats
path: root/net/sup/files/patch-ab
blob: 81ee00bc6d6228cec7c4490bc7a285dbbe148a47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
*** sup.1.orig	Sun Dec 10 14:50:16 1995
--- sup.1	Sun Dec 10 15:53:08 1995
***************
*** 716,723 ****
  .I list=<listname>
  to specify the list of files in the release.
  .I scan=<scanfile>
! must be used in multi-release collections that are scanned to keep
! the scan files for the different releases separate.
  .I host=<hostfile>
  to allow different host restrictions for this release.
  .I next=<release>
--- 716,725 ----
  .I list=<listname>
  to specify the list of files in the release.
  .I scan=<scanfile>
! tells supscan to generate 
! .B scanfile
! for this release.  Supscan will only generate scan files for releases that specify
! a scanfile or for collections that do not have a releases file.
  .I host=<hostfile>
  to allow different host restrictions for this release.
  .I next=<release>
***************
*** 725,731 ****
  be a combination of serveral other releases. If the same file appears in
  more than one chained release, the first one found will be used.
  If these files are not specified for a release the default names:
! prefix,list,scan and host will be used.
  .TP
  .B scan
  This file, created by
--- 727,733 ----
  be a combination of serveral other releases. If the same file appears in
  more than one chained release, the first one found will be used.
  If these files are not specified for a release the default names:
! prefix, list and host will be used.
  .TP
  .B scan
  This file, created by
***************
*** 931,937 ****
  for a collection
  .TP
  <\fIbase-directory\fR>\fB/sup/\fR<\fIcollection\fR>\fB/scan
! scan file for a collection
  .TP
  \fB/usr/\fR<\fIcollection\fR>
  default base directory for a file collection
--- 933,939 ----
  for a collection
  .TP
  <\fIbase-directory\fR>\fB/sup/\fR<\fIcollection\fR>\fB/scan
! default scan file for a collection if no release file exists
  .TP
  \fB/usr/\fR<\fIcollection\fR>
  default base directory for a file collection
*** supservers.8.orig	Sun Dec 10 15:45:47 1995
--- supservers.8	Sun Dec 10 15:48:15 1995
***************
*** 167,172 ****
--- 167,180 ----
  .I 
  supscan
  to produce output messages as it scans the files in the collection.
+ The "release" option
+ .I -r
+ causes
+ .I supscan
+ to only update the scan file for the specified release.  More than one
+ release may be specified by using
+ .I -r
+ multiple times.
  The "system" flag
  .I 
  -s
*** scan.c.orig	Mon Dec 11 23:52:54 1995
--- scan.c	Wed Dec 13 08:15:36 1995
***************
*** 183,189 ****
  static omitanyone();
  static anyglob();
  static int getscanfile();
! static chkscanfile();
  static makescanfile();
  static recordone();
  static recordexec();
--- 183,189 ----
  static omitanyone();
  static anyglob();
  static int getscanfile();
! static int chkscanfile();
  static makescanfile();
  static recordone();
  static recordexec();
***************
*** 322,334 ****
  	return (TRUE);
  }
  
! makescanlists ()
  {
  	TREELIST *tl;
  	char buf[STRINGLENGTH];
  	char *p,*q;
  	FILE *f;
  	char *saveprefix = prefix;
  	int count = 0;
  
  	(void) sprintf (buf,FILERELEASES,collname);
--- 322,336 ----
  	return (TRUE);
  }
  
! makescanlists (releases)
! 	char **releases;
  {
  	TREELIST *tl;
  	char buf[STRINGLENGTH];
  	char *p,*q;
  	FILE *f;
  	char *saveprefix = prefix;
+ 	char **rel_index;
  	int count = 0;
  
  	(void) sprintf (buf,FILERELEASES,collname);
***************
*** 347,360 ****
  					goaway ("Can't chdir to %s",prefix);
  				(void) chdir (basedir);
  			}
! 			makescan (tl->TLlist,tl->TLscan);
  			free ((char *)tl);
  			count++;
  		}
  		(void) fclose (f);
  	}
  	if (count == 0)
! 		makescan ((char *)NULL,(char *)NULL);
  }
  
  static
--- 349,374 ----
  					goaway ("Can't chdir to %s",prefix);
  				(void) chdir (basedir);
  			}
! 			if (releases)
! 			{
! 				rel_index = releases;
! 				while (*rel_index) {
! 					if (!strcmp (*rel_index, tl->TLname)) {
! 						makescan (tl->TLlist,tl->TLscan);
! 						break;
! 					}
! 					rel_index++;
! 				}
! 			}
! 			else
! 				makescan (tl->TLlist,tl->TLscan);
  			free ((char *)tl);
  			count++;
  		}
  		(void) fclose (f);
  	}
  	if (count == 0)
! 		makescan ((char *)NULL,FILESCANDEF);
  }
  
  static
***************
*** 400,409 ****
  char *listfile,*scanfile;
  {
  	listT = NULL;
! 	chkscanfile (scanfile);		/* can we can write a scan file? */
! 	doscan (listfile);		/* read list file and scan disk */
! 	makescanfile (scanfile);	/* record names in scan file */
! 	Tfree (&listT);			/* free file list tree */
  }
  
  static
--- 414,424 ----
  char *listfile,*scanfile;
  {
  	listT = NULL;
! 	if(chkscanfile (scanfile)) {	/* can we can write a scan file? */
! 		doscan (listfile);	/* read list file and scan disk */
! 		makescanfile (scanfile);/* record names in scan file */
! 		Tfree (&listT);		/* free file list tree */
! 	}
  }
  
  static
***************
*** 816,822 ****
  	register TREELIST *tl;
  
  	if (scanfile == NULL)
! 		scanfile = FILESCANDEF;
  	(void) sprintf (buf,FILESCAN,collname,scanfile);
  	if (stat(buf,&sbuf) < 0)
  		return (FALSE);
--- 831,837 ----
  	register TREELIST *tl;
  
  	if (scanfile == NULL)
! 		return(FALSE);
  	(void) sprintf (buf,FILESCAN,collname,scanfile);
  	if (stat(buf,&sbuf) < 0)
  		return (FALSE);
***************
*** 924,930 ****
  	FILE *f;
  
  	if (scanfile == NULL)
! 		scanfile = FILESCANDEF;
  	(void) sprintf (fname,FILESCAN,collname,scanfile);
  	(void) sprintf (tname,"%s.temp",fname);
  	if (NULL == (f = fopen (tname, "w")))
--- 939,945 ----
  	FILE *f;
  
  	if (scanfile == NULL)
! 		return(FALSE);
  	(void) sprintf (fname,FILESCAN,collname,scanfile);
  	(void) sprintf (tname,"%s.temp",fname);
  	if (NULL == (f = fopen (tname, "w")))
***************
*** 933,938 ****
--- 948,954 ----
  		(void) unlink (tname);
  		(void) fclose (f);
  	}
+ 	return(TRUE);
  }
  
  static makescanfile (scanfile)
***************
*** 943,950 ****
  	FILE *scanF;			/* output file for scanned file list */
  	int recordone ();
  
- 	if (scanfile == NULL)
- 		scanfile = FILESCANDEF;
  	(void) sprintf (fname,FILESCAN,collname,scanfile);
  	(void) sprintf (tname,"%s.temp",fname);
  	scanF = fopen (tname,"w");
--- 959,964 ----
*** supscan.c.orig	Fri Aug 20 19:46:35 1993
--- supscan.c	Sun May 30 22:17:04 1999
***************
*** 25,40 ****
  /*
   * supscan -- SUP Scan File Builder
   *
!  * Usage: supscan [ -v ] collection [ basedir ]
   *	  supscan [ -v ] -f dirfile
   *	  supscan [ -v ] -s
!  *	-f	"file" -- use dirfile instead of system coll.dir
!  *	-s	"system" -- perform scan for system supfile
!  *	-v	"verbose" -- print messages as you go
!  *	collection	-- name of the desired collection if not -s
!  *	basedir		-- name of the base directory, if not
!  *			   the default or recorded in coll.dir
!  *	dirfile		-- name of replacement for system coll.dir.
   *
   **********************************************************************
   * HISTORY
--- 25,42 ----
  /*
   * supscan -- SUP Scan File Builder
   *
!  * Usage: supscan [ -v ] collection [ -r release ] [ basedir ]
   *	  supscan [ -v ] -f dirfile
   *	  supscan [ -v ] -s
!  *	-f	"file"     -- use dirfile instead of system coll.dir
!  *	-r	"release"  -- scan only the specified release. Multiple
!  *			      releases can be specified.
!  *	-s	"system"   -- perform scan for system supfile
!  *	-v	"verbose"  -- print messages as you go
!  *	collection	   -- name of the desired collection if not -s
!  *	basedir		   -- name of the base directory, if not
!  *			      the default or recorded in coll.dir
!  *	dirfile		   -- name of replacement for system coll.dir.
   *
   **********************************************************************
   * HISTORY
***************
*** 158,163 ****
--- 160,167 ----
  char *collname;				/* collection name */
  char *basedir;				/* base directory name */
  char *prefix;				/* collection pathname prefix */
+ char **releases = NULL;			/* releases to scan */
+ int  numreleases = 0;			/* size of releases  */
  long lasttime = 0;			/* time of last upgrade */
  long scantime;				/* time of this scan */
  int newonly = FALSE;			/* new files only */
***************
*** 167,174 ****
  TREE *listT;		/* final list of files in collection */
  TREE *refuseT = NULL;	/* list of all files specified by <coll>.list */
  
- long time ();
- 
  /*************************************
   ***    M A I N   R O U T I N E    ***
   *************************************/
--- 171,176 ----
***************
*** 190,196 ****
  			ctime (&scantime));
  		(void) fflush (stdout);
  		if (!setjmp (sjbuf)) {
! 			makescanlists (); /* record names in scan files */
  			scantime = time ((long *)NULL);
  			printf ("SUP Scan for %s completed at %s",collname,
  				ctime (&scantime));
--- 192,199 ----
  			ctime (&scantime));
  		(void) fflush (stdout);
  		if (!setjmp (sjbuf)) {
! 			/* record names in scan files */
! 			makescanlists (releases);
  			scantime = time ((long *)NULL);
  			printf ("SUP Scan for %s completed at %s",collname,
  				ctime (&scantime));
***************
*** 215,223 ****
  
  usage ()
  {
! 	fprintf (stderr,"Usage: supscan [ -v ] collection [ basedir ]\n");
! 	fprintf (stderr,"       supscan [ -v ] -f dirfile\n");
! 	fprintf (stderr,"       supscan [ -v ] -s\n");
  	exit (1);
  }
  
--- 218,236 ----
  
  usage ()
  {
! 	fprintf(stderr,"Usage: supscan [ -v ] [ -r release ] collection [ basedir ]\n"
! 		"       supscan [ -v ] [ -r release ] -f dirfile\n"
! 		"       supscan [ -v ] [ -r release ] -s\n"
! 		"       supscan [ -v ] [ -r release ] -s\n"
! 		"        -f \"file\"    -- use dirfile instead of system coll.dir\n"
! 		"        -r \"release\" -- scan only the specified release. Multiple\n"
! 		"                        releases can be specified.\n"
! 		"        -s \"system\"  -- perform scan for system supfile\n"
! 		"        -v \"verbose\" -- print messages as you go\n" 
! 		"        collection   -- name of the desired collection if not -s\n"
! 		"        basedir      -- name of the base directory, if not\n"
! 		"                        the default or recorded in coll.dir\n"
! 		"        dirfile      -- name of replacement for system coll.dir.\n");
  	exit (1);
  }
  
***************
*** 243,248 ****
--- 256,278 ----
  			--argc;
  			argv++;
  			filename = argv[1];
+ 			break;
+ 		case 'r':
+ 			if (argc == 2)
+ 				usage ();
+ 			--argc;
+ 			argv++;
+ 			if (argv[1][0] == '-')
+ 				usage ();
+ 			numreleases++;
+ 			releases = (char **)realloc(releases,
+ 					   sizeof(*releases) * (numreleases+1));
+ 			if (!releases) {
+ 				fprintf(stderr,"supscan: cannot malloc!\n");
+ 				exit(1);
+ 			}
+ 			releases[numreleases - 1] = argv[1];
+ 			releases[numreleases] = NULL;
  			break;
  		case 'v':
  			trace = TRUE;
OpenPOWER on IntegriCloud