1 |
– |
/* Copyright (c) 1992 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 |
|
* oki20.c - program to dump pixel file to OkiMate 20 printer. |
6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
< |
#ifdef MSDOS |
13 |
< |
#include <fcntl.h> |
14 |
< |
#endif |
9 |
> |
#include <time.h> |
10 |
|
|
11 |
+ |
#include "platform.h" |
12 |
+ |
#include "rtprocess.h" |
13 |
|
#include "color.h" |
14 |
|
#include "resolu.h" |
15 |
|
|
18 |
|
|
19 |
|
#define ASPECT (120./144.) /* pixel aspect ratio */ |
20 |
|
|
21 |
< |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
21 |
> |
#define FILTER "pfilt -1 -x %d -y %d -p %f",NCOLS,NROWS,ASPECT |
22 |
> |
#define FILTER_F "pfilt -1 -x %d -y %d -p %f \"%s\"",NCOLS,NROWS,ASPECT |
23 |
|
|
24 |
|
long lpat[NCOLS]; |
25 |
|
|
26 |
|
int dofilter = 0; /* filter through pfilt first? */ |
27 |
|
|
30 |
– |
extern FILE *popen(); |
28 |
|
|
32 |
– |
|
29 |
|
main(argc, argv) |
30 |
|
int argc; |
31 |
|
char *argv[]; |
32 |
|
{ |
33 |
|
int i, status = 0; |
34 |
< |
#ifdef MSDOS |
35 |
< |
extern int _fmode; |
36 |
< |
_fmode = O_BINARY; |
41 |
< |
setmode(fileno(stdin), O_BINARY); |
42 |
< |
setmode(fileno(stdout), O_BINARY); |
43 |
< |
#endif |
34 |
> |
SET_DEFAULT_BINARY(); |
35 |
> |
SET_FILE_BINARY(stdin); |
36 |
> |
SET_FILE_BINARY(stdout); |
37 |
|
if (argc > 1 && !strcmp(argv[1], "-p")) { |
38 |
|
dofilter++; |
39 |
|
argv++; argc--; |
50 |
|
printp(fname) /* print a picture */ |
51 |
|
char *fname; |
52 |
|
{ |
53 |
< |
char buf[64]; |
53 |
> |
char buf[PATH_MAX]; |
54 |
|
FILE *input; |
55 |
|
int xres, yres; |
56 |
|
COLR scanline[NCOLS]; |
58 |
|
|
59 |
|
if (dofilter) { |
60 |
|
if (fname == NULL) { |
61 |
< |
sprintf(buf, FILTER, ""); |
61 |
> |
sprintf(buf, FILTER); |
62 |
|
fname = "<stdin>"; |
63 |
|
} else |
64 |
< |
sprintf(buf, FILTER, fname); |
64 |
> |
sprintf(buf, FILTER_F, fname); |
65 |
|
if ((input = popen(buf, "r")) == NULL) { |
66 |
|
fprintf(stderr, "Cannot execute: %s\n", buf); |
67 |
|
return(-1); |