Last change
on this file since 6d3de83 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | rdcheck.c -- test program for rdline.c
|
---|
| 4 | Version 1 -- 1988-12-29 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stdio.h"
|
---|
| 9 | #include "stddefs.h"
|
---|
| 10 |
|
---|
| 11 | #define MAXC 512
|
---|
| 12 |
|
---|
| 13 | extern short rdline();
|
---|
| 14 |
|
---|
| 15 | char buf[MAXC+2];
|
---|
| 16 |
|
---|
| 17 | /*
|
---|
| 18 | =============================================================================
|
---|
| 19 | test rdline
|
---|
| 20 | =============================================================================
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | main(argc, argv)
|
---|
| 24 | int argc;
|
---|
| 25 | char *argv[];
|
---|
| 26 | {
|
---|
| 27 | short rc, runtag, line;
|
---|
| 28 | register FILE *fp;
|
---|
| 29 |
|
---|
| 30 | line = 0;
|
---|
| 31 |
|
---|
| 32 | if (argc NE 2) {
|
---|
| 33 |
|
---|
| 34 | printf("ERROR: File name required\n");
|
---|
| 35 | exit(1);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | if ( (FILE *)NULL EQ (fp = fopenb(argv[1], "r")) ) {
|
---|
| 39 |
|
---|
| 40 | printf("ERROR: Unable to open \"%s\"\n", argv[1]);
|
---|
| 41 | exit(1);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | runtag = TRUE;
|
---|
| 45 |
|
---|
| 46 | while (runtag) {
|
---|
| 47 |
|
---|
| 48 | if (rc = rdline(fp, buf, MAXC)) {
|
---|
| 49 |
|
---|
| 50 | switch (rc) {
|
---|
| 51 |
|
---|
| 52 | default:
|
---|
| 53 | case -1:
|
---|
| 54 |
|
---|
| 55 | runtag = FALSE;
|
---|
| 56 | break;
|
---|
| 57 |
|
---|
| 58 | case 1:
|
---|
| 59 | case 2:
|
---|
| 60 | runtag = FALSE;
|
---|
| 61 | strcat(buf, '\n');
|
---|
| 62 | ++line;
|
---|
| 63 | printf("%5d: %s", line, buf);
|
---|
| 64 | break;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | } else {
|
---|
| 68 |
|
---|
| 69 | ++line;
|
---|
| 70 | printf("%5d: %s", line, buf);
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | fclose(fp);
|
---|
| 75 | exit(0);
|
---|
| 76 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.