Cover V04, I04
Article
Listing 1
Listing 2
Listing 3
Sidebar 1

jul95.tar


Listing 2: A C filter

/*
sethp.c

DM Brown
1 March 1991

This filter sets certain desired paramaters for the
HP LaserJet (such as word wrap).  It should be called
before each print job.

Compile with:

cc sethp.c -o sethp

*/

#include <stdio.h>

#define RESETSTR "\033E"
/* turn on word wrap and select */
/* Courier 12 cpi 10 pt. font */
#define INITSTR \
"\033&s0C\033(0N\033(s0p12.00h10.0v0s0b3T"

main()
{
int c;

fputs(RESETSTR, stdout);        /* reset printer */

fputs(INITSTR, stdout); /* send setup string */

/* send data straight through */
while ((c = getchar()) != EOF)
putchar(c);

/* send form feed at end of job */
fputc('\014',stdout);
fflush(stdout);

exit(0);
}
/* End of File */