source: buchla-68k/orig/GP/RDCHECK.C@ f806726

Last change on this file since f806726 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 1.3 KB
Line 
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
13extern short rdline();
14
15char buf[MAXC+2];
16
17/*
18 =============================================================================
19 test rdline
20 =============================================================================
21*/
22
23main(argc, argv)
24int argc;
25char *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.