| 1 | #include <stdio.h>\r |
| 2 | \r |
| 3 | #define ERROR 00404\r |
| 4 | #include "pdp11_cr_dat.h"\r |
| 5 | \r |
| 6 | static int colStart = 1; /* starting column */\r |
| 7 | static int colEnd = 80; /* ending column */\r |
| 8 | \r |
| 9 | main ()\r |
| 10 | {\r |
| 11 | int col, c;\r |
| 12 | \r |
| 13 | while (1) {\r |
| 14 | for (col = colStart; col <= colEnd; ) {\r |
| 15 | switch (c = fgetc (stdin)) {\r |
| 16 | case EOF:\r |
| 17 | /* fall through */\r |
| 18 | case '\n':\r |
| 19 | while (col <= colEnd) {\r |
| 20 | fputc (o29_code[' '] & 077, stdout);\r |
| 21 | fputc ((o29_code[' '] >> 6) & 077, stdout);\r |
| 22 | col++;\r |
| 23 | }\r |
| 24 | break;\r |
| 25 | case '\t':\r |
| 26 | do {\r |
| 27 | fputc (o29_code[' '] & 077, stdout);\r |
| 28 | fputc ((o29_code[' '] >> 6) & 077, stdout);\r |
| 29 | col++;\r |
| 30 | } while (((col & 07) != 1) && (col <= colEnd));\r |
| 31 | break;\r |
| 32 | default:\r |
| 33 | fputc (o29_code[c] & 077, stdout);\r |
| 34 | fputc ((o29_code[c] >> 6) & 077, stdout);\r |
| 35 | col++;\r |
| 36 | break;\r |
| 37 | }\r |
| 38 | }\r |
| 39 | /* flush long lines, or flag over-length card */\r |
| 40 | if (c != '\n' && c != EOF) {\r |
| 41 | printf ("overlength line\n");\r |
| 42 | do c = fgetc (stdin);\r |
| 43 | while ((c != EOF) && (c != '\n'));\r |
| 44 | }\r |
| 45 | if (c == EOF)\r |
| 46 | break;\r |
| 47 | }\r |
| 48 | exit (1);\r |
| 49 | }\r |