The R Project SVN R

Rev

Rev 17346 | Rev 42307 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17346 Rev 25686
Line 46... Line 46...
46
       return '\n';
46
       return '\n';
47
    }
47
    }
48
#else
48
#else
49
    int c = fgetc(fp);
49
    int c = fgetc(fp);
50
#endif
50
#endif
51
#ifdef __MRC__
-
 
52
   /* MRC needs to convert from Mac to Unix line endings */
-
 
53
   if(c == '\r')
-
 
54
    return('\n');
-
 
55
#endif
-
 
56
    /* get rid of  CR in CRLF line termination */
51
    /* get rid of  CR in CRLF line termination */
57
    if (c == '\r') {
52
    if (c == '\r') {
58
	c = fgetc(fp);
53
	c = fgetc(fp);
59
	/* retain CR's with no following linefeed */
54
	/* retain CR's with no following linefeed */
60
	if (c != '\n') {
55
	if (c != '\n') {
Line 67... Line 62...
67
#else
62
#else
68
    return feof(fp) ? R_EOF : c;
63
    return feof(fp) ? R_EOF : c;
69
#endif
64
#endif
70
}
65
}
71
 
66
 
72
#ifdef __MRC__
-
 
73
char *R_fgets(char *buf, int i, FILE *fp);
-
 
74
 
-
 
75
char * R_fgets(char * s, int n, FILE * file)
-
 
76
{
-
 
77
	char *	p = s;
-
 
78
	int			c;
-
 
79
	
-
 
80
	if (--n < 0)
-
 
81
		return(NULL);
-
 
82
	
-
 
83
	if (n)
-
 
84
		do
-
 
85
		{
-
 
86
			c = R_fgetc(file);
-
 
87
			
-
 
88
			if (c == EOF)
-
 
89
				if (feof(file) && p != s)
-
 
90
					break;
-
 
91
				else
-
 
92
					return(NULL);
-
 
93
			
-
 
94
			*p++ = c;
-
 
95
		}
-
 
96
		while (c != '\n' && --n);
-
 
97
	
-
 
98
	*p = 0;
-
 
99
	
-
 
100
	return(s);
-
 
101
}
-
 
102
#endif
-
 
103
 
67