/* H P 5 L P R I N T Print a host file or files on an HP LaserJet 5L printer through a VT terminal or emulator using transparent print sequences. Latin-1 characters are translated to CP437. Authors: F. da Cruz & C. Gianone, Columbia University, 1996. */ #include unsigned char yl143[] = { /* Latin-1 to IBM Code Page 437 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242, 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159, 255, 173, 155, 156, 207, 157, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238, 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168, 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216, 209, 165, 227, 224, 226, 229, 153, 158, 190, 235, 233, 234, 154, 237, 232, 225, 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139, 208, 164, 149, 162, 147, 228, 148, 246, 189, 151, 163, 150, 129, 236, 231, 152 }; #define ESC 27 #define FF 12 main(argc,argv) int argc; char *argv[]; { int c, i; FILE * fp; if (argc == 1) { /* Standard input */ printf("%c[5i",ESC); /* Send start-print sequence */ while ((c = getchar()) != EOF) /* Send characters */ putchar(yl143[c]); /* translated */ printf("%c%c[4i",FF,ESC); /* Send formfeed and stop-print */ exit(0); /* Done */ } for (i = 1; i < argc; i++) { /* File list */ if (!(fp = fopen(argv[i],"r"))) /* Open file i */ continue; printf("%c[5i",ESC); /* Send start-print sequence */ while ((c = fgetc(fp)) != EOF) /* Send characters */ putchar(yl143[c]); /* translated */ fclose(fp); /* Close file i */ printf("%c%c[4i",FF,ESC); /* Send FF and stop-print */ } exit(0); /* Done */ }