mirror of
git://git.sv.gnu.org/nano.git
synced 2025-02-02 14:35:42 +03:00
various changes to cut down on binary size: per DB's patch, add new N_()
macro to mark strings that aren't translated immediately and convert nano to use it where needed, overhaul the shortcut list and toggle list initialization code for efficiency, and replace rcfile_msg() with rcfile_error(); also add a few minor miscellaneous cleanups by DB and myself git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1852 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
d717d4bac6
commit
576bf331ef
20
ChangeLog
20
ChangeLog
@ -16,6 +16,18 @@ CVS code -
|
|||||||
descriptive. (DLR)
|
descriptive. (DLR)
|
||||||
- Remove unused global variable search_offscreen. (David
|
- Remove unused global variable search_offscreen. (David
|
||||||
Benbennick)
|
Benbennick)
|
||||||
|
- Add new N_() macro to mark strings that aren't translated
|
||||||
|
immediately, and convert nano to use it in cases where the
|
||||||
|
same translated string is stored in a const char* and used
|
||||||
|
more than once. (David Benbennick) DLR: Do this for the
|
||||||
|
toggles list for consistency with the shortcut list.
|
||||||
|
- Overhaul the shortcut list and toggle list initialization
|
||||||
|
code for efficiency. Changes to shortcut_init() and
|
||||||
|
toggle_init(). (David Benbennick) DLR: Move "Cancel" to just
|
||||||
|
after "Get Help" in the file browser list, for consistency
|
||||||
|
with all the other lists, have the replace list accept all the
|
||||||
|
same function keys as the search list, and clarify a few
|
||||||
|
shortcut descriptions.
|
||||||
- files.c:
|
- files.c:
|
||||||
close_open_file()
|
close_open_file()
|
||||||
- Tweak to no longer rely on the return values of
|
- Tweak to no longer rely on the return values of
|
||||||
@ -32,6 +44,8 @@ CVS code -
|
|||||||
shortcut_init()
|
shortcut_init()
|
||||||
- Fix erroneous #ifdef so that nano compiles with
|
- Fix erroneous #ifdef so that nano compiles with
|
||||||
--disable-justify again. (DLR; found by Mike Frysinger)
|
--disable-justify again. (DLR; found by Mike Frysinger)
|
||||||
|
thanks_for_all_the_fish()
|
||||||
|
- Delete topwin, edit, and bottomwin. (David Benbennick)
|
||||||
- nano.c:
|
- nano.c:
|
||||||
do_justify()
|
do_justify()
|
||||||
- Add on_next_line flag, used to indicate when we've moved to
|
- Add on_next_line flag, used to indicate when we've moved to
|
||||||
@ -47,6 +61,12 @@ CVS code -
|
|||||||
used in the actual functions. (DLR)
|
used in the actual functions. (DLR)
|
||||||
- Remove unused declaration of temp_opt. (David Benbennick)
|
- Remove unused declaration of temp_opt. (David Benbennick)
|
||||||
- rcfile.c:
|
- rcfile.c:
|
||||||
|
rcfile_msg()
|
||||||
|
- Removed along with the related static int errors, and replaced
|
||||||
|
with calls to rcfile_error(). (David Benbennick)
|
||||||
|
- Removed the reference to "starting nano" in the statusbar
|
||||||
|
message, as it may be called when we exit if the history file
|
||||||
|
can't be saved. (DLR)
|
||||||
parse_rcfile()
|
parse_rcfile()
|
||||||
- Have whitespace display default to off instead of on. (Mike
|
- Have whitespace display default to off instead of on. (Mike
|
||||||
Frysinger)
|
Frysinger)
|
||||||
|
49
src/files.c
49
src/files.c
@ -555,7 +555,7 @@ void do_insertfile(int loading_file)
|
|||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
realname = real_dir_from_tilde(answer);
|
realname = real_dir_from_tilde(answer);
|
||||||
i = open_file(realname, 1, loading_file);
|
i = open_file(realname, TRUE, loading_file);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -848,7 +848,8 @@ void load_open_file(void)
|
|||||||
|
|
||||||
/* restore full file position: line number, x-coordinate, y-
|
/* restore full file position: line number, x-coordinate, y-
|
||||||
coordinate, place we want */
|
coordinate, place we want */
|
||||||
do_gotopos(open_files->file_lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
do_gotopos(open_files->file_lineno, open_files->file_current_x,
|
||||||
|
open_files->file_current_y, open_files->file_placewewant);
|
||||||
|
|
||||||
/* update the titlebar */
|
/* update the titlebar */
|
||||||
clearok(topwin, FALSE);
|
clearok(topwin, FALSE);
|
||||||
@ -1821,33 +1822,33 @@ int do_writeout(int exiting)
|
|||||||
const char *formatstr, *backupstr;
|
const char *formatstr, *backupstr;
|
||||||
|
|
||||||
if (ISSET(MAC_FILE))
|
if (ISSET(MAC_FILE))
|
||||||
formatstr = _(" [Mac Format]");
|
formatstr = N_(" [Mac Format]");
|
||||||
else if (ISSET(DOS_FILE))
|
else if (ISSET(DOS_FILE))
|
||||||
formatstr = _(" [DOS Format]");
|
formatstr = N_(" [DOS Format]");
|
||||||
else
|
else
|
||||||
formatstr = "";
|
formatstr = "";
|
||||||
|
|
||||||
if (ISSET(BACKUP_FILE))
|
if (ISSET(BACKUP_FILE))
|
||||||
backupstr = _(" [Backup]");
|
backupstr = N_(" [Backup]");
|
||||||
else
|
else
|
||||||
backupstr = "";
|
backupstr = "";
|
||||||
|
|
||||||
/* Be nice to the translation folks. */
|
/* Be nice to the translation folks. */
|
||||||
if (ISSET(MARK_ISSET) && !exiting) {
|
if (ISSET(MARK_ISSET) && !exiting) {
|
||||||
if (append == 2)
|
if (append == 2)
|
||||||
msg = _("Prepend Selection to File");
|
msg = N_("Prepend Selection to File");
|
||||||
else if (append == 1)
|
else if (append == 1)
|
||||||
msg = _("Append Selection to File");
|
msg = N_("Append Selection to File");
|
||||||
else
|
else
|
||||||
msg = _("Write Selection to File");
|
msg = N_("Write Selection to File");
|
||||||
} else
|
} else
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
if (append == 2)
|
if (append == 2)
|
||||||
msg = _("File Name to Prepend to");
|
msg = N_("File Name to Prepend to");
|
||||||
else if (append == 1)
|
else if (append == 1)
|
||||||
msg = _("File Name to Append to");
|
msg = N_("File Name to Append to");
|
||||||
else
|
else
|
||||||
msg = _("File Name to Write");
|
msg = N_("File Name to Write");
|
||||||
|
|
||||||
/* If we're using restricted mode, the filename isn't blank,
|
/* If we're using restricted mode, the filename isn't blank,
|
||||||
* and we're at the "Write File" prompt, disable tab
|
* and we're at the "Write File" prompt, disable tab
|
||||||
@ -1855,9 +1856,9 @@ int do_writeout(int exiting)
|
|||||||
i = statusq(!ISSET(RESTRICTED) || filename[0] == '\0' ? TRUE :
|
i = statusq(!ISSET(RESTRICTED) || filename[0] == '\0' ? TRUE :
|
||||||
FALSE, writefile_list,
|
FALSE, writefile_list,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
ans, NULL, "%s%s%s", msg, formatstr, backupstr
|
ans, NULL, "%s%s%s", _(msg), formatstr, backupstr
|
||||||
#else
|
#else
|
||||||
filename, "%s", msg
|
filename, "%s", _(msg)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2953,7 +2954,8 @@ void load_history(void)
|
|||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
/* Don't save history when we quit. */
|
/* Don't save history when we quit. */
|
||||||
UNSET(HISTORYLOG);
|
UNSET(HISTORYLOG);
|
||||||
rcfile_error(_("Unable to open ~/.nano_history file: %s"), strerror(errno));
|
rcfile_error(N_("Unable to open ~/.nano_history file: %s"),
|
||||||
|
strerror(errno));
|
||||||
}
|
}
|
||||||
free(nanohist);
|
free(nanohist);
|
||||||
} else {
|
} else {
|
||||||
@ -2986,8 +2988,8 @@ void save_history(void)
|
|||||||
historytype *h;
|
historytype *h;
|
||||||
|
|
||||||
/* don't save unchanged or empty histories */
|
/* don't save unchanged or empty histories */
|
||||||
if (!((search_history.count || replace_history.count) &&
|
if ((search_history.count == 0 && replace_history.count == 0) ||
|
||||||
ISSET(HISTORY_CHANGED) && !ISSET(VIEW_MODE)))
|
!ISSET(HISTORY_CHANGED) || ISSET(VIEW_MODE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (homenv != NULL) {
|
if (homenv != NULL) {
|
||||||
@ -3003,7 +3005,8 @@ void save_history(void)
|
|||||||
if (homenv != NULL || userage != NULL) {
|
if (homenv != NULL || userage != NULL) {
|
||||||
hist = fopen(nanohist, "wb");
|
hist = fopen(nanohist, "wb");
|
||||||
if (hist == NULL) {
|
if (hist == NULL) {
|
||||||
rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno));
|
rcfile_error(N_("Unable to write ~/.nano_history file: %s"),
|
||||||
|
strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
/* set rw only by owner for security ?? */
|
/* set rw only by owner for security ?? */
|
||||||
chmod(nanohist, S_IRUSR | S_IWUSR);
|
chmod(nanohist, S_IRUSR | S_IWUSR);
|
||||||
@ -3012,19 +3015,25 @@ void save_history(void)
|
|||||||
h->data = charealloc(h->data, strlen(h->data) + 2);
|
h->data = charealloc(h->data, strlen(h->data) + 2);
|
||||||
strcat(h->data, "\n");
|
strcat(h->data, "\n");
|
||||||
if (fputs(h->data, hist) == EOF) {
|
if (fputs(h->data, hist) == EOF) {
|
||||||
rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno));
|
rcfile_error(
|
||||||
|
N_("Unable to write ~/.nano_history file: %s"),
|
||||||
|
strerror(errno));
|
||||||
goto come_from;
|
goto come_from;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fputs("\n", hist) == EOF) {
|
if (fputs("\n", hist) == EOF) {
|
||||||
rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno));
|
rcfile_error(
|
||||||
|
N_("Unable to write ~/.nano_history file: %s"),
|
||||||
|
strerror(errno));
|
||||||
goto come_from;
|
goto come_from;
|
||||||
}
|
}
|
||||||
for (h = replace_history.tail; h->prev; h = h->prev) {
|
for (h = replace_history.tail; h->prev; h = h->prev) {
|
||||||
h->data = charealloc(h->data, strlen(h->data) + 2);
|
h->data = charealloc(h->data, strlen(h->data) + 2);
|
||||||
strcat(h->data, "\n");
|
strcat(h->data, "\n");
|
||||||
if (fputs(h->data, hist) == EOF) {
|
if (fputs(h->data, hist) == EOF) {
|
||||||
rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno));
|
rcfile_error(
|
||||||
|
N_("Unable to write ~/.nano_history file: %s"),
|
||||||
|
strerror(errno));
|
||||||
goto come_from;
|
goto come_from;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
655
src/global.c
655
src/global.c
File diff suppressed because it is too large
Load Diff
@ -1797,7 +1797,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
#endif
|
#endif
|
||||||
free_filestruct(fileage);
|
free_filestruct(fileage);
|
||||||
global_init(TRUE);
|
global_init(TRUE);
|
||||||
open_file(tempfile_name, 0, 1);
|
open_file(tempfile_name, FALSE, TRUE);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3504,7 +3504,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Main: open file\n");
|
fprintf(stderr, "Main: open file\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
open_file(filename, 0, 0);
|
open_file(filename, FALSE, FALSE);
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* If we're using multibuffers and more than one file is specified
|
/* If we're using multibuffers and more than one file is specified
|
||||||
on the command line, load them all and switch to the first one
|
on the command line, load them all and switch to the first one
|
||||||
@ -3516,7 +3516,7 @@ int main(int argc, char *argv[])
|
|||||||
add_open_file(TRUE);
|
add_open_file(TRUE);
|
||||||
new_file();
|
new_file();
|
||||||
filename = mallocstrcpy(filename, argv[optind]);
|
filename = mallocstrcpy(filename, argv[optind]);
|
||||||
open_file(filename, 0, 0);
|
open_file(filename, FALSE, FALSE);
|
||||||
load_file(FALSE);
|
load_file(FALSE);
|
||||||
}
|
}
|
||||||
open_nextfile_void();
|
open_nextfile_void();
|
||||||
|
@ -76,6 +76,9 @@
|
|||||||
# define _(string) (string)
|
# define _(string) (string)
|
||||||
# define P_(singular, plural, number) (number == 1 ? singular : plural)
|
# define P_(singular, plural, number) (number == 1 ? singular : plural)
|
||||||
#endif
|
#endif
|
||||||
|
#define gettext_noop(string) (string)
|
||||||
|
#define N_(string) gettext_noop(string)
|
||||||
|
/* Mark a string that will be sent to gettext later. */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
17
src/proto.h
17
src/proto.h
@ -219,12 +219,6 @@ char *do_browse_from(const char *inpath);
|
|||||||
|
|
||||||
/* Public functions in global.c */
|
/* Public functions in global.c */
|
||||||
size_t length_of_list(const shortcut *s);
|
size_t length_of_list(const shortcut *s);
|
||||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
|
||||||
#ifndef DISABLE_HELP
|
|
||||||
const char *help,
|
|
||||||
#endif
|
|
||||||
int metaval, int funcval, int miscval, int view, void
|
|
||||||
(*func)(void));
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
void toggle_init_one(int val, const char *desc, long flag);
|
void toggle_init_one(int val, const char *desc, long flag);
|
||||||
void toggle_init(void);
|
void toggle_init(void);
|
||||||
@ -232,8 +226,14 @@ void toggle_init(void);
|
|||||||
void free_toggles(void);
|
void free_toggles(void);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
void free_shortcutage(shortcut **shortcutage);
|
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||||
|
#ifndef DISABLE_HELP
|
||||||
|
const char *help,
|
||||||
|
#endif
|
||||||
|
int metaval, int funcval, int miscval, int view, void
|
||||||
|
(*func)(void));
|
||||||
void shortcut_init(int unjustify);
|
void shortcut_init(int unjustify);
|
||||||
|
void free_shortcutage(shortcut **shortcutage);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void thanks_for_all_the_fish(void);
|
void thanks_for_all_the_fish(void);
|
||||||
#endif
|
#endif
|
||||||
@ -365,7 +365,6 @@ void enable_flow_control(void);
|
|||||||
/* Public functions in rcfile.c */
|
/* Public functions in rcfile.c */
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
void rcfile_error(const char *msg, ...);
|
void rcfile_error(const char *msg, ...);
|
||||||
void rcfile_msg(const char *msg, ...);
|
|
||||||
char *parse_next_word(char *ptr);
|
char *parse_next_word(char *ptr);
|
||||||
char *parse_argument(char *ptr);
|
char *parse_argument(char *ptr);
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
@ -555,7 +554,7 @@ void total_refresh(void);
|
|||||||
void display_main_list(void);
|
void display_main_list(void);
|
||||||
void do_cursorpos(int constant);
|
void do_cursorpos(int constant);
|
||||||
void do_cursorpos_void(void);
|
void do_cursorpos_void(void);
|
||||||
int line_len(const char *ptr);
|
size_t line_len(const char *ptr);
|
||||||
void do_help(void);
|
void do_help(void);
|
||||||
void do_replace_highlight(int highlight_flag, const char *word);
|
void do_replace_highlight(int highlight_flag, const char *word);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
79
src/rcfile.c
79
src/rcfile.c
@ -100,7 +100,6 @@ const static rcoption rcopts[] = {
|
|||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int errors = 0;
|
|
||||||
static int lineno = 0;
|
static int lineno = 0;
|
||||||
static char *nanorc;
|
static char *nanorc;
|
||||||
|
|
||||||
@ -115,26 +114,12 @@ void rcfile_error(const char *msg, ...)
|
|||||||
fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
|
fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
vfprintf(stderr, msg, ap);
|
vfprintf(stderr, _(msg), ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fprintf(stderr, _("\nPress return to continue starting nano\n"));
|
fprintf(stderr, _("\nPress Return to continue\n"));
|
||||||
|
|
||||||
while (getchar() != '\n');
|
while (getchar() != '\n')
|
||||||
}
|
;
|
||||||
|
|
||||||
/* Just print the error (one of many, perhaps) but don't abort, yet. */
|
|
||||||
void rcfile_msg(const char *msg, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
if (!errors) {
|
|
||||||
errors = 1;
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
va_start(ap, msg);
|
|
||||||
vfprintf(stderr, msg, ap);
|
|
||||||
va_end(ap);
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the next word from the string. Returns NULL if we hit EOL. */
|
/* Parse the next word from the string. Returns NULL if we hit EOL. */
|
||||||
@ -183,7 +168,7 @@ char *parse_argument(char *ptr)
|
|||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
else
|
else
|
||||||
*ptr++ = '\0';
|
*ptr++ = '\0';
|
||||||
rcfile_error(_("Argument %s has unterminated \""), ptr_bak);
|
rcfile_error(N_("Argument %s has unterminated \""), ptr_bak);
|
||||||
} else {
|
} else {
|
||||||
*last_quote = '\0';
|
*last_quote = '\0';
|
||||||
ptr = last_quote + 1;
|
ptr = last_quote + 1;
|
||||||
@ -225,7 +210,7 @@ int colortoint(const char *colorname, int *bright)
|
|||||||
else if (!strcasecmp(colorname, "black"))
|
else if (!strcasecmp(colorname, "black"))
|
||||||
mcolor = COLOR_BLACK;
|
mcolor = COLOR_BLACK;
|
||||||
else {
|
else {
|
||||||
rcfile_error(_("Color %s not understood.\n"
|
rcfile_error(N_("Color %s not understood.\n"
|
||||||
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
||||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
||||||
"\"black\", with the optional prefix \"bright\" \n"
|
"\"black\", with the optional prefix \"bright\" \n"
|
||||||
@ -264,7 +249,7 @@ int nregcomp(regex_t *preg, const char *regex, int eflags)
|
|||||||
char *str = charalloc(len);
|
char *str = charalloc(len);
|
||||||
|
|
||||||
regerror(rc, preg, str, len);
|
regerror(rc, preg, str, len);
|
||||||
rcfile_error(_("Bad regex \"%s\": %s"), regex, str);
|
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
return rc != 0;
|
return rc != 0;
|
||||||
@ -284,7 +269,8 @@ void parse_syntax(char *ptr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(_("Regex strings must begin and end with a \" character\n"));
|
rcfile_error(
|
||||||
|
N_("Regex strings must begin and end with a \" character\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -293,7 +279,7 @@ void parse_syntax(char *ptr)
|
|||||||
ptr = parse_next_regex(ptr);
|
ptr = parse_next_regex(ptr);
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
rcfile_error(_("Missing syntax name"));
|
rcfile_error(N_("Missing syntax name"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +348,7 @@ void parse_colors(char *ptr)
|
|||||||
ptr = parse_next_word(ptr);
|
ptr = parse_next_word(ptr);
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
rcfile_error(_("Missing color name"));
|
rcfile_error(N_("Missing color name"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +357,8 @@ void parse_colors(char *ptr)
|
|||||||
strtok(fgstr, ",");
|
strtok(fgstr, ",");
|
||||||
bgcolorname = strtok(NULL, ",");
|
bgcolorname = strtok(NULL, ",");
|
||||||
if (!strncasecmp(bgcolorname, "bright", 6)) {
|
if (!strncasecmp(bgcolorname, "bright", 6)) {
|
||||||
rcfile_error(_("Background color %s cannot be bright"), bgcolorname);
|
rcfile_error(N_("Background color %s cannot be bright"),
|
||||||
|
bgcolorname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bg = colortoint(bgcolorname, &bright);
|
bg = colortoint(bgcolorname, &bright);
|
||||||
@ -385,7 +372,7 @@ void parse_colors(char *ptr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (syntaxes == NULL) {
|
if (syntaxes == NULL) {
|
||||||
rcfile_error(_("Cannot add a color directive without a syntax line"));
|
rcfile_error(N_("Cannot add a color directive without a syntax line"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +401,8 @@ void parse_colors(char *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(_("Regex strings must begin and end with a \" character\n"));
|
rcfile_error(
|
||||||
|
N_("Regex strings must begin and end with a \" character\n"));
|
||||||
ptr = parse_next_regex(ptr);
|
ptr = parse_next_regex(ptr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -452,16 +440,16 @@ void parse_colors(char *ptr)
|
|||||||
|
|
||||||
if (expectend) {
|
if (expectend) {
|
||||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4)) {
|
if (ptr == NULL || strncasecmp(ptr, "end=", 4)) {
|
||||||
rcfile_error(_
|
rcfile_error(
|
||||||
("\"start=\" requires a corresponding \"end=\""));
|
N_("\"start=\" requires a corresponding \"end=\""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(_
|
rcfile_error(
|
||||||
("Regex strings must begin and end with a \" character\n"));
|
N_("Regex strings must begin and end with a \" character\n"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -525,7 +513,7 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
parse_colors(ptr);
|
parse_colors(ptr);
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
else {
|
else {
|
||||||
rcfile_msg(_("Command %s not understood"), keyword);
|
rcfile_error(N_("Command %s not understood"), keyword);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,8 +552,8 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
if (*ptr == '\n' || *ptr == '\0') {
|
if (*ptr == '\n' || *ptr == '\0') {
|
||||||
rcfile_error(_
|
rcfile_error(
|
||||||
("Option %s requires an argument"),
|
N_("Option %s requires an argument"),
|
||||||
rcopts[i].name);
|
rcopts[i].name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -590,7 +578,8 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
* errors. */
|
* errors. */
|
||||||
j = (int)strtol(option, &first_error, 10);
|
j = (int)strtol(option, &first_error, 10);
|
||||||
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
||||||
rcfile_error(_("Requested fill size %d invalid"),
|
rcfile_error(
|
||||||
|
N_("Requested fill size %d invalid"),
|
||||||
j);
|
j);
|
||||||
else
|
else
|
||||||
wrap_at = j;
|
wrap_at = j;
|
||||||
@ -602,7 +591,8 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
whitespace = mallocstrcpy(NULL, option);
|
whitespace = mallocstrcpy(NULL, option);
|
||||||
ws_len = strlen(whitespace);
|
ws_len = strlen(whitespace);
|
||||||
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
|
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
|
||||||
rcfile_error(_("Two non-control characters required"));
|
rcfile_error(
|
||||||
|
N_("Two non-control characters required"));
|
||||||
free(whitespace);
|
free(whitespace);
|
||||||
whitespace = NULL;
|
whitespace = NULL;
|
||||||
}
|
}
|
||||||
@ -612,14 +602,16 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
if (!strcasecmp(rcopts[i].name, "punct")) {
|
if (!strcasecmp(rcopts[i].name, "punct")) {
|
||||||
punct = mallocstrcpy(NULL, option);
|
punct = mallocstrcpy(NULL, option);
|
||||||
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
|
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
|
||||||
rcfile_error(_("Non-tab and non-space characters required"));
|
rcfile_error(
|
||||||
|
N_("Non-tab and non-space characters required"));
|
||||||
free(punct);
|
free(punct);
|
||||||
punct = NULL;
|
punct = NULL;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(rcopts[i].name, "brackets")) {
|
} else if (!strcasecmp(rcopts[i].name, "brackets")) {
|
||||||
brackets = mallocstrcpy(NULL, option);
|
brackets = mallocstrcpy(NULL, option);
|
||||||
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
|
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
|
||||||
rcfile_error(_("Non-tab and non-space characters required"));
|
rcfile_error(
|
||||||
|
N_("Non-tab and non-space characters required"));
|
||||||
free(brackets);
|
free(brackets);
|
||||||
brackets = NULL;
|
brackets = NULL;
|
||||||
}
|
}
|
||||||
@ -645,7 +637,7 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
* errors. */
|
* errors. */
|
||||||
j = (int)strtol(option, &first_error, 10);
|
j = (int)strtol(option, &first_error, 10);
|
||||||
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
||||||
rcfile_error(_("Requested tab size %d invalid"),
|
rcfile_error(N_("Requested tab size %d invalid"),
|
||||||
j);
|
j);
|
||||||
else
|
else
|
||||||
tabsize = j;
|
tabsize = j;
|
||||||
@ -668,9 +660,6 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
if (errors)
|
|
||||||
rcfile_error(_("Errors found in .nanorc file"));
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +694,7 @@ void do_rcfile(void)
|
|||||||
endpwent();
|
endpwent();
|
||||||
|
|
||||||
if (userage == NULL) {
|
if (userage == NULL) {
|
||||||
rcfile_error(_("I can't find my home directory! Wah!"));
|
rcfile_error(N_("I can't find my home directory! Wah!"));
|
||||||
SET(NO_RCFILE);
|
SET(NO_RCFILE);
|
||||||
} else {
|
} else {
|
||||||
nanorc = charealloc(nanorc, strlen(userage->pw_dir) + 9);
|
nanorc = charealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||||
@ -725,7 +714,7 @@ void do_rcfile(void)
|
|||||||
if ((rcstream = fopen(nanorc, "r")) == NULL) {
|
if ((rcstream = fopen(nanorc, "r")) == NULL) {
|
||||||
/* Don't complain about the file not existing */
|
/* Don't complain about the file not existing */
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
rcfile_error(_("Unable to open ~/.nanorc file, %s"),
|
rcfile_error(N_("Unable to open ~/.nanorc file, %s"),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
SET(NO_RCFILE);
|
SET(NO_RCFILE);
|
||||||
}
|
}
|
||||||
|
10
src/search.c
10
src/search.c
@ -361,7 +361,8 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
|||||||
/* Search for a string. */
|
/* Search for a string. */
|
||||||
void do_search(void)
|
void do_search(void)
|
||||||
{
|
{
|
||||||
int old_pww = placewewant, i, fileptr_x = current_x, didfind;
|
size_t old_pww = placewewant, i, fileptr_x = current_x;
|
||||||
|
int didfind;
|
||||||
filestruct *fileptr = current;
|
filestruct *fileptr = current;
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
@ -428,7 +429,8 @@ void do_search(void)
|
|||||||
/* Search for the next string without prompting. */
|
/* Search for the next string without prompting. */
|
||||||
void do_research(void)
|
void do_research(void)
|
||||||
{
|
{
|
||||||
int old_pww = placewewant, fileptr_x = current_x, didfind;
|
size_t old_pww = placewewant, fileptr_x = current_x;
|
||||||
|
int didfind;
|
||||||
filestruct *fileptr = current;
|
filestruct *fileptr = current;
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
@ -583,7 +585,7 @@ char *replace_line(const char *needle)
|
|||||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||||
size_t *real_current_x, int wholewords)
|
size_t *real_current_x, int wholewords)
|
||||||
{
|
{
|
||||||
int old_pww = placewewant, replaceall = 0, numreplaced = -1;
|
int old_pww = placewewant, replaceall = FALSE, numreplaced = -1;
|
||||||
size_t current_x_save = current_x;
|
size_t current_x_save = current_x;
|
||||||
const filestruct *current_save = current;
|
const filestruct *current_save = current;
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
@ -677,7 +679,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
|||||||
int length_change;
|
int length_change;
|
||||||
|
|
||||||
if (i == 2)
|
if (i == 2)
|
||||||
replaceall = 1;
|
replaceall = TRUE;
|
||||||
|
|
||||||
copy = replace_line(needle);
|
copy = replace_line(needle);
|
||||||
|
|
||||||
|
26
src/winio.c
26
src/winio.c
@ -2945,9 +2945,9 @@ void display_main_list(void)
|
|||||||
bottombars(main_list);
|
bottombars(main_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If constant is FALSE, the user typed ^C so we unconditionally display
|
/* If constant is FALSE, the user typed Ctrl-C, so we unconditionally
|
||||||
* the cursor position. Otherwise, we display it only if the character
|
* display the cursor position. Otherwise, we display it only if the
|
||||||
* position changed, and DISABLE_CURPOS is not set.
|
* character position changed and DISABLE_CURPOS is not set.
|
||||||
*
|
*
|
||||||
* If constant is TRUE and DISABLE_CURPOS is set, we unset it and update
|
* If constant is TRUE and DISABLE_CURPOS is set, we unset it and update
|
||||||
* old_i and old_totsize. That way, we leave the current statusbar
|
* old_i and old_totsize. That way, we leave the current statusbar
|
||||||
@ -3007,9 +3007,9 @@ void do_cursorpos_void(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the next line of help_text, starting at ptr. */
|
/* Calculate the next line of help_text, starting at ptr. */
|
||||||
int line_len(const char *ptr)
|
size_t line_len(const char *ptr)
|
||||||
{
|
{
|
||||||
int j = 0;
|
size_t j = 0;
|
||||||
|
|
||||||
while (*ptr != '\n' && *ptr != '\0' && j < COLS - 5) {
|
while (*ptr != '\n' && *ptr != '\0' && j < COLS - 5) {
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -3288,14 +3288,14 @@ void do_credits(void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *xlcredits[XLCREDIT_LEN] = {
|
const char *xlcredits[XLCREDIT_LEN] = {
|
||||||
"The nano text editor",
|
N_("The nano text editor"),
|
||||||
"version",
|
N_("version"),
|
||||||
"Brought to you by:",
|
N_("Brought to you by:"),
|
||||||
"Special thanks to:",
|
N_("Special thanks to:"),
|
||||||
"The Free Software Foundation",
|
N_("The Free Software Foundation"),
|
||||||
"For ncurses:",
|
N_("For ncurses:"),
|
||||||
"and anyone else we forgot...",
|
N_("and anyone else we forgot..."),
|
||||||
"Thank you for using nano!"
|
N_("Thank you for using nano!")
|
||||||
};
|
};
|
||||||
|
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user