1 |
– |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Generate sections of a picture. |
6 |
|
*/ |
22 |
|
#include <signal.h> |
23 |
|
#include "color.h" |
24 |
|
#include "view.h" |
28 |
– |
#include "resolu.h" |
25 |
|
|
26 |
|
#ifndef NFS |
27 |
|
#define NFS 1 |
44 |
|
#define unguard() 0 |
45 |
|
#endif |
46 |
|
|
47 |
< |
#ifndef linux |
52 |
< |
extern char *sys_errlist[]; |
53 |
< |
#endif |
47 |
> |
extern char *strerror(); |
48 |
|
|
49 |
|
/* rpict command */ |
50 |
|
char *rpargv[128] = {"rpict", "-S", "1"}; |
84 |
|
progname = argv[0]; |
85 |
|
for (i = 1; i < argc; i++) { |
86 |
|
/* expand arguments */ |
87 |
< |
while (rval = expandarg(&argc, &argv, i)) |
88 |
< |
if (rval < 0) { |
89 |
< |
fprintf(stderr, "%s: cannot expand '%s'", |
90 |
< |
argv[0], argv[i]); |
91 |
< |
exit(1); |
92 |
< |
} |
87 |
> |
while ((rval = expandarg(&argc, &argv, i)) > 0) |
88 |
> |
; |
89 |
> |
if (rval < 0) { |
90 |
> |
fprintf(stderr, "%s: cannot expand '%s'", |
91 |
> |
argv[0], argv[i]); |
92 |
> |
exit(1); |
93 |
> |
} |
94 |
|
if (argv[i][0] == '-') |
95 |
|
switch (argv[i][1]) { |
96 |
|
case 'v': |
195 |
|
fls.l_type = ltyp; |
196 |
|
if (fcntl(fd, F_SETLKW, &fls) < 0) { |
197 |
|
fprintf(stderr, "%s: cannot lock/unlock file: %s\n", |
198 |
< |
progname, sys_errlist[errno]); |
198 |
> |
progname, strerror(errno)); |
199 |
|
exit(1); |
200 |
|
} |
201 |
|
} |
503 |
|
filerr("lock"); |
504 |
|
#endif |
505 |
|
/* write new piece to file */ |
506 |
< |
if (lseek(outfd, fls.l_start, 0) < 0) |
506 |
> |
if (lseek(outfd, (off_t)fls.l_start, 0) < 0) |
507 |
|
filerr("seek"); |
508 |
|
if (hmult == 1) { |
509 |
|
if (writebuf(outfd, (char *)pbuf, |
515 |
|
hr*sizeof(COLR)) != hr*sizeof(COLR)) |
516 |
|
filerr("write"); |
517 |
|
if (y < vr-1 && lseek(outfd, |
518 |
< |
(long)(hmult-1)*hr*sizeof(COLR), |
518 |
> |
(off_t)(hmult-1)*hr*sizeof(COLR), |
519 |
|
1) < 0) |
520 |
|
filerr("seek"); |
521 |
|
} |
546 |
|
char *t; |
547 |
|
{ |
548 |
|
fprintf(stderr, "%s: %s error on file \"%s\": %s\n", |
549 |
< |
progname, t, outfile, sys_errlist[errno]); |
549 |
> |
progname, t, outfile, strerror(errno)); |
550 |
|
_exit(1); |
551 |
|
} |
552 |
|
|