Deleted Added
full compact
10c10
< the Free Software Foundation; either version 1, or (at your option)
---
> the Free Software Foundation; either version 2, or (at your option)
21c21
< 675 Mass Ave, Cambridge, MA 02139, USA. */
---
> 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
38c38
< #include <sys/stat.h>
---
> #include "posixstat.h"
57c57,62
< #if defined (__EMX__)
---
>
> /* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
> on win 95/98/nt), we want to open files with O_BINARY mode so that there
> is no \n -> \r\n conversion performed. On other systems, we don't want to
> mess around with O_BINARY at all, so we ensure that it's defined to 0. */
> #if defined (__EMX__) || defined (__CYGWIN__)
61,62c66
< #else /* !__EMX__ */
< /* If we're not compiling for __EMX__, we don't want this at all. Ever. */
---
> #else /* !__EMX__ && !__CYGWIN__ */
65c69
< #endif /* !__EMX__ */
---
> #endif /* !__EMX__ && !__CYGWIN__ */
75,76c79,80
< /* Functions imported from shell.c */
< extern char *get_env_value ();
---
> #include "rlshell.h"
> #include "xmalloc.h"
78,79d81
< extern char *xmalloc (), *xrealloc ();
<
107a110,112
> #if defined (__MSDOS__)
> strcpy (return_val + home_len + 1, "_history");
> #else
108a114
> #endif
135c141
< int file, current_line;
---
> int file, current_line, chars_read;
158,162c164,166
< #if 0
< if (read (file, buffer, file_size) != file_size)
< #else
< if (read (file, buffer, file_size) < 0)
< #endif
---
>
> chars_read = read (file, buffer, file_size);
> if (chars_read < 0)
178c182
< to = file_size;
---
> to = chars_read;
184c188
< while (line_start < file_size && current_line < from)
---
> while (line_start < chars_read && current_line < from)
186c190
< for (line_end = line_start; line_end < file_size; line_end++)
---
> for (line_end = line_start; line_end < chars_read; line_end++)
197c201
< for (line_end = line_start; line_end < file_size; line_end++)
---
> for (line_end = line_start; line_end < chars_read; line_end++)
238a243,246
> /* Don't try to truncate non-regular files. */
> if (S_ISREG(finfo.st_mode) == 0)
> goto truncate_exit;
>
282c290
< write (file, buffer + i, file_size - i);
---
> write (file, buffer + i, chars_read - i);
286c294
< ftruncate (file, file_size - i);
---
> ftruncate (file, chars_read - i);