more cosmetic fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2007-07-01 21:33:17 +00:00
parent 10442330bf
commit 1904f51fb5
6 changed files with 17 additions and 17 deletions

View File

@ -227,7 +227,7 @@ char *do_browser(char *path, DIR *dir)
/* If the directory begins with a newline (i.e. an /* If the directory begins with a newline (i.e. an
* encoded null), treat it as though it's blank. */ * 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 /* We canceled. Indicate that on the statusbar, and
* blank out ans, since we're done with it. */ * blank out ans, since we're done with it. */
statusbar(_("Cancelled")); statusbar(_("Cancelled"));
@ -827,8 +827,8 @@ int filesearch_init(void)
backupstring = NULL; backupstring = NULL;
/* Cancel any search, or just return with no previous search. */ /* Cancel any search, or just return with no previous search. */
if (i == -1 || (i < 0 && last_search[0] == '\0') || if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 &&
(i == 0 && answer[0] == '\0')) { *answer == '\0')) {
statusbar(_("Cancelled")); statusbar(_("Cancelled"));
return -1; return -1;
} else { } else {
@ -983,7 +983,7 @@ void do_filesearch(void)
return; return;
/* If answer is now "", copy last_search into answer. */ /* If answer is now "", copy last_search into answer. */
if (answer[0] == '\0') if (*answer == '\0')
answer = mallocstrcpy(answer, last_search); answer = mallocstrcpy(answer, last_search);
else else
last_search = mallocstrcpy(last_search, answer); last_search = mallocstrcpy(last_search, answer);

View File

@ -741,7 +741,7 @@ void do_insertfile(
* blank, open a new buffer instead of canceling. If the * blank, open a new buffer instead of canceling. If the
* filename or command begins with a newline (i.e. an encoded * filename or command begins with a newline (i.e. an encoded
* null), treat it as though it's blank. */ * 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 #ifdef ENABLE_MULTIBUFFER
&& !ISSET(MULTIBUFFER) && !ISSET(MULTIBUFFER)
#endif #endif
@ -1307,7 +1307,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
assert(name != NULL); assert(name != NULL);
if (name[0] == '\0') if (*name == '\0')
return -1; return -1;
if (f_open != NULL) 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); sprintf(backupname, "%s%s", backup_dir, backuptemp);
free(backuptemp); free(backuptemp);
backuptemp = get_next_filename(backupname, "~"); backuptemp = get_next_filename(backupname, "~");
if (backuptemp[0] == '\0') { if (*backuptemp == '\0') {
statusbar(_("Error writing %s: %s"), backupname, statusbar(_("Error writing %s: %s"), backupname,
_("Too many backup files?")); _("Too many backup files?"));
free(backuptemp); free(backuptemp);
@ -1833,7 +1833,7 @@ bool do_writeout(bool exiting)
/* If the filename or command begins with a newline (i.e. an /* If the filename or command begins with a newline (i.e. an
* encoded null), treat it as though it's blank. */ * encoded null), treat it as though it's blank. */
if (i < 0 || answer[0] == '\n') { if (i < 0 || *answer == '\n') {
statusbar(_("Cancelled")); statusbar(_("Cancelled"));
retval = FALSE; retval = FALSE;
break; break;
@ -1993,7 +1993,7 @@ char *real_dir_from_tilde(const char *buf)
assert(buf != NULL); assert(buf != NULL);
if (buf[0] == '~') { if (*buf == '~') {
size_t i = 1; size_t i = 1;
char *tilde_dir; 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, /* If the word starts with `~' and there is no slash in the word,
* then try completing this word as a username. */ * then try completing this word as a username. */
if (*place > 0 && buf[0] == '~') { if (*place > 0 && *buf == '~') {
const char *bob = strchr(buf, '/'); const char *bob = strchr(buf, '/');
if (bob == NULL || bob >= buf + *place) if (bob == NULL || bob >= buf + *place)

View File

@ -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 /* If we can't save, we have really bad problems, but we might as
* well try. */ * well try. */
if (die_filename[0] == '\0') if (*die_filename == '\0')
die_filename = "nano"; die_filename = "nano";
retval = get_next_filename(die_filename, ".save"); retval = get_next_filename(die_filename, ".save");

View File

@ -1077,7 +1077,7 @@ int get_prompt_string(bool allow_tabs,
* magichistory is set, save magichistory in * magichistory is set, save magichistory in
* answer. */ * answer. */
if ((*history_list)->next == NULL && if ((*history_list)->next == NULL &&
answer[0] == '\0' && magichistory != NULL) { *answer == '\0' && magichistory != NULL) {
answer = mallocstrcpy(answer, magichistory); answer = mallocstrcpy(answer, magichistory);
statusbar_x = strlen(answer); statusbar_x = strlen(answer);
} }
@ -1221,7 +1221,7 @@ int do_prompt(bool allow_tabs,
retval = -1; retval = -1;
break; break;
case NANO_ENTER_KEY: case NANO_ENTER_KEY:
retval = (answer[0] == '\0') ? -2 : 0; retval = (*answer == '\0') ? -2 : 0;
break; break;
} }

View File

@ -208,8 +208,8 @@ int search_init(bool replacing, bool use_answer)
backupstring = NULL; backupstring = NULL;
/* Cancel any search, or just return with no previous search. */ /* Cancel any search, or just return with no previous search. */
if (i == -1 || (i < 0 && last_search[0] == '\0') || if (i == -1 || (i < 0 && *last_search == '\0') || (!replacing &&
(!replacing && i == 0 && answer[0] == '\0')) { i == 0 && *answer == '\0')) {
statusbar(_("Cancelled")); statusbar(_("Cancelled"));
return -1; return -1;
} else { } else {
@ -444,7 +444,7 @@ void do_search(void)
return; return;
/* If answer is now "", copy last_search into answer. */ /* If answer is now "", copy last_search into answer. */
if (answer[0] == '\0') if (*answer == '\0')
answer = mallocstrcpy(answer, last_search); answer = mallocstrcpy(answer, last_search);
else else
last_search = mallocstrcpy(last_search, answer); last_search = mallocstrcpy(last_search, answer);

View File

@ -2189,7 +2189,7 @@ void titlebar(const char *path)
state = openfile->modified ? _("Modified") : ISSET(VIEW_MODE) ? state = openfile->modified ? _("Modified") : ISSET(VIEW_MODE) ?
_("View") : ""; _("View") : "";
statelen = strlenpt((state[0] == '\0' && path == NULL) ? statelen = strlenpt((*state == '\0' && path == NULL) ?
_("Modified") : state); _("Modified") : state);
/* If possible, add a space before state. */ /* If possible, add a space before state. */