displayq.c (79739) | displayq.c (80133) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35/* 36static char sccsid[] = "@(#)displayq.c 8.4 (Berkeley) 4/28/95"; 37*/ 38static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35/* 36static char sccsid[] = "@(#)displayq.c 8.4 (Berkeley) 4/28/95"; 37*/ 38static const char rcsid[] = |
39 "$FreeBSD: head/usr.sbin/lpr/common_source/displayq.c 79739 2001-07-15 00:09:46Z gad $"; | 39 "$FreeBSD: head/usr.sbin/lpr/common_source/displayq.c 80133 2001-07-22 07:25:27Z gad $"; |
40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44 45#include <ctype.h> 46#include <dirent.h> 47#include <errno.h> --- 284 unchanged lines hidden (view full) --- 332 col += 16; 333 first = 1; 334 } 335 continue; 336 default: /* some format specifer and file name? */ 337 if (line[0] < 'a' || line[0] > 'z') 338 break; 339 if (copycnt == 0 || strcmp(file, line+1) != 0) { | 40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44 45#include <ctype.h> 46#include <dirent.h> 47#include <errno.h> --- 284 unchanged lines hidden (view full) --- 332 col += 16; 333 first = 1; 334 } 335 continue; 336 default: /* some format specifer and file name? */ 337 if (line[0] < 'a' || line[0] > 'z') 338 break; 339 if (copycnt == 0 || strcmp(file, line+1) != 0) { |
340 strncpy(file, line + 1, sizeof(file) - 1); 341 file[sizeof(file) - 1] = '\0'; | 340 strlcpy(file, line + 1, sizeof(file)); |
342 } 343 copycnt++; 344 /* 345 * deliberately 'continue' to another getline(), so 346 * all format-spec lines for this datafile are read 347 * in and counted before calling show() 348 */ 349 continue; 350 case 'N': | 341 } 342 copycnt++; 343 /* 344 * deliberately 'continue' to another getline(), so 345 * all format-spec lines for this datafile are read 346 * in and counted before calling show() 347 */ 348 continue; 349 case 'N': |
351 strncpy(savedname, line + 1, sizeof(savedname) - 1); 352 savedname[sizeof(savedname) - 1] = '\0'; | 350 strlcpy(savedname, line + 1, sizeof(savedname)); |
353 break; 354 } 355 if ((file[0] != '\0') && (savedname[0] != '\0')) { 356 show(savedname, file, copycnt); 357 copycnt = 0; 358 file[0] = '\0'; 359 savedname[0] = '\0'; 360 } 361 } 362 fclose(cfp); 363 /* check for a file which hasn't been shown yet */ 364 if (file[0] != '\0') { 365 if (savedname[0] == '\0') { 366 /* a safeguard in case the N-ame line is missing */ | 351 break; 352 } 353 if ((file[0] != '\0') && (savedname[0] != '\0')) { 354 show(savedname, file, copycnt); 355 copycnt = 0; 356 file[0] = '\0'; 357 savedname[0] = '\0'; 358 } 359 } 360 fclose(cfp); 361 /* check for a file which hasn't been shown yet */ 362 if (file[0] != '\0') { 363 if (savedname[0] == '\0') { 364 /* a safeguard in case the N-ame line is missing */ |
367 strncpy(savedname, file, sizeof(savedname) - 1); 368 savedname[sizeof(savedname) - 1] = '\0'; | 365 strlcpy(savedname, file, sizeof(savedname)); |
369 } 370 show(savedname, file, copycnt); 371 } 372 if (!lflag) { 373 blankfill(SIZCOL); 374 printf("%ld bytes\n", totsize); 375 totsize = 0; 376 } --- 159 unchanged lines hidden --- | 366 } 367 show(savedname, file, copycnt); 368 } 369 if (!lflag) { 370 blankfill(SIZCOL); 371 printf("%ld bytes\n", totsize); 372 totsize = 0; 373 } --- 159 unchanged lines hidden --- |