1 # DP: Handle DOS newlines after backslashes.
2 # DP: Patch from http://www.cygnus.com/ml/egcs/1999-Jan/0784.html
4 --- gcc/cccp.c.orig Thu Jun 24 15:11:40 1999
5 +++ gcc/cccp.c Mon Aug 9 12:21:55 1999
7 retrying if necessary. If MAX_READ_LEN is defined, read at most
8 that bytes at a time. Return a negative value if an error occurs,
9 otherwise return the actual number of bytes read,
10 - which must be LEN unless end-of-file was reached. */
11 + which may be < LEN if CRs have been skipped, though we try not to do
15 safe_read (desc, ptr, len)
19 int left, rcount, nchars;
24 @@ -1051,8 +1053,20 @@
30 + /* CRLF pairs, found with Unix when processing DOS files,
31 + throw off backslash-newline removal.
32 + Therefore, CRs are thrown away here. */
37 + if(*rptr == '\r' && *(rptr+1) == '\n')
48 cnt = safe_read (f, (char *) fp->buf + size, bsize - size);
49 if (cnt < 0) goto perror; /* error! */
50 + if (cnt == 0) break; /* End of file */
52 - if (size != bsize) break; /* End of file */
54 fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
57 map_list_ptr->map_list_map = ptr;
59 while ((ch = getc (f)) != '\n')
66 i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size);
68 goto nope; /* error! */
70 - if (st_size != bsize)
72 break; /* End of file */
75 fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);