--- ray/src/px/pcompos.c 1991/05/31 10:21:31 1.9 +++ ray/src/px/pcompos.c 1992/06/22 14:14:40 2.6 @@ -14,6 +14,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" +#include "resolu.h" #define MAXFILE 32 @@ -69,7 +70,6 @@ main(argc, argv) int argc; char *argv[]; { - double atof(); int ncolumns = 0; int autolabel = 0; int curcol = 0, curx = 0, cury = 0; @@ -119,10 +119,7 @@ dofiles: for (nfile = 0; an < argc; nfile++) { if (nfile >= MAXFILE) goto toomany; - if (autolabel) - thislabel = argv[an]; - else - thislabel = NULL; + thislabel = NULL; input[nfile].hasmin = input[nfile].hasmax = 0; while (an < argc && (argv[an][0] == '-' || argv[an][0] == '+')) switch (argv[an][1]) { @@ -146,7 +143,8 @@ dofiles: case 'l': if (strcmp(argv[an], "-l")) goto userr; - thislabel = argv[++an]; + thislabel = argv[an+1]; + an += 2; break; case '\0': if (argv[an][0] == '-') @@ -158,14 +156,20 @@ dofiles: getfile: if (argc-an < (ncolumns ? 1 : 3)) goto userr; + if (autolabel && thislabel == NULL) + thislabel = argv[an]; if (!strcmp(argv[an], "-")) { input[nfile].name = ""; input[nfile].fp = stdin; } else { - input[nfile].name = argv[an]; - if ((input[nfile].fp = argv[an][0] == '!' ? - popen(argv[an]+1, "r") : - fopen(argv[an], "r")) == NULL) { + if (argv[an][0] == '!') { + input[nfile].name = ""; + input[nfile].fp = popen(argv[an]+1, "r"); + } else { + input[nfile].name = argv[an]; + input[nfile].fp = fopen(argv[an], "r"); + } + if (input[nfile].fp == NULL) { perror(argv[an]); quit(1); } @@ -181,7 +185,7 @@ getfile: } /* get picture size */ if (fgetresolu(&input[nfile].xres, &input[nfile].yres, - input[nfile].fp) != (YMAJOR|YDECR)) { + input[nfile].fp) < 0) { fprintf(stderr, "%s: bad picture size\n", input[nfile].name); quit(1); @@ -229,7 +233,8 @@ getfile: /* add new header info. */ printargs(argc, argv, stdout); fputformat(COLRFMT, stdout); - printf("\n-Y %d +X %d\n", ysiz, xsiz); + putchar('\n'); + fprtresolu(xsiz, ysiz, stdout); compos(); @@ -332,13 +337,12 @@ int *xp, *yp; char com[128]; FILE *fp; - sprintf(com, "psign -h %d '%.30s' | pfilt -1 -x /2 -y /2", - 2*labelht, s); + sprintf(com, "psign -s -.2 -h %d '%.30s'", labelht, s); if ((fp = popen(com, "r")) == NULL) return(NULL); if (checkheader(fp, COLRFMT, NULL) < 0) goto err; - if (fgetresolu(xp, yp, fp) != (YMAJOR|YDECR)) + if (fgetresolu(xp, yp, fp) < 0) goto err; return(fp); err: