more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
10442330bf
commit
1904f51fb5
|
@ -227,7 +227,7 @@ char *do_browser(char *path, DIR *dir)
|
|||
|
||||
/* If the directory begins with a newline (i.e. an
|
||||
* encoded null), treat it as though it's blank. */
|
||||
if (i < 0 || answer[0] == '\n') {
|
||||
if (i < 0 || *answer == '\n') {
|
||||
/* We canceled. Indicate that on the statusbar, and
|
||||
* blank out ans, since we're done with it. */
|
||||
statusbar(_("Cancelled"));
|
||||
|
@ -827,8 +827,8 @@ int filesearch_init(void)
|
|||
backupstring = NULL;
|
||||
|
||||
/* Cancel any search, or just return with no previous search. */
|
||||
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
|
||||
(i == 0 && answer[0] == '\0')) {
|
||||
if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 &&
|
||||
*answer == '\0')) {
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -983,7 +983,7 @@ void do_filesearch(void)
|
|||
return;
|
||||
|
||||
/* If answer is now "", copy last_search into answer. */
|
||||
if (answer[0] == '\0')
|
||||
if (*answer == '\0')
|
||||
answer = mallocstrcpy(answer, last_search);
|
||||
else
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
|
|
12
src/files.c
12
src/files.c
|
@ -741,7 +741,7 @@ void do_insertfile(
|
|||
* blank, open a new buffer instead of canceling. If the
|
||||
* filename or command begins with a newline (i.e. an encoded
|
||||
* null), treat it as though it's blank. */
|
||||
if (i == -1 || ((i == -2 || answer[0] == '\n')
|
||||
if (i == -1 || ((i == -2 || *answer == '\n')
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
&& !ISSET(MULTIBUFFER)
|
||||
#endif
|
||||
|
@ -1307,7 +1307,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
|
||||
assert(name != NULL);
|
||||
|
||||
if (name[0] == '\0')
|
||||
if (*name == '\0')
|
||||
return -1;
|
||||
|
||||
if (f_open != NULL)
|
||||
|
@ -1408,7 +1408,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
sprintf(backupname, "%s%s", backup_dir, backuptemp);
|
||||
free(backuptemp);
|
||||
backuptemp = get_next_filename(backupname, "~");
|
||||
if (backuptemp[0] == '\0') {
|
||||
if (*backuptemp == '\0') {
|
||||
statusbar(_("Error writing %s: %s"), backupname,
|
||||
_("Too many backup files?"));
|
||||
free(backuptemp);
|
||||
|
@ -1833,7 +1833,7 @@ bool do_writeout(bool exiting)
|
|||
|
||||
/* If the filename or command begins with a newline (i.e. an
|
||||
* encoded null), treat it as though it's blank. */
|
||||
if (i < 0 || answer[0] == '\n') {
|
||||
if (i < 0 || *answer == '\n') {
|
||||
statusbar(_("Cancelled"));
|
||||
retval = FALSE;
|
||||
break;
|
||||
|
@ -1993,7 +1993,7 @@ char *real_dir_from_tilde(const char *buf)
|
|||
|
||||
assert(buf != NULL);
|
||||
|
||||
if (buf[0] == '~') {
|
||||
if (*buf == '~') {
|
||||
size_t i = 1;
|
||||
char *tilde_dir;
|
||||
|
||||
|
@ -2255,7 +2255,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
|||
|
||||
/* If the word starts with `~' and there is no slash in the word,
|
||||
* then try completing this word as a username. */
|
||||
if (*place > 0 && buf[0] == '~') {
|
||||
if (*place > 0 && *buf == '~') {
|
||||
const char *bob = strchr(buf, '/');
|
||||
|
||||
if (bob == NULL || bob >= buf + *place)
|
||||
|
|
|
@ -609,7 +609,7 @@ void die_save_file(const char *die_filename)
|
|||
|
||||
/* If we can't save, we have really bad problems, but we might as
|
||||
* well try. */
|
||||
if (die_filename[0] == '\0')
|
||||
if (*die_filename == '\0')
|
||||
die_filename = "nano";
|
||||
|
||||
retval = get_next_filename(die_filename, ".save");
|
||||
|
|
|
@ -1077,7 +1077,7 @@ int get_prompt_string(bool allow_tabs,
|
|||
* magichistory is set, save magichistory in
|
||||
* answer. */
|
||||
if ((*history_list)->next == NULL &&
|
||||
answer[0] == '\0' && magichistory != NULL) {
|
||||
*answer == '\0' && magichistory != NULL) {
|
||||
answer = mallocstrcpy(answer, magichistory);
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
|
@ -1221,7 +1221,7 @@ int do_prompt(bool allow_tabs,
|
|||
retval = -1;
|
||||
break;
|
||||
case NANO_ENTER_KEY:
|
||||
retval = (answer[0] == '\0') ? -2 : 0;
|
||||
retval = (*answer == '\0') ? -2 : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,8 +208,8 @@ int search_init(bool replacing, bool use_answer)
|
|||
backupstring = NULL;
|
||||
|
||||
/* Cancel any search, or just return with no previous search. */
|
||||
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
|
||||
(!replacing && i == 0 && answer[0] == '\0')) {
|
||||
if (i == -1 || (i < 0 && *last_search == '\0') || (!replacing &&
|
||||
i == 0 && *answer == '\0')) {
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -444,7 +444,7 @@ void do_search(void)
|
|||
return;
|
||||
|
||||
/* If answer is now "", copy last_search into answer. */
|
||||
if (answer[0] == '\0')
|
||||
if (*answer == '\0')
|
||||
answer = mallocstrcpy(answer, last_search);
|
||||
else
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
|
|
|
@ -2189,7 +2189,7 @@ void titlebar(const char *path)
|
|||
state = openfile->modified ? _("Modified") : ISSET(VIEW_MODE) ?
|
||||
_("View") : "";
|
||||
|
||||
statelen = strlenpt((state[0] == '\0' && path == NULL) ?
|
||||
statelen = strlenpt((*state == '\0' && path == NULL) ?
|
||||
_("Modified") : state);
|
||||
|
||||
/* If possible, add a space before state. */
|
||||
|
|
Loading…
Reference in New Issue