home *** CD-ROM | disk | FTP | other *** search
- /***
- *
- *
- * hpplist.c
- *
- * Sends the HP PCL command to select portrait line printer as primary font
- * with 16.6 cpi and 10 lpi spacing and a 10 column left margin.
- *
- * This mode permits printing of long listing files in a condensed type
- * format with sufficient left margin for punching holes for a ring binder.
- *
- * User default printer settings can be restored by running HPRESET.
- *
- * This program written by W. A. Jackson and dedicated to the public domain.
- *
- *****************************************************************************/
-
-
-
- #define INCL_BASE
- #include <OS2.H>
- #include <stdio.h>
- #include <fcntl.h>
- #include <sys\types.h>
- #include <sys\stat.h>
- #include <io.h>
-
- main()
-
- {
- int print_handle; /* file handle for printer */
- FILE *print_pointer; /* stream for printer */
-
- /*
- * Note: this is an awkward way to open a stream to the printer,
- * but necessary to work around a bug in Microsoft C Ver. 5.1
- *
- *************************************************************************/
-
- print_handle = open ("PRN", O_WRONLY); /* open file handle */
- if (print_handle == -1) /* test for open error */
- perror ("open failed on PRN");
- print_pointer = fdopen (print_handle, "w"); /* associate stream */
- if (print_pointer == NULL) /* test for error */
- perror ("fopen failed on print_handle");
- fprintf (print_pointer, "\x01BE"); /* send Esc E (reset) */
- fprintf (print_pointer, /* select font */
- "\x01B&l0O" /* portrait orientation */
- "\x01B(10U" /* PC-8 Symbol Set */
- "\x01B(s0P" /* fixed spacing */
- "\x01B(s16.6H" /* 16.6 cpi pitch */
- "\x01B(s8.5V" /* 8.5 point height */
- "\x01B&l8D" /* 8 lpi line spacing */
- "\x01B(s0S" /* upright style */
- "\x01B(s0B" /* medium stroke weight */
- "\x01B(s0T"); /* Line Printer typeface */
- fprintf (print_pointer, "\x01B&a10L"); /* set 10 column left margin */
- if (fclose (print_pointer) == EOF) /* close stream */
- perror ("fclose failed on print_pointer"); /* test for error */
- printf ("Laserjet set to landscape line printer with top margin.");
- /* display message */
-
- }
-