| 48 | ****************************************************************************/ |
| 49 | |
| 50 | int main(int argc, char **argv) |
| 51 | { |
| 52 | char *g_line0; |
| 53 | char *g_line1; |
| 54 | char *ptr; |
| 55 | char *tmpptr; |
| 56 | FILE *instream; |
| 57 | FILE *outstream; |
| 58 | unsigned long lineno = 0; |
| 59 | unsigned int indent; |
| 60 | unsigned int lastindent; |
| 61 | unsigned int nextindent; |
| 62 | unsigned int tmpindent; |
| 63 | bool iscomment; |
| 64 | bool wascomment; |
| 65 | bool willbecomment; |
| 66 | bool isblank; |
| 67 | bool wasblank; |
| 68 | bool willbeblank; |
| 69 | bool willbevalid; |
| 70 | int ret = 1; |
| 71 | |
| 72 | if (argc != 3) |
| 73 | { |
| 74 | fprintf(stderr, "ERROR: Two arguments expected\n"); |
| 75 | return 1; |
| 76 | } |
| 77 | |
| 78 | /* Open the source file read-only */ |
| 79 | |
| 80 | instream = fopen(argv[1], "r"); |
| 81 | if (instream == NULL) |
| 82 | { |
| 83 | fprintf(stderr, "ERROR: Failed to open %s for reading\n", argv[1]); |
| 84 | return 1; |
| 85 | } |
| 86 | |
| 87 | /* Open the destination file write-only */ |
| 88 | |
| 89 | outstream = fopen(argv[2], "w"); |
| 90 | if (outstream == NULL) |
| 91 | { |
| 92 | fprintf(stderr, "ERROR: Failed to open %s for reading\n", argv[2]); |
| 93 | goto errout_with_instream; |
| 94 | } |
| 95 | |
| 96 | /* Prime the pump */ |
| 97 | |
| 98 | g_line0 = g_linea; |
| 99 | g_line1 = g_lineb; |
| 100 | wasblank = true; |
| 101 | wascomment = false; |
| 102 | lastindent = 0; |
| 103 | |
| 104 | /* Read line n + 1 (for n = 0) */ |
| 105 | |
| 106 | if (fgets(g_line1, LINESIZE, instream) == NULL) |
| 107 | { |
nothing calls this directly
no test coverage detected