home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------ */
- /* list.c */
- /* druckt Datei im DIN A5 format */
- /* (c) 1988 by Bernd Eichinger - Wieschmann und TOOLBOX */
- /* ------------------------------------------------------ */
-
- #include <stdio.h>
- #include <string.h>
-
- void list( char *s, int n );
-
- main(int argc, char *argv[])
- {
- switch(argc)
- {
- case 2 : list(strupr(argv[1]), 56);
- break;
- case 3 : list( strupr(argv[1]), atoi( argv[2] ) + 1 );
- break;
- default: fprintf(stdout,
- "usage: list file.ext <lines>\n");
- fprintf(stdout,
- " prints file condensd with 1/8\n");
- break;
- }
- } /* main */
-
- void list(char *s, int n)
- {
- FILE *fp;
- int page = 0;
- int row = 0;
- char line[256];
-
- if((fp = fopen(s,"r")) != NULL)
- {
- while(feof(fp) == 0)
- {
- page++;
- /* Drucker wird auf 96 Zeilen/Seite und */
- /* Schmalschrift gesetzt */
- fprintf(stdprn,
- "%c%c0\t\tFile: %-40s Page: %5d\n\n",
- 15,27,s,page);
- row = 0;
- while(row < n)
- {
- if(fgets(line, 256, fp) != NULL)
- {
- fprintf(stdprn, "\t\t%s", line);
- row++;
- }
- else row = n;
- } /* while row ... */
- fprintf(stdprn, "%c", 12); /* form feed */
- } /* while feof ... */
- }
- else fprintf(stderr, "error: can't open file !%c\n", 7);
- }
- /* ------------------------------------------------------ */
- /* Ende von LIST.C */