home *** CD-ROM | disk | FTP | other *** search
- *** cccp-old.c Thu Jun 15 13:16:31 1995
- --- cccp.c Fri Sep 8 22:59:14 1995
- ***************
- *** 372,377 ****
- --- 372,381 ----
-
- static int no_trigraphs = 0;
-
- + /* Nonzero means replace MSDOS CRLF sequences. */
- +
- + static int no_msdoscr = 0;
- +
- /* Nonzero means print the names of included files rather than
- the preprocessed output. 1 means just the #include "...",
- 2 means #include <...> as well. */
- ***************
- *** 1065,1070 ****
- --- 1069,1076 ----
-
- static U_CHAR *index0 PROTO((U_CHAR *, int, size_t));
-
- + static void msdos_pcp PROTO((FILE_BUF *));
- +
- static void trigraph_pcp PROTO((FILE_BUF *));
-
- static void newline_fix PROTO((U_CHAR *));
- ***************
- *** 1353,1358 ****
- --- 1359,1365 ----
-
- no_line_directives = 0;
- no_trigraphs = 1;
- + no_msdoscr = 0;
- dump_macros = dump_none;
- no_output = 0;
- cplusplus = 0;
- ***************
- *** 1399,1404 ****
- --- 1406,1414 ----
- if (!strcmp (argv[i], "-ifoutput")) {
- output_conditionals = 1;
- }
- + if (!strcmp (argv[i], "-imsdos")) {
- + no_msdoscr = 1;
- + }
- if (!strcmp (argv[i], "-isystem")) {
- struct file_name_list *dirtmp;
-
- ***************
- *** 2260,2265 ****
- --- 2270,2280 ----
- }
- fp->buf[fp->length] = '\0';
-
- + /* Convert MSDOS files */
- +
- + if (no_msdoscr)
- + msdos_pcp (fp);
- +
- /* Unless inhibited, convert trigraphs in the input. */
-
- if (!no_trigraphs)
- ***************
- *** 2489,2494 ****
- --- 2504,2527 ----
- warning ("%d trigraph(s) encountered", (fptr - bptr) / 2);
- }
-
- +
- + /* Replace any CR found in file with a LF; does not change the length
- + of the file */
- +
- + static void
- + msdos_pcp (buf)
- + FILE_BUF *buf;
- + {
- + register U_CHAR *sptr, *lptr;
- +
- + sptr = buf->buf;
- + lptr = sptr + buf->length;
- + while ((sptr = index0 (sptr, '\r', (size_t) (lptr - sptr))) != NULL) {
- + if (sptr[1]=='\n') sptr[1] = ' ';
- + *sptr++ = '\n';
- + }
- + }
- +
- /* Move all backslash-newline pairs out of embarrassing places.
- Exchange all such pairs following BP
- with any potentially-embarrassing characters that follow them.
- ***************
- *** 5068,5073 ****
- --- 5101,5108 ----
- indepth++;
- input_file_stack_tick++;
-
- + if (no_msdoscr)
- + msdos_pcp (fp);
- if (!no_trigraphs)
- trigraph_pcp (fp);
-
-