tweaks: rename two variables, to avoid using a name for different purposes
When calling do_prompt(), 'ans' is used to offer a default answer or the answer given so far.master
parent
1228b2c05b
commit
27e07d2af5
15
src/files.c
15
src/files.c
|
@ -318,7 +318,7 @@ int do_lockfile(const char *filename)
|
||||||
ssize_t readtot = 0;
|
ssize_t readtot = 0;
|
||||||
ssize_t readamt = 0;
|
ssize_t readamt = 0;
|
||||||
char *lockbuf, *question, *postedname, *promptstr;
|
char *lockbuf, *question, *postedname, *promptstr;
|
||||||
int room, ans;
|
int room, response;
|
||||||
|
|
||||||
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
||||||
statusline(MILD, _("Error opening lock file %s: %s"),
|
statusline(MILD, _("Error opening lock file %s: %s"),
|
||||||
|
@ -370,10 +370,10 @@ int do_lockfile(const char *filename)
|
||||||
sprintf(promptstr, question, postedname, lockuser, lockprog, lockpid);
|
sprintf(promptstr, question, postedname, lockuser, lockprog, lockpid);
|
||||||
free(postedname);
|
free(postedname);
|
||||||
|
|
||||||
ans = do_yesno_prompt(FALSE, promptstr);
|
response = do_yesno_prompt(FALSE, promptstr);
|
||||||
free(promptstr);
|
free(promptstr);
|
||||||
|
|
||||||
if (ans < 1) {
|
if (response < 1) {
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
goto free_the_name;
|
goto free_the_name;
|
||||||
}
|
}
|
||||||
|
@ -645,7 +645,7 @@ int is_file_writable(const char *filename)
|
||||||
int fd;
|
int fd;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *full_filename;
|
char *full_filename;
|
||||||
bool ans = TRUE;
|
bool result = TRUE;
|
||||||
|
|
||||||
if (ISSET(VIEW_MODE))
|
if (ISSET(VIEW_MODE))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -664,13 +664,14 @@ int is_file_writable(const char *filename)
|
||||||
if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
|
if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
|
||||||
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1 ||
|
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1 ||
|
||||||
(f = fdopen(fd, "a")) == NULL)
|
(f = fdopen(fd, "a")) == NULL)
|
||||||
ans = FALSE;
|
result = FALSE;
|
||||||
else
|
else
|
||||||
fclose(f);
|
fclose(f);
|
||||||
close(fd);
|
|
||||||
|
|
||||||
|
close(fd);
|
||||||
free(full_filename);
|
free(full_filename);
|
||||||
return ans;
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a new line of text from the given buf, which is of length buf_len.
|
/* Make a new line of text from the given buf, which is of length buf_len.
|
||||||
|
|
Loading…
Reference in New Issue