pr.c (24360) | pr.c (37262) |
---|---|
1/*- 2 * Copyright (c) 1991 Keith Muller. 3 * Copyright (c) 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Keith Muller of the University of California, San Diego. 8 * --- 1241 unchanged lines hidden (view full) --- 1250 int argc; 1251 char **argv; 1252 char **fname; 1253 char *buf; 1254 int dt; 1255{ 1256 FILE *inf = NULL; 1257 struct timeval tv; | 1/*- 2 * Copyright (c) 1991 Keith Muller. 3 * Copyright (c) 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Keith Muller of the University of California, San Diego. 8 * --- 1241 unchanged lines hidden (view full) --- 1250 int argc; 1251 char **argv; 1252 char **fname; 1253 char *buf; 1254 int dt; 1255{ 1256 FILE *inf = NULL; 1257 struct timeval tv; |
1258 time_t tv_sec; |
|
1258 struct timezone tz; 1259 struct tm *timeptr = NULL; 1260 struct stat statbuf; 1261 static int twice = -1; 1262 1263 ++twice; 1264 if (eoptind >= argc) { 1265 /* --- 11 unchanged lines hidden (view full) --- 1277 return(inf); 1278 if (gettimeofday(&tv, &tz) < 0) { 1279 ++errcnt; 1280 (void)fprintf(err, "pr: cannot get time of day, %s\n", 1281 strerror(errno)); 1282 eoptind = argc - 1; 1283 return(NULL); 1284 } | 1259 struct timezone tz; 1260 struct tm *timeptr = NULL; 1261 struct stat statbuf; 1262 static int twice = -1; 1263 1264 ++twice; 1265 if (eoptind >= argc) { 1266 /* --- 11 unchanged lines hidden (view full) --- 1278 return(inf); 1279 if (gettimeofday(&tv, &tz) < 0) { 1280 ++errcnt; 1281 (void)fprintf(err, "pr: cannot get time of day, %s\n", 1282 strerror(errno)); 1283 eoptind = argc - 1; 1284 return(NULL); 1285 } |
1285 timeptr = localtime(&(tv.tv_sec)); | 1286 tv_sec = tv.tv_sec; 1287 timeptr = localtime(&tv_sec); |
1286 } 1287 for (; eoptind < argc; ++eoptind) { 1288 if (strcmp(argv[eoptind], "-") == 0) { 1289 /* 1290 * process a "-" for filename 1291 */ 1292 clearerr(stdin); 1293 inf = stdin; --- 6 unchanged lines hidden (view full) --- 1300 return(inf); 1301 if (gettimeofday(&tv, &tz) < 0) { 1302 ++errcnt; 1303 (void)fprintf(err, 1304 "pr: cannot get time of day, %s\n", 1305 strerror(errno)); 1306 return(NULL); 1307 } | 1288 } 1289 for (; eoptind < argc; ++eoptind) { 1290 if (strcmp(argv[eoptind], "-") == 0) { 1291 /* 1292 * process a "-" for filename 1293 */ 1294 clearerr(stdin); 1295 inf = stdin; --- 6 unchanged lines hidden (view full) --- 1302 return(inf); 1303 if (gettimeofday(&tv, &tz) < 0) { 1304 ++errcnt; 1305 (void)fprintf(err, 1306 "pr: cannot get time of day, %s\n", 1307 strerror(errno)); 1308 return(NULL); 1309 } |
1308 timeptr = localtime(&(tv.tv_sec)); | 1310 tv_sec = tv.tv_sec; 1311 timeptr = localtime(&tv_sec); |
1309 } else { 1310 /* 1311 * normal file processing 1312 */ 1313 if ((inf = fopen(argv[eoptind], "r")) == NULL) { 1314 ++errcnt; 1315 if (nodiag) 1316 continue; --- 14 unchanged lines hidden (view full) --- 1331 if (dt) { 1332 if (gettimeofday(&tv, &tz) < 0) { 1333 ++errcnt; 1334 (void)fprintf(err, 1335 "pr: cannot get time of day, %s\n", 1336 strerror(errno)); 1337 return(NULL); 1338 } | 1312 } else { 1313 /* 1314 * normal file processing 1315 */ 1316 if ((inf = fopen(argv[eoptind], "r")) == NULL) { 1317 ++errcnt; 1318 if (nodiag) 1319 continue; --- 14 unchanged lines hidden (view full) --- 1334 if (dt) { 1335 if (gettimeofday(&tv, &tz) < 0) { 1336 ++errcnt; 1337 (void)fprintf(err, 1338 "pr: cannot get time of day, %s\n", 1339 strerror(errno)); 1340 return(NULL); 1341 } |
1339 timeptr = localtime(&(tv.tv_sec)); | 1342 tv_sec = tv.tv_sec; 1343 timeptr = localtime(&tv_sec); |
1340 } else { 1341 if (fstat(fileno(inf), &statbuf) < 0) { 1342 ++errcnt; 1343 (void)fclose(inf); 1344 (void)fprintf(err, 1345 "pr: Cannot stat %s, %s\n", 1346 argv[eoptind], strerror(errno)); 1347 return(NULL); --- 463 unchanged lines hidden --- | 1344 } else { 1345 if (fstat(fileno(inf), &statbuf) < 0) { 1346 ++errcnt; 1347 (void)fclose(inf); 1348 (void)fprintf(err, 1349 "pr: Cannot stat %s, %s\n", 1350 argv[eoptind], strerror(errno)); 1351 return(NULL); --- 463 unchanged lines hidden --- |