home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / gcc-2.003 / gcc-2 / gcc-2.7.0 / cccp.diff < prev   
Encoding:
Text File  |  1995-09-08  |  2.2 KB  |  101 lines

  1. *** cccp-old.c    Thu Jun 15 13:16:31 1995
  2. --- cccp.c    Fri Sep  8 22:59:14 1995
  3. ***************
  4. *** 372,377 ****
  5. --- 372,381 ----
  6.   
  7.   static int no_trigraphs = 0;
  8.   
  9. + /* Nonzero means replace MSDOS CRLF sequences. */
  10. + static int no_msdoscr = 0;
  11.   /* Nonzero means print the names of included files rather than
  12.      the preprocessed output.  1 means just the #include "...",
  13.      2 means #include <...> as well.  */
  14. ***************
  15. *** 1065,1070 ****
  16. --- 1069,1076 ----
  17.   
  18.   static U_CHAR *index0 PROTO((U_CHAR *, int, size_t));
  19.   
  20. + static void msdos_pcp PROTO((FILE_BUF *));
  21.   static void trigraph_pcp PROTO((FILE_BUF *));
  22.   
  23.   static void newline_fix PROTO((U_CHAR *));
  24. ***************
  25. *** 1353,1358 ****
  26. --- 1359,1365 ----
  27.   
  28.     no_line_directives = 0;
  29.     no_trigraphs = 1;
  30. +   no_msdoscr = 0;
  31.     dump_macros = dump_none;
  32.     no_output = 0;
  33.     cplusplus = 0;
  34. ***************
  35. *** 1399,1404 ****
  36. --- 1406,1414 ----
  37.       if (!strcmp (argv[i], "-ifoutput")) {
  38.         output_conditionals = 1;
  39.       }
  40. +     if (!strcmp (argv[i], "-imsdos")) {
  41. +       no_msdoscr = 1;
  42. +     }
  43.       if (!strcmp (argv[i], "-isystem")) {
  44.         struct file_name_list *dirtmp;
  45.   
  46. ***************
  47. *** 2260,2265 ****
  48. --- 2270,2280 ----
  49.     }
  50.     fp->buf[fp->length] = '\0';
  51.   
  52. +   /* Convert MSDOS files */
  53. +   
  54. +   if (no_msdoscr)
  55. +     msdos_pcp (fp);
  56.     /* Unless inhibited, convert trigraphs in the input.  */
  57.   
  58.     if (!no_trigraphs)
  59. ***************
  60. *** 2489,2494 ****
  61. --- 2504,2527 ----
  62.       warning ("%d trigraph(s) encountered", (fptr - bptr) / 2);
  63.   }
  64.   
  65. + /* Replace any CR found in file with a LF; does not change the length
  66. +    of the file */
  67. + static void
  68. + msdos_pcp (buf)
  69. +      FILE_BUF *buf;
  70. + {
  71. +   register U_CHAR *sptr, *lptr;
  72. +   sptr = buf->buf;
  73. +   lptr = sptr + buf->length;
  74. +   while ((sptr = index0 (sptr, '\r', (size_t) (lptr - sptr))) != NULL) {
  75. +     if (sptr[1]=='\n') sptr[1] = ' ';
  76. +     *sptr++ = '\n';
  77. +   }
  78. + }
  79.   /* Move all backslash-newline pairs out of embarrassing places.
  80.      Exchange all such pairs following BP
  81.      with any potentially-embarrassing characters that follow them.
  82. ***************
  83. *** 5068,5073 ****
  84. --- 5101,5108 ----
  85.     indepth++;
  86.     input_file_stack_tick++;
  87.   
  88. +   if (no_msdoscr)
  89. +     msdos_pcp (fp);
  90.     if (!no_trigraphs)
  91.       trigraph_pcp (fp);
  92.   
  93.