version 1.8, 2001/05/23 22:36:14 |
version 1.9, 2001/05/24 03:05:22 |
|
|
} |
} |
|
|
/* |
/* |
* Select a file for editing. Look around to see if you can find the file |
* Select a file for editing. Look around to see if you can find the file |
* in another buffer; if you can find it, just switch to the buffer. If |
* in another buffer; if you can find it, just switch to the buffer. If |
* you cannot find the file, create a new buffer, read in the text, and |
* you cannot find the file, create a new buffer, read in the text, and |
* switch to the new buffer. |
* switch to the new buffer. |
*/ |
*/ |
/* ARGSUSED */ |
/* ARGSUSED */ |
|
|
} |
} |
|
|
/* |
/* |
* Read the file "fname" into the current buffer. Make all of the text |
* Read the file "fname" into the current buffer. Make all of the text |
* in the buffer go away, after checking for unsaved changes. This is |
* in the buffer go away, after checking for unsaved changes. This is |
* called by the "read" command, the "visit" command, and the mainline |
* called by the "read" command, the "visit" command, and the mainline |
* (for "uemacs file"). |
* (for "uemacs file"). |
*/ |
*/ |
int |
int |
|
|
*/ |
*/ |
|
|
/* |
/* |
* Insert a file in the current buffer, after dot. Set mark at the end of |
* Insert a file in the current buffer, after dot. Set mark at the end of |
* the text inserted; point at the beginning. Return a standard status. |
* the text inserted; point at the beginning. Return a standard status. |
* Print a summary (lines read, error message) out as well. If the BACKUP |
* Print a summary (lines read, error message) out as well. If the BACKUP |
* conditional is set, then this routine also does the read end of backup |
* conditional is set, then this routine also does the read end of backup |
* processing. The BFBAK flag, if set in a buffer, says that a backup |
* processing. The BFBAK flag, if set in a buffer, says that a backup |
* should be taken. It is set when a file is read in, but not on a new |
* should be taken. It is set when a file is read in, but not on a new |
* file. (You don't need to make a backup copy of nothing.) |
* file. (You don't need to make a backup copy of nothing.) |
*/ |
*/ |
static char *line = NULL; |
static char *line = NULL; |
static int linesize = 0; |
static int linesize = 0; |
|
|
int |
int |
insertfile(fname, newname, needinfo) |
insertfile(fname, newname, needinfo) |
|
|
break; |
break; |
case FIOLONG:{ |
case FIOLONG:{ |
/* a line too long to fit in our buffer */ |
/* a line too long to fit in our buffer */ |
char *cp; |
char *cp; |
int newsize; |
int newsize; |
|
|
newsize = linesize * 2; |
newsize = linesize * 2; |
if (newsize < 0 || |
if (newsize < 0 || |
|
|
bcopy(line, cp, linesize); |
bcopy(line, cp, linesize); |
free(line); |
free(line); |
line = cp; |
line = cp; |
s = ffgetline(line + linesize, linesize, |
s = ffgetline(line + linesize, linesize, |
&nbytes); |
&nbytes); |
nbytes += linesize; |
nbytes += linesize; |
linesize = newsize; |
linesize = newsize; |
|
|
} |
} |
|
|
/* |
/* |
* Ask for a file name and write the contents of the current buffer to that |
* Ask for a file name and write the contents of the current buffer to that |
* file. Update the remembered file name and clear the buffer changed flag. |
* file. Update the remembered file name and clear the buffer changed flag. |
* This handling of file names is different from the earlier versions and |
* This handling of file names is different from the earlier versions and |
* is more compatable with Gosling EMACS than with ITS EMACS. |
* is more compatable with Gosling EMACS than with ITS EMACS. |
*/ |
*/ |
|
|
#ifndef MAKEBACKUP |
#ifndef MAKEBACKUP |
#define MAKEBACKUP TRUE |
#define MAKEBACKUP TRUE |
#endif /* !MAKEBACKUP */ |
#endif /* !MAKEBACKUP */ |
static int makebackup = MAKEBACKUP; |
static int makebackup = MAKEBACKUP; |
#endif /* !NO_BACKUP */ |
#endif /* !NO_BACKUP */ |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
|
|
} |
} |
|
|
/* |
/* |
* Save the contents of the buffer argument into its associated file. Do |
* Save the contents of the buffer argument into its associated file. Do |
* nothing if there have been no changes (is this a bug, or a feature?). |
* nothing if there have been no changes (is this a bug, or a feature?). |
* Error if there is no remembered file name. If this is the first write |
* Error if there is no remembered file name. If this is the first write |
* since the read or visit, then a backup copy of the file is made. |
* since the read or visit, then a backup copy of the file is made. |
* Allow user to select whether or not to make backup files by looking at |
* Allow user to select whether or not to make backup files by looking at |
* the value of makebackup. |
* the value of makebackup. |
*/ |
*/ |
int |
int |
|
|
if (s == ABORT) |
if (s == ABORT) |
return FALSE; |
return FALSE; |
/* softer error */ |
/* softer error */ |
if (s == FALSE && |
if (s == FALSE && |
(s = eyesno("Backup error, save anyway")) != TRUE) |
(s = eyesno("Backup error, save anyway")) != TRUE) |
return s; |
return s; |
} |
} |
|
|
*/ |
*/ |
|
|
/* |
/* |
* This function performs the details of file writing; writing the file |
* This function performs the details of file writing; writing the file |
* in buffer bp to file fn. Uses the file management routines in the |
* in buffer bp to file fn. Uses the file management routines in the |
* "fileio.c" package. Most of the grief is checking of some sort. |
* "fileio.c" package. Most of the grief is checking of some sort. |
*/ |
*/ |
int |
int |