/* 801PRT11 - MPS801 file printer version 1.1 This is a file printer designed with the Commodore MPS801 and 1525 printers in mind. It should, however, work with any printer that does not need linefeeds. It sends two extra carriage returns to the printer at the end to clear out the buffer, so that no lines will be dropped as happens with many file listers when used with the MPS801. It also filters out linefeeds. This source code and the program are in the public domain. Modify them as you see fit. 9/7/86 - Removed code-wasting check to see if printer opened ok since it didn't work and added tab expansion to make version 1.1. */ #include #define LF '\012' #define TAB '\t' #define EXPTAB " " main(argc,argv) int argc; char *argv[]; { FILE *in; FILE *lst; int ch; if (argc < 2) { printf("\n\n801PRT11 - MPS801 file printer version 1.1\n\n"); printf("Usage:\n\n801PRT11 filename\n\n"); printf("where filename is the name of the file to print out.\n\n"); exit(-1); } if ((in = fopen(argv[1], "r")) == NULL) { printf("\nCould not open file %s.\n",argv[1]); exit(-1); } lst = fopen("lst:", "w"); ch = getc(in); while (ch != EOF) { if (ch != LF) { if (ch == TAB) fprintf(lst, "%s", EXPTAB); else putc(ch, lst); } ch = getc(in); } putc('\n',lst); putc('\n',lst); fclose(in); fclose(lst); }