"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "edit.c" between
less-580.tar.gz and less-581.tar.gz

About: less is a file pager (a program that displays text files similar to "more" or "pg"). Beta version.

edit.c  (less-580):edit.c  (less-581)
skipping to change at line 770 skipping to change at line 770
{ {
int c; int c;
while ((c = ch_forw_get()) != EOI) while ((c = ch_forw_get()) != EOI)
putchr(c); putchr(c);
flush(); flush();
} }
#if LOGFILE #if LOGFILE
#define OVERWRITE_OPTIONS "Overwrite, Append, Don't log, or Quit?"
/* /*
* If the user asked for a log file and our input file * If the user asked for a log file and our input file
* is standard input, create the log file. * is standard input, create the log file.
* We take care not to blindly overwrite an existing file. * We take care not to blindly overwrite an existing file.
*/ */
public void public void
use_logfile(filename) use_logfile(filename)
char *filename; char *filename;
{ {
int exists; int exists;
skipping to change at line 813 skipping to change at line 815
/* /*
* Overwrite (or create) the log file. * Overwrite (or create) the log file.
*/ */
answer = 'O'; answer = 'O';
} else } else
{ {
/* /*
* Ask user what to do. * Ask user what to do.
*/ */
parg.p_string = filename; parg.p_string = filename;
answer = query("Warning: \"%s\" exists; Overwrite, Append or Don' t log? ", &parg); answer = query("Warning: \"%s\" exists; "OVERWRITE_OPTIONS" ", &p arg);
} }
loop: loop:
switch (answer) switch (answer)
{ {
case 'O': case 'o': case 'O': case 'o':
/* /*
* Overwrite: create the file. * Overwrite: create the file.
*/ */
logfile = creat(filename, 0644); logfile = creat(filename, 0644);
skipping to change at line 841 skipping to change at line 843
{ {
close(logfile); close(logfile);
logfile = -1; logfile = -1;
} }
break; break;
case 'D': case 'd': case 'D': case 'd':
/* /*
* Don't do anything. * Don't do anything.
*/ */
return; return;
case 'q':
quit(QUIT_OK);
/*NOTREACHED*/
default: default:
/* /*
* Eh? * Eh?
*/ */
answer = query("Overwrite, Append, or Don't log? (Type \"O\", \"A
\", \"D\" or \"q\") ", NULL_PARG); answer = query(OVERWRITE_OPTIONS" (Type \"O\", \"A\", \"D\" or \"
Q\") ", NULL_PARG);
goto loop; goto loop;
} }
if (logfile < 0) if (logfile < 0)
{ {
/* /*
* Error in opening logfile. * Error in opening logfile.
*/ */
parg.p_string = filename; parg.p_string = filename;
error("Cannot write to \"%s\"", &parg); error("Cannot write to \"%s\"", &parg);
 End of changes. 4 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)