do_writeout() takes an arg now, and mallocstrcpy now gives up if src == dest
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@453 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
c08f50d9de
commit
e1ebaf3821
|
@ -20,6 +20,9 @@ General -
|
|||
- removed skipping . and .. when tabulating matches.
|
||||
- Added the (char *) sizeof when allocating memory for the filename
|
||||
array (Rocco).
|
||||
do_writeout()
|
||||
- Now takes an argument so the string typed in can be retained
|
||||
when calling the browser.
|
||||
do_browser()
|
||||
- Don't decrement longest by the length of path. Fixes crashes
|
||||
on entering various dirs (Rocco).
|
||||
|
@ -40,6 +43,7 @@ General -
|
|||
mallocstrcpy()
|
||||
- Takes char pointers now instead of void (makes debugging a
|
||||
helluva lot easier)
|
||||
- Duh, don't do anything if src == dest!
|
||||
- es.po:
|
||||
- Updates for file browser (Jordi).
|
||||
|
||||
|
|
18
files.c
18
files.c
|
@ -374,7 +374,7 @@ int write_file(char *name, int tmp)
|
|||
if (fd == -1) {
|
||||
if (!tmp && ISSET(TEMP_OPT)) {
|
||||
UNSET(TEMP_OPT);
|
||||
return do_writeout(1);
|
||||
return do_writeout(filename, 1);
|
||||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
|
@ -391,7 +391,7 @@ int write_file(char *name, int tmp)
|
|||
if ((fd = mkstemp(buf)) == -1) {
|
||||
if (ISSET(TEMP_OPT)) {
|
||||
UNSET(TEMP_OPT);
|
||||
return do_writeout(1);
|
||||
return do_writeout(filename, 1);
|
||||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
|
@ -495,15 +495,16 @@ int write_file(char *name, int tmp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int do_writeout(int exiting)
|
||||
int do_writeout(char *path, int exiting)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
static int did_cred = 0;
|
||||
#endif
|
||||
fprintf(stderr, "answer = %s, path = %s\n", answer, path);
|
||||
|
||||
answer = mallocstrcpy(answer, filename);
|
||||
answer = mallocstrcpy(answer, path);
|
||||
|
||||
if ((exiting) && (ISSET(TEMP_OPT))) {
|
||||
if (filename[0]) {
|
||||
|
@ -532,8 +533,11 @@ int do_writeout(int exiting)
|
|||
|
||||
if (tmp != NULL)
|
||||
answer = mallocstrcpy(answer, tmp);
|
||||
else
|
||||
return do_writeout(exiting);
|
||||
else {
|
||||
fprintf(stderr, "Answer = %s\n", answer);
|
||||
|
||||
return do_writeout(answer, exiting);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -572,7 +576,7 @@ int do_writeout(int exiting)
|
|||
|
||||
int do_writeout_void(void)
|
||||
{
|
||||
return do_writeout(0);
|
||||
return do_writeout(filename, 0);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
|
|
2
nano.c
2
nano.c
|
@ -1421,7 +1421,7 @@ int do_exit(void)
|
|||
#endif
|
||||
|
||||
if (i == 1) {
|
||||
if (do_writeout(1) > 0)
|
||||
if (do_writeout(filename, 1) > 0)
|
||||
finish(0);
|
||||
} else if (i == 0)
|
||||
finish(0);
|
||||
|
|
2
proto.h
2
proto.h
|
@ -81,7 +81,7 @@ int do_uncut_text(void);
|
|||
int no_help(void);
|
||||
int renumber_all(void);
|
||||
int open_file(char *filename, int insert, int quiet);
|
||||
int do_writeout(int exiting);
|
||||
int do_writeout(char *path, int exiting);
|
||||
int do_gotoline(long defline);
|
||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
int wholewords, int *i);
|
||||
|
|
Loading…
Reference in New Issue