]>
git.ipfire.org Git - thirdparty/cups.git/blob - filter/imagetops.c
4 * Image file to PostScript filter for CUPS.
6 * Copyright 2007-2010 by Apple Inc.
7 * Copyright 1993-2007 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
15 * This file is subject to the Apple OS-Developed Software exception.
19 * main() - Main entry...
20 * ps_hex() - Print binary data as a series of hexadecimal numbers.
21 * ps_ascii85() - Print binary data as a series of base-85 numbers.
25 * Include necessary headers...
31 #include <cups/language-private.h>
38 int Flip
= 0, /* Flip/mirror pages */
39 XPosition
= 0, /* Horizontal position on page */
40 YPosition
= 0, /* Vertical position on page */
41 Collate
= 0, /* Collate copies? */
42 Copies
= 1; /* Number of copies */
49 static void ps_hex(cups_ib_t
*, int, int);
50 static void ps_ascii85(cups_ib_t
*, int, int);
54 * 'main()' - Main entry...
57 int /* O - Exit status */
58 main(int argc
, /* I - Number of command-line arguments */
59 char *argv
[]) /* I - Command-line arguments */
61 cups_image_t
*img
; /* Image to print */
62 float xprint
, /* Printable area */
64 xinches
, /* Total size in inches */
66 float xsize
, /* Total size in points */
70 float aspect
; /* Aspect ratio */
71 int xpages
, /* # x pages */
72 ypages
, /* # y pages */
73 xpage
, /* Current x page */
74 ypage
, /* Current y page */
75 page
; /* Current page number */
76 int xc0
, yc0
, /* Corners of the page in image coords */
78 cups_ib_t
*row
; /* Current row */
79 int y
; /* Current Y coordinate in image */
80 int colorspace
; /* Output colorspace */
81 int out_offset
, /* Offset into output buffer */
82 out_length
; /* Length of output buffer */
83 ppd_file_t
*ppd
; /* PPD file */
84 ppd_choice_t
*choice
; /* PPD option choice */
85 int num_options
; /* Number of print options */
86 cups_option_t
*options
; /* Print options */
87 const char *val
; /* Option value */
88 int slowcollate
; /* Collate copies the slow way */
89 float g
; /* Gamma correction value */
90 float b
; /* Brightness factor */
91 float zoom
; /* Zoom facter */
92 int xppi
, yppi
; /* Pixels-per-inch */
93 int hue
, sat
; /* Hue and saturation adjustment */
94 int realcopies
, /* Real copies being printed */
95 emit_jcl
; /* Emit JCL? */
96 float left
, top
; /* Left and top of image */
97 char filename
[1024]; /* Name of file to print */
98 time_t curtime
; /* Current time */
99 struct tm
*curtm
; /* Current date */
100 char curdate
[255]; /* Current date string */
104 * Make sure status messages are not buffered...
107 setbuf(stderr
, NULL
);
110 * Check command-line...
113 if (argc
< 6 || argc
> 7)
115 _cupsLangPrintf(stderr
,
116 _("Usage: %s job-id user title copies options file"),
122 * Copy stdin as needed...
127 int fd
; /* File to write to */
128 char buffer
[8192]; /* Buffer to read into */
129 int bytes
; /* # of bytes to read */
132 if ((fd
= cupsTempFd(filename
, sizeof(filename
))) < 0)
134 _cupsLangPrintError("ERROR", _("Unable to copy print file"));
138 fprintf(stderr
, "DEBUG: imagetops - copying to temp print file \"%s\".\n",
141 while ((bytes
= fread(buffer
, 1, sizeof(buffer
), stdin
)) > 0)
142 write(fd
, buffer
, bytes
);
147 strlcpy(filename
, argv
[6], sizeof(filename
));
150 * Process command-line options and write the prolog...
161 Copies
= atoi(argv
[4]);
164 num_options
= cupsParseOptions(argv
[5], 0, &options
);
166 ppd
= SetCommonOptions(num_options
, options
, 0);
168 if ((val
= cupsGetOption("multiple-document-handling", num_options
, options
)) != NULL
)
171 * This IPP attribute is unnecessarily complicated...
173 * single-document, separate-documents-collated-copies, and
174 * single-document-new-sheet all require collated copies.
176 * separate-documents-uncollated-copies allows for uncollated copies.
179 Collate
= strcasecmp(val
, "separate-documents-uncollated-copies") != 0;
182 if ((val
= cupsGetOption("Collate", num_options
, options
)) != NULL
&&
183 strcasecmp(val
, "True") == 0)
186 if ((val
= cupsGetOption("gamma", num_options
, options
)) != NULL
)
189 * Get gamma value from 1 to 10000...
192 g
= atoi(val
) * 0.001f
;
200 if ((val
= cupsGetOption("brightness", num_options
, options
)) != NULL
)
203 * Get brightness value from 10 to 1000.
206 b
= atoi(val
) * 0.01f
;
214 if ((val
= cupsGetOption("scaling", num_options
, options
)) != NULL
)
215 zoom
= atoi(val
) * 0.01;
216 else if ((val
= cupsGetOption("fitplot", num_options
, options
)) != NULL
&&
217 !strcasecmp(val
, "true"))
219 else if ((val
= cupsGetOption("fit-to-page", num_options
, options
)) != NULL
&&
220 !strcasecmp(val
, "true"))
223 if ((val
= cupsGetOption("ppi", num_options
, options
)) != NULL
)
224 if (sscanf(val
, "%dx%d", &xppi
, &yppi
) < 2)
227 if ((val
= cupsGetOption("position", num_options
, options
)) != NULL
)
229 if (strcasecmp(val
, "center") == 0)
234 else if (strcasecmp(val
, "top") == 0)
239 else if (strcasecmp(val
, "left") == 0)
244 else if (strcasecmp(val
, "right") == 0)
249 else if (strcasecmp(val
, "top-left") == 0)
254 else if (strcasecmp(val
, "top-right") == 0)
259 else if (strcasecmp(val
, "bottom") == 0)
264 else if (strcasecmp(val
, "bottom-left") == 0)
269 else if (strcasecmp(val
, "bottom-right") == 0)
276 if ((val
= cupsGetOption("saturation", num_options
, options
)) != NULL
)
279 if ((val
= cupsGetOption("hue", num_options
, options
)) != NULL
)
282 if ((choice
= ppdFindMarkedChoice(ppd
, "MirrorPrint")) != NULL
)
284 val
= choice
->choice
;
288 val
= cupsGetOption("mirror", num_options
, options
);
290 if (val
&& (!strcasecmp(val
, "true") || !strcasecmp(val
, "on") ||
291 !strcasecmp(val
, "yes")))
294 if ((val
= cupsGetOption("emit-jcl", num_options
, options
)) != NULL
&&
295 (!strcasecmp(val
, "false") || !strcasecmp(val
, "off") ||
296 !strcasecmp(val
, "no") || !strcmp(val
, "0")))
302 * Open the input image to print...
305 colorspace
= ColorDevice
? CUPS_IMAGE_RGB_CMYK
: CUPS_IMAGE_WHITE
;
307 img
= cupsImageOpen(filename
, colorspace
, CUPS_IMAGE_WHITE
, sat
, hue
, NULL
);
314 _cupsLangPrintFilter(stderr
, "ERROR",
315 _("The print file could not be opened."));
320 colorspace
= cupsImageGetColorSpace(img
);
323 * Scale as necessary...
326 if (zoom
== 0.0 && xppi
== 0)
328 xppi
= cupsImageGetXPPI(img
);
329 yppi
= cupsImageGetYPPI(img
);
335 fprintf(stderr
, "DEBUG: Before scaling: xppi=%d, yppi=%d, zoom=%.2f\n",
341 * Scale the image as neccesary to match the desired pixels-per-inch.
346 xprint
= (PageTop
- PageBottom
) / 72.0;
347 yprint
= (PageRight
- PageLeft
) / 72.0;
351 xprint
= (PageRight
- PageLeft
) / 72.0;
352 yprint
= (PageTop
- PageBottom
) / 72.0;
355 fprintf(stderr
, "DEBUG: Before scaling: xprint=%.1f, yprint=%.1f\n",
358 xinches
= (float)cupsImageGetWidth(img
) / (float)xppi
;
359 yinches
= (float)cupsImageGetHeight(img
) / (float)yppi
;
361 fprintf(stderr
, "DEBUG: Image size is %.1f x %.1f inches...\n",
364 if ((val
= cupsGetOption("natural-scaling", num_options
, options
)) != NULL
)
366 xinches
= xinches
* atoi(val
) / 100;
367 yinches
= yinches
* atoi(val
) / 100;
370 if (cupsGetOption("orientation-requested", num_options
, options
) == NULL
&&
371 cupsGetOption("landscape", num_options
, options
) == NULL
)
374 * Rotate the image if it will fit landscape but not portrait...
377 fputs("DEBUG: Auto orientation...\n", stderr
);
379 if ((xinches
> xprint
|| yinches
> yprint
) &&
380 xinches
<= yprint
&& yinches
<= xprint
)
383 * Rotate the image as needed...
386 fputs("DEBUG: Using landscape orientation...\n", stderr
);
388 Orientation
= (Orientation
+ 1) & 3;
398 * Scale percentage of page size...
401 xprint
= (PageRight
- PageLeft
) / 72.0;
402 yprint
= (PageTop
- PageBottom
) / 72.0;
403 aspect
= (float)cupsImageGetYPPI(img
) / (float)cupsImageGetXPPI(img
);
405 fprintf(stderr
, "DEBUG: Before scaling: xprint=%.1f, yprint=%.1f\n",
408 fprintf(stderr
, "DEBUG: cupsImageGetXPPI(img) = %d, cupsImageGetYPPI(img) = %d, aspect = %f\n",
409 cupsImageGetXPPI(img
), cupsImageGetYPPI(img
), aspect
);
411 xsize
= xprint
* zoom
;
412 ysize
= xsize
* cupsImageGetHeight(img
) / cupsImageGetWidth(img
) / aspect
;
414 if (ysize
> (yprint
* zoom
))
416 ysize
= yprint
* zoom
;
417 xsize
= ysize
* cupsImageGetWidth(img
) * aspect
/ cupsImageGetHeight(img
);
420 xsize2
= yprint
* zoom
;
421 ysize2
= xsize2
* cupsImageGetHeight(img
) / cupsImageGetWidth(img
) / aspect
;
423 if (ysize2
> (xprint
* zoom
))
425 ysize2
= xprint
* zoom
;
426 xsize2
= ysize2
* cupsImageGetWidth(img
) * aspect
/ cupsImageGetHeight(img
);
429 fprintf(stderr
, "DEBUG: Portrait size is %.2f x %.2f inches\n", xsize
, ysize
);
430 fprintf(stderr
, "DEBUG: Landscape size is %.2f x %.2f inches\n", xsize2
, ysize2
);
432 if (cupsGetOption("orientation-requested", num_options
, options
) == NULL
&&
433 cupsGetOption("landscape", num_options
, options
) == NULL
)
436 * Choose the rotation with the largest area, but prefer
437 * portrait if they are equal...
440 fputs("DEBUG: Auto orientation...\n", stderr
);
442 if ((xsize
* ysize
) < (xsize2
* xsize2
))
445 * Do landscape orientation...
448 fputs("DEBUG: Using landscape orientation...\n", stderr
);
453 xprint
= (PageTop
- PageBottom
) / 72.0;
454 yprint
= (PageRight
- PageLeft
) / 72.0;
459 * Do portrait orientation...
462 fputs("DEBUG: Using portrait orientation...\n", stderr
);
469 else if (Orientation
& 1)
471 fputs("DEBUG: Using landscape orientation...\n", stderr
);
475 xprint
= (PageTop
- PageBottom
) / 72.0;
476 yprint
= (PageRight
- PageLeft
) / 72.0;
480 fputs("DEBUG: Using portrait orientation...\n", stderr
);
484 xprint
= (PageRight
- PageLeft
) / 72.0;
485 yprint
= (PageTop
- PageBottom
) / 72.0;
490 * Compute the number of pages to print and the size of the image on each
494 xpages
= ceil(xinches
/ xprint
);
495 ypages
= ceil(yinches
/ yprint
);
497 xprint
= xinches
/ xpages
;
498 yprint
= yinches
/ ypages
;
500 fprintf(stderr
, "DEBUG: xpages = %dx%.2fin, ypages = %dx%.2fin\n",
501 xpages
, xprint
, ypages
, yprint
);
504 * Update the page size for custom sizes...
507 if ((choice
= ppdFindMarkedChoice(ppd
, "PageSize")) != NULL
&&
508 strcasecmp(choice
->choice
, "Custom") == 0)
510 float width
, /* New width in points */
511 length
; /* New length in points */
512 char s
[255]; /* New custom page size... */
516 * Use the correct width and length for the current orientation...
521 width
= yprint
* 72.0;
522 length
= xprint
* 72.0;
526 width
= xprint
* 72.0;
527 length
= yprint
* 72.0;
531 * Add margins to page size...
534 width
+= ppd
->custom_margins
[0] + ppd
->custom_margins
[2];
535 length
+= ppd
->custom_margins
[1] + ppd
->custom_margins
[3];
538 * Enforce minimums...
541 if (width
< ppd
->custom_min
[0])
542 width
= ppd
->custom_min
[0];
544 if (length
< ppd
->custom_min
[1])
545 length
= ppd
->custom_min
[1];
547 fprintf(stderr
, "DEBUG: Updated custom page size to %.2f x %.2f inches...\n",
548 width
/ 72.0, length
/ 72.0);
551 * Set the new custom size...
554 sprintf(s
, "Custom.%.0fx%.0f", width
, length
);
555 ppdMarkOption(ppd
, "PageSize", s
);
558 * Update page variables...
563 PageLeft
= ppd
->custom_margins
[0];
564 PageRight
= width
- ppd
->custom_margins
[2];
565 PageBottom
= ppd
->custom_margins
[1];
566 PageTop
= length
- ppd
->custom_margins
[3];
570 * See if we need to collate, and if so how we need to do it...
573 if (xpages
== 1 && ypages
== 1)
576 slowcollate
= Collate
&& ppdFindOption(ppd
, "Collate") == NULL
;
578 if (Copies
> 1 && !slowcollate
)
587 * Write any "exit server" options that have been selected...
590 ppdEmit(ppd
, stdout
, PPD_ORDER_EXIT
);
593 * Write any JCL commands that are needed to print PostScript code...
597 ppdEmitJCL(ppd
, stdout
, atoi(argv
[1]), argv
[2], argv
[3]);
600 * Start sending the document with any commands needed...
603 curtime
= time(NULL
);
604 curtm
= localtime(&curtime
);
606 puts("%!PS-Adobe-3.0");
607 printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", PageLeft
, PageBottom
,
609 printf("%%%%LanguageLevel: %d\n", LanguageLevel
);
610 printf("%%%%Pages: %d\n", xpages
* ypages
* Copies
);
611 puts("%%DocumentData: Clean7Bit");
612 puts("%%DocumentNeededResources: font Helvetica-Bold");
613 puts("%%Creator: imagetops/" CUPS_SVERSION
);
614 strftime(curdate
, sizeof(curdate
), "%c", curtm
);
615 printf("%%%%CreationDate: %s\n", curdate
);
616 WriteTextComment("Title", argv
[3]);
617 WriteTextComment("For", argv
[2]);
619 puts("%%Orientation: Landscape");
621 puts("%%Orientation: Portrait");
622 puts("%%EndComments");
623 puts("%%BeginProlog");
625 if (ppd
!= NULL
&& ppd
->patches
!= NULL
)
628 ppdEmit(ppd
, stdout
, PPD_ORDER_DOCUMENT
);
629 ppdEmit(ppd
, stdout
, PPD_ORDER_ANY
);
630 ppdEmit(ppd
, stdout
, PPD_ORDER_PROLOG
);
632 if (g
!= 1.0 || b
!= 1.0)
633 printf("{ neg 1 add dup 0 lt { pop 1 } { %.3f exp neg 1 add } "
634 "ifelse %.3f mul } bind settransfer\n", g
, b
);
640 WriteLabelProlog(cupsGetOption("page-label", num_options
, options
),
641 PageBottom
, PageTop
, PageWidth
);
645 WriteLabelProlog(cupsGetOption("page-label", num_options
, options
),
646 PageLeft
, PageRight
, PageLength
);
650 WriteLabelProlog(cupsGetOption("page-label", num_options
, options
),
651 PageLength
- PageTop
, PageLength
- PageBottom
,
656 WriteLabelProlog(cupsGetOption("page-label", num_options
, options
),
657 PageWidth
- PageRight
, PageWidth
- PageLeft
,
664 if (ppd
== NULL
|| ppd
->language_level
== 1)
665 printf("/#copies %d def\n", realcopies
);
667 printf("<</NumCopies %d>>setpagedevice\n", realcopies
);
673 * Output the pages...
676 row
= malloc(cupsImageGetWidth(img
) * abs(colorspace
) + 3);
678 fprintf(stderr
, "DEBUG: XPosition=%d, YPosition=%d, Orientation=%d\n",
679 XPosition
, YPosition
, Orientation
);
680 fprintf(stderr
, "DEBUG: xprint=%.0f, yprint=%.0f\n", xprint
, yprint
);
681 fprintf(stderr
, "DEBUG: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f\n",
682 PageLeft
, PageRight
, PageWidth
);
683 fprintf(stderr
, "DEBUG: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f\n",
684 PageBottom
, PageTop
, PageLength
);
695 left
= (PageRight
+ PageLeft
- xprint
* 72) / 2;
698 left
= PageRight
- xprint
* 72;
705 top
= PageBottom
+ yprint
* 72;
708 top
= (PageTop
+ PageBottom
+ yprint
* 72) / 2;
723 left
= (PageTop
+ PageBottom
- xprint
* 72) / 2;
726 left
= PageTop
- xprint
* 72;
733 top
= PageLeft
+ yprint
* 72;
736 top
= (PageRight
+ PageLeft
+ yprint
* 72) / 2;
751 left
= (PageRight
+ PageLeft
- xprint
* 72) / 2;
754 left
= PageRight
- xprint
* 72;
761 top
= PageBottom
+ yprint
* 72;
764 top
= (PageTop
+ PageBottom
+ yprint
* 72) / 2;
779 left
= (PageTop
+ PageBottom
- xprint
* 72) / 2;
782 left
= PageTop
- xprint
* 72;
789 top
= PageLeft
+ yprint
* 72;
792 top
= (PageRight
+ PageLeft
+ yprint
* 72) / 2;
801 fprintf(stderr
, "DEBUG: left=%.2f, top=%.2f\n", left
, top
);
803 for (page
= 1; Copies
> 0; Copies
--)
804 for (xpage
= 0; xpage
< xpages
; xpage
++)
805 for (ypage
= 0; ypage
< ypages
; ypage
++, page
++)
807 if (ppd
&& ppd
->num_filters
== 0)
808 fprintf(stderr
, "PAGE: %d %d\n", page
, realcopies
);
810 _cupsLangPrintFilter(stderr
, "INFO", _("Printing page %d."), page
);
812 printf("%%%%Page: %d %d\n", page
, page
);
814 ppdEmit(ppd
, stdout
, PPD_ORDER_PAGE
);
819 printf("%.0f 0 translate -1 1 scale\n", PageWidth
);
823 case 1 : /* Landscape */
824 printf("%.0f 0 translate 90 rotate\n", PageWidth
);
826 case 2 : /* Reverse Portrait */
827 printf("%.0f %.0f translate 180 rotate\n", PageWidth
, PageLength
);
829 case 3 : /* Reverse Landscape */
830 printf("0 %.0f translate -90 rotate\n", PageLength
);
836 xc0
= cupsImageGetWidth(img
) * xpage
/ xpages
;
837 xc1
= cupsImageGetWidth(img
) * (xpage
+ 1) / xpages
- 1;
838 yc0
= cupsImageGetHeight(img
) * ypage
/ ypages
;
839 yc1
= cupsImageGetHeight(img
) * (ypage
+ 1) / ypages
- 1;
841 printf("%.1f %.1f translate\n", left
, top
);
843 printf("%.3f %.3f scale\n\n",
844 xprint
* 72.0 / (xc1
- xc0
+ 1),
845 yprint
* 72.0 / (yc1
- yc0
+ 1));
847 if (LanguageLevel
== 1)
849 printf("/picture %d string def\n", (xc1
- xc0
+ 1) * abs(colorspace
));
850 printf("%d %d 8[1 0 0 -1 0 1]", (xc1
- xc0
+ 1), (yc1
- yc0
+ 1));
852 if (colorspace
== CUPS_IMAGE_WHITE
)
853 puts("{currentfile picture readhexstring pop} image");
855 printf("{currentfile picture readhexstring pop} false %d colorimage\n",
858 for (y
= yc0
; y
<= yc1
; y
++)
860 cupsImageGetRow(img
, xc0
, y
, xc1
- xc0
+ 1, row
);
861 ps_hex(row
, (xc1
- xc0
+ 1) * abs(colorspace
), y
== yc1
);
868 case CUPS_IMAGE_WHITE
:
869 puts("/DeviceGray setcolorspace");
871 case CUPS_IMAGE_RGB
:
872 puts("/DeviceRGB setcolorspace");
874 case CUPS_IMAGE_CMYK
:
875 puts("/DeviceCMYK setcolorspace");
883 "/BitsPerComponent 8",
884 xc1
- xc0
+ 1, yc1
- yc0
+ 1);
888 case CUPS_IMAGE_WHITE
:
889 fputs("/Decode[0 1]", stdout
);
891 case CUPS_IMAGE_RGB
:
892 fputs("/Decode[0 1 0 1 0 1]", stdout
);
894 case CUPS_IMAGE_CMYK
:
895 fputs("/Decode[0 1 0 1 0 1 0 1]", stdout
);
899 fputs("\n/DataSource currentfile/ASCII85Decode filter", stdout
);
901 if (((xc1
- xc0
+ 1) / xprint
) < 100.0)
902 fputs("/Interpolate true", stdout
);
904 puts("/ImageMatrix[1 0 0 -1 0 1]>>image");
906 for (y
= yc0
, out_offset
= 0; y
<= yc1
; y
++)
908 cupsImageGetRow(img
, xc0
, y
, xc1
- xc0
+ 1, row
+ out_offset
);
910 out_length
= (xc1
- xc0
+ 1) * abs(colorspace
) + out_offset
;
911 out_offset
= out_length
& 3;
913 ps_ascii85(row
, out_length
, y
== yc1
);
916 memcpy(row
, row
+ out_length
- out_offset
, out_offset
);
929 * End the job with the appropriate JCL command or CTRL-D otherwise.
934 if (ppd
&& ppd
->jcl_end
)
935 ppdEmitJCLEnd(ppd
, stdout
);
952 * 'ps_hex()' - Print binary data as a series of hexadecimal numbers.
956 ps_hex(cups_ib_t
*data
, /* I - Data to print */
957 int length
, /* I - Number of bytes to print */
958 int last_line
) /* I - Last line of raster data? */
960 static int col
= 0; /* Current column */
961 static char *hex
= "0123456789ABCDEF";
968 * Put the hex chars out to the file; note that we don't use printf()
969 * for speed reasons...
972 putchar(hex
[*data
>> 4]);
973 putchar(hex
[*data
& 15]);
986 if (last_line
&& col
)
995 * 'ps_ascii85()' - Print binary data as a series of base-85 numbers.
999 ps_ascii85(cups_ib_t
*data
, /* I - Data to print */
1000 int length
, /* I - Number of bytes to print */
1001 int last_line
) /* I - Last line of raster data? */
1003 unsigned b
; /* Binary data word */
1004 unsigned char c
[5]; /* ASCII85 encoded chars */
1005 static int col
= 0; /* Current column */
1010 b
= (((((data
[0] << 8) | data
[1]) << 8) | data
[2]) << 8) | data
[3];
1019 c
[4] = (b
% 85) + '!';
1021 c
[3] = (b
% 85) + '!';
1023 c
[2] = (b
% 85) + '!';
1025 c
[1] = (b
% 85) + '!';
1029 fwrite(c
, 5, 1, stdout
);
1047 memset(data
+ length
, 0, 4 - length
);
1048 b
= (((((data
[0] << 8) | data
[1]) << 8) | data
[2]) << 8) | data
[3];
1050 c
[4] = (b
% 85) + '!';
1052 c
[3] = (b
% 85) + '!';
1054 c
[2] = (b
% 85) + '!';
1056 c
[1] = (b
% 85) + '!';
1060 fwrite(c
, length
+ 1, 1, stdout
);