+2009-11-29 Chris Allegretta <chrisa@asty.org>
+ * prompt.c (get_prompt_string) - Universally handle help key when is disabled. Fixes Savannah
+ bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
+ * chars.c, files.c: Add junk vars to silence the compiler. Sigh.
+
+2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
+ * Change several *chars to const char, additional cleanups and casts to make compilers happier.
+
2009-11-27 Chris Allegretta <chrisa@asty.org>
* nano.c (do_suspend): Don't clear the screen but do move the cursor down to the last line
first in an effort to not corrupt the screen, which contradicts Pico but is consistent
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
wc = bad_wchar;
}
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
wc = bad_wchar;
}
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
wc = bad_wchar;
}
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
wc = bad_wchar;
}
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
*crep_len = bad_mbchar_len;
strncpy(crep, bad_mbchar, *crep_len);
} else {
*crep_len = wctomb(crep, control_wrep(wc));
if (*crep_len < 0) {
- wctomb(NULL, 0);
+ int shutup = wctomb(NULL, 0);
*crep_len = 0;
}
}
/* Reject invalid Unicode characters. */
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
*crep_len = bad_mbchar_len;
strncpy(crep, bad_mbchar, *crep_len);
} else {
*crep_len = wctomb(crep, wc);
if (*crep_len < 0) {
- wctomb(NULL, 0);
+ int shutup = wctomb(NULL, 0);
*crep_len = 0;
}
}
int width;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
wc = bad_wchar;
}
/* Reject invalid Unicode characters. */
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
- wctomb(NULL, 0);
+ int shutup = wctomb(NULL, 0);
*chr_mb_len = 0;
}
} else {
/* If buf contains an invalid multibyte character, only
* interpret buf's first byte. */
if (buf_mb_len < 0) {
- mblen(NULL, 0);
+ int shutup = mblen(NULL, 0);
buf_mb_len = 1;
} else if (buf_mb_len == 0)
buf_mb_len++;
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
ws1 = (unsigned char)*s1_mb;
bad_s1_mb = TRUE;
}
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
ws2 = (unsigned char)*s2_mb;
bad_s2_mb = TRUE;
}
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
bad_c_mb = TRUE;
}
int s_mb_len = parse_mbchar(s, s_mb, NULL);
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
- mbtowc(NULL, NULL, 0);
+ int shutup = mbtowc(NULL, NULL, 0);
ws = (unsigned char)*s;
bad_s_mb = TRUE;
}
char *d_here, *d_there, *d_there_file = NULL;
const char *last_slash;
bool path_only;
+ int shutup;
if (origpath == NULL)
return NULL;
/* Finally, go back to the path specified in d_here,
* where we were before. We don't check for a chdir()
* error, since we can do nothing if we get one. */
- chdir(d_here);
+ shutup = chdir(d_here);
/* Free d_here, since we're done using it. */
free(d_here);
}
/* Set type of function based on the string */
-function_type strtokeytype(char *str)
+function_type strtokeytype(const char *str)
{
if (str[0] == 'M' || str[0] == 'm')
return META;
/* Add a string to the new shortcut list implementation
Allows updates to existing entries in the list */
-void add_to_sclist(int menu, char *scstring, short func, int toggle, int execute)
+void add_to_sclist(int menu, const char *scstring, short func, int toggle, int execute)
{
sc *s;
s->type = strtokeytype(scstring);
s->menu = menu;
s->toggle = toggle;
- s->keystr = scstring;
+ s->keystr = (char *) scstring;
s->scfunc = func;
s->execute = execute;
assign_keyinfo(s);
#ifndef NANO_TINY
/* Now lets come up with a single (hopefully)
function to get a string for each flag */
-char *flagtostr(int flag)
+const char *flagtostr(int flag)
{
switch (flag) {
case NO_HELP:
void alloc_multidata_if_needed(filestruct *fileptr)
{
if (!fileptr->multidata)
- fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
+ fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
}
/* Precalculate the multi-line start and end regex info so we can speed up
}
} else
#endif /* !NANO_TINY */
-#ifndef DISABLE_HELP
if (s && s->scfunc == DO_HELP_VOID) {
update_statusbar_line(answer, statusbar_x);
* prompt. */
finished = FALSE;
}
-#endif
/* If we have a shortcut with an associated function, break out
* if we're finished after running or trying to run the
void do_cursorpos(bool constant);
void do_cursorpos_void(void);
void do_replace_highlight(bool highlight, const char *word);
-char *flagtostr(int flag);
+const char *flagtostr(int flag);
const subnfunc *sctofunc(sc *s);
const subnfunc *getfuncfromkey(WINDOW *win);
void print_sclist(void);
sc *strtosc(int menu, char *input);
-function_type strtokeytype(char *str);
+function_type strtokeytype(const char *str);
int strtomenu(char *input);
void assign_keyinfo(sc *s);
void xon_complaint(void);
int sc_seq_or (short func, int defaultval);
void do_suspend_void(void);
-const char *cancel_msg;
-#ifndef NANO_TINY
-const char *case_sens_msg;
-const char *backwards_msg;
-const char *prev_history_msg;
-const char *next_history_msg;
-#endif
-const char *replace_msg;
-const char *no_replace_msg;
-const char *go_to_line_msg;
-const char *whereis_next_msg;
-const char *first_file_msg;
-const char *last_file_msg;
-const char *goto_dir_msg;
-const char *ext_cmd_msg;
-const char *to_files_msg;
-const char *dos_format_msg;
-const char *mac_format_msg;
-const char *append_msg;
-const char *prepend_msg;
-const char *backup_file_msg;
-const char *gototext_msg;
-const char *new_buffer_msg;
+extern const char *cancel_msg;
+#ifndef NANO_TINY
+extern const char *case_sens_msg;
+extern const char *backwards_msg;
+extern const char *prev_history_msg;
+extern const char *next_history_msg;
+#endif
+extern const char *replace_msg;
+extern const char *no_replace_msg;
+extern const char *go_to_line_msg;
+extern const char *whereis_next_msg;
+extern const char *first_file_msg;
+extern const char *last_file_msg;
+extern const char *goto_dir_msg;
+extern const char *ext_cmd_msg;
+extern const char *to_files_msg;
+extern const char *dos_format_msg;
+extern const char *mac_format_msg;
+extern const char *append_msg;
+extern const char *prepend_msg;
+extern const char *backup_file_msg;
+extern const char *gototext_msg;
+extern const char *new_buffer_msg;
+
void iso_me_harder_funcmap(short func);
void enable_nodelay(void);
void disable_nodelay(void);
#ifdef HAVE_REGEX_H
-const char *regexp_msg;
+extern const char *regexp_msg;
#endif
#ifdef NANO_EXTRA
free(output);
} else {
#endif
- do_output("\t", 1, TRUE);
+ do_output((char *) "\t", 1, TRUE);
#ifndef NANO_TINY
}
#endif
break;
case SPLIT:
undidmsg = _("line wrap");
- f->data = nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
+ f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
strcpy(&f->data[strlen(f->data) - 1], u->strdata);
if (u->strdata2 != NULL)
f->next->data = mallocstrcpy(f->next->data, u->strdata2);
undidmsg = _("line break");
if (f->next) {
filestruct *foo = f->next;
- f->data = nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
+ f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
strcat(f->data, f->next->data);
unlink_node(foo);
delete_node(foo);
* arguments. */
shellenv = getenv("SHELL");
if (shellenv == NULL)
- shellenv = "/bin/sh";
+ shellenv = (char *) "/bin/sh";
/* Fork a child. */
if ((pid = fork()) == 0) {
}
/* Allocate and initialize a new undo type */
- u = nmalloc(sizeof(undo));
+ u = (undo *) nmalloc(sizeof(undo));
u->type = current_action;
u->lineno = fs->current->lineno;
u->begin = fs->current_x;
fs->current->data, (unsigned long) fs->current_x, u->begin);
#endif
len = strlen(u->strdata) + 2;
- data = nrealloc((void *) u->strdata, len * sizeof(char *));
+ data = (char *) nrealloc((void *) u->strdata, len * sizeof(char *));
data[len-2] = fs->current->data[fs->current_x];
data[len-1] = '\0';
u->strdata = (char *) data;
if (fileptr->multidata == NULL && openfile->syntax
&& openfile->syntax->nmultis > 0) {
int i;
- fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
+ fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1; /* Assue this applies until we know otherwise */
}