From ca3bc0d95d7deab4f5381f12b15047de748c0814 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Sat, 30 Jan 2016 00:25:53 +0900 Subject: 37838: use UNUSED() consistently --- Src/Modules/curses.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Src/Modules/curses.c') diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c index 64329f643..b8a79ed11 100644 --- a/Src/Modules/curses.c +++ b/Src/Modules/curses.c @@ -299,7 +299,7 @@ zcurses_free_window(ZCWin w) } static struct zcurses_namenumberpair * -zcurses_attrget(WINDOW *w, char *attr) +zcurses_attrget(UNUSED(WINDOW *w), char *attr) { struct zcurses_namenumberpair *zca; @@ -419,7 +419,7 @@ freecolorpairnode(HashNode hn) *************/ static int -zccmd_init(const char *nam, char **args) +zccmd_init(UNUSED(const char *nam), UNUSED(char **args)) { LinkNode stdscr_win = zcurses_getwindowbyname("stdscr"); @@ -808,7 +808,7 @@ zccmd_border(const char *nam, char **args) static int -zccmd_endwin(const char *nam, char **args) +zccmd_endwin(UNUSED(const char *nam), UNUSED(char **args)) { LinkNode stdscr_win = zcurses_getwindowbyname("stdscr"); @@ -1496,7 +1496,7 @@ zccmd_touch(const char *nam, char **args) /**/ static int -bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func)) +bin_zcurses(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) { char **saargs; struct zcurses_subcommand *zcsc; @@ -1693,7 +1693,7 @@ enables_(Module m, int **enables) /**/ int -boot_(Module m) +boot_(UNUSED(Module m)) { zcurses_windows = znewlinklist(); -- cgit v1.2.3 From a4020e10a33f3f78681a2e18fb7add56338d4e81 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Wed, 3 Feb 2016 01:24:56 +0900 Subject: 37868: add 'static' to file local variables --- ChangeLog | 8 ++++++++ Src/Modules/curses.c | 2 +- Src/Modules/param_private.c | 10 +++++----- Src/Modules/tcp.c | 2 +- Src/Modules/termcap.c | 2 +- Src/Modules/zftp.c | 8 ++++---- Src/Zle/complist.c | 2 +- Src/Zle/zle_misc.c | 2 +- Src/Zle/zle_utils.c | 4 ++-- Src/cond.c | 3 ++- Src/exec.c | 2 -- Src/glob.c | 2 +- Src/jobs.c | 6 +++--- Src/params.c | 2 +- Src/prompt.c | 2 +- Src/utils.c | 4 ++-- 16 files changed, 34 insertions(+), 27 deletions(-) (limited to 'Src/Modules/curses.c') diff --git a/ChangeLog b/ChangeLog index d4adbe886..a8e76e238 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-02-03 Jun-ichi Takimoto + + * 37868: Src/Modules/curses.c, Src/Modules/param_private.c, + Src/Modules/tcp.c, Src/Modules/termcap.c, Src/Modules/zftp.c, + Src/Zle/complist.c, Src/Zle/zle_misc.c, Src/Zle/zle_utils.c, + Src/cond.c, Src/exec.c, Src/glob.c, Src/jobs.c, Src/params.c, + Src/prompt.c, Src/utils.c: add 'static' to file local variables. + 2016-01-31 Barton E. Schaefer * 37859: Src/text.c: NULL-terminate cond_binary_ops static array. diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c index b8a79ed11..a04841a85 100644 --- a/Src/Modules/curses.c +++ b/Src/Modules/curses.c @@ -202,7 +202,7 @@ static const struct zcurses_mouse_event zcurses_mouse_map[] = { { 0, 0, 0 } }; -mmask_t zcurses_mouse_mask = ALL_MOUSE_EVENTS; +static mmask_t zcurses_mouse_mask = ALL_MOUSE_EVENTS; #endif diff --git a/Src/Modules/param_private.c b/Src/Modules/param_private.c index 2f51cb099..86416c5c5 100644 --- a/Src/Modules/param_private.c +++ b/Src/Modules/param_private.c @@ -42,19 +42,19 @@ struct gsu_closure { void *g; }; -const struct gsu_scalar scalar_private_gsu = +static const struct gsu_scalar scalar_private_gsu = { pps_getfn, pps_setfn, pps_unsetfn }; -const struct gsu_integer integer_private_gsu = +static const struct gsu_integer integer_private_gsu = { ppi_getfn, ppi_setfn, ppi_unsetfn }; -const struct gsu_float float_private_gsu = +static const struct gsu_float float_private_gsu = { ppf_getfn, ppf_setfn, ppf_unsetfn }; -const struct gsu_array array_private_gsu = +static const struct gsu_array array_private_gsu = { ppa_getfn, ppa_setfn, ppa_unsetfn }; -const struct gsu_hash hash_private_gsu = +static const struct gsu_hash hash_private_gsu = { pph_getfn, pph_setfn, pph_unsetfn }; /* diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c index 5af68834f..dec12142b 100644 --- a/Src/Modules/tcp.c +++ b/Src/Modules/tcp.c @@ -208,7 +208,7 @@ freehostent(UNUSED(struct hostent *ptr)) /**/ #endif /* !HAVE_GETIPNODEBYNAME */ -LinkList ztcp_sessions; +static LinkList ztcp_sessions; /* "allocate" a tcp_session */ static Tcp_session diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c index 29c28360c..60a6e138a 100644 --- a/Src/Modules/termcap.c +++ b/Src/Modules/termcap.c @@ -295,7 +295,7 @@ scantermcap(UNUSED(HashTable ht), ScanFunc func, int flags) } } -struct paramdef partab[] = { +static struct paramdef partab[] = { SPECIALPMDEF("termcap", PM_READONLY, NULL, gettermcap, scantermcap) }; diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c index b4081df5f..deed35e2f 100644 --- a/Src/Modules/zftp.c +++ b/Src/Modules/zftp.c @@ -344,10 +344,10 @@ static int zfsesscnt; */ /* flags for alarm set, alarm gone off */ -int zfalarmed, zfdrrrring; +static int zfalarmed, zfdrrrring; /* remember old alarm status */ -time_t oaltime; -unsigned int oalremain; +static time_t oaltime; +static unsigned int oalremain; /* * Where to jump to when the alarm goes off. This is much @@ -357,7 +357,7 @@ unsigned int oalremain; * * gcc -O gives apparently spurious `may be clobbered by longjmp' warnings. */ -jmp_buf zfalrmbuf; +static jmp_buf zfalrmbuf; /* The signal handler itself */ diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 0ccb88505..06a07a4e8 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -113,7 +113,7 @@ static Cmgroup *mgtab, *mgtabp; * Allow us to keep track of pointer arithmetic for mgtab; could * just as well have been for mtab but wasn't. */ -int mgtabsize; +static int mgtabsize; #endif /* diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index 0483f758d..25f65b39c 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -1497,7 +1497,7 @@ struct suffixset { }; /* The list of suffix structures */ -struct suffixset *suffixlist; +static struct suffixset *suffixlist; /* Shell function to call to remove the suffix. */ diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index a2c88102a..68794c66a 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -587,7 +587,7 @@ struct zle_position { }; /* LIFO stack of positions */ -struct zle_position *zle_positions; +static struct zle_position *zle_positions; /* * Save positions including cursor, end-of-line and @@ -1412,7 +1412,7 @@ zlong undo_changeno; /* If positive, don't undo beyond this point */ -zlong undo_limitno; +static zlong undo_limitno; /**/ void diff --git a/Src/cond.c b/Src/cond.c index c5ab65eea..0381fe94b 100644 --- a/Src/cond.c +++ b/Src/cond.c @@ -30,7 +30,8 @@ #include "zsh.mdh" #include "cond.pro" -int tracingcond; +/**/ +int tracingcond; /* updated by execcond() in exec.c */ static char *condstr[COND_MOD] = { "!", "&&", "||", "==", "!=", "<", ">", "-nt", "-ot", "-ef", "-eq", diff --git a/Src/exec.c b/Src/exec.c index 352615c83..b60fc90bd 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4518,8 +4518,6 @@ spawnpipes(LinkList l, int nullexec) } } -extern int tracingcond; - /* evaluate a [[ ... ]] */ /**/ diff --git a/Src/glob.c b/Src/glob.c index 69de15544..2051016ec 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -306,7 +306,7 @@ statfullpath(const char *s, struct stat *st, int l) /* This may be set by qualifier functions to an array of strings to insert * into the list instead of the original string. */ -char **inserts; +static char **inserts; /* add a match to the list */ diff --git a/Src/jobs.c b/Src/jobs.c index b47ba8c60..2a9dbe7d6 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -1970,9 +1970,9 @@ struct bgstatus { }; typedef struct bgstatus *Bgstatus; /* The list of those entries */ -LinkList bgstatus_list; +static LinkList bgstatus_list; /* Count of entries. Reaches value of _SC_CHILD_MAX and stops. */ -long bgstatus_count; +static long bgstatus_count; /* * Remove and free a bgstatus entry. @@ -2372,7 +2372,7 @@ bin_fg(char *name, char **argv, Options ops, int func) return retval; } -const struct { +static const struct { const char *name; int num; } alt_sigs[] = { diff --git a/Src/params.c b/Src/params.c index a1f0292cc..76ed61c39 100644 --- a/Src/params.c +++ b/Src/params.c @@ -416,7 +416,7 @@ IPDEF10("pipestatus", pipestatus_gsu), * and $@, this is not readonly. This parameter is not directly * visible in user space. */ -initparam argvparam_pm = IPDEF9F("", &pparams, NULL, \ +static initparam argvparam_pm = IPDEF9F("", &pparams, NULL, \ PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT); #undef BR diff --git a/Src/prompt.c b/Src/prompt.c index be067ee7e..831c4f948 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -1831,7 +1831,7 @@ struct colour_sequences { char *end; /* Escape sequence terminator */ char *def; /* Code to reset default colour */ }; -struct colour_sequences fg_bg_sequences[2]; +static struct colour_sequences fg_bg_sequences[2]; /* * We need a buffer for colour sequence composition. It may diff --git a/Src/utils.c b/Src/utils.c index 053731cfa..de4af5a51 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -56,12 +56,12 @@ typedef struct widechar_array *Widechar_array; * The wordchars variable turned into a wide character array. * This is much more convenient for testing. */ -struct widechar_array wordchars_wide; +static struct widechar_array wordchars_wide; /* * The same for the separators (IFS) array. */ -struct widechar_array ifs_wide; +static struct widechar_array ifs_wide; /* Function to set one of the above from the multibyte array */ -- cgit v1.2.3 From 7fc0c2d57db1c0ee71f66ff73ab5655294a245c0 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Thu, 28 Apr 2016 22:24:27 +0200 Subject: 39354: zcurses fix for colour management Alter internal return code so as not to mask curses error code. --- ChangeLog | 5 +++++ Src/Modules/curses.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'Src/Modules/curses.c') diff --git a/ChangeLog b/ChangeLog index b8eba08f6..9577b14d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-04-29 Peter Stephenson + + * Sebastian: 39354: Src/Modules/curses.c: alter internal return + code so as not to mask curses error code. + 2016-04-26 Barton E. Schaefer * 38350 (cf. Glenn Smith: 38348): Src/exec.c: Remove-all warning diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c index a04841a85..7fff858f4 100644 --- a/Src/Modules/curses.c +++ b/Src/Modules/curses.c @@ -324,7 +324,7 @@ zcurses_color(const char *color) return (short)zc->number; } - return (short)-1; + return (short)-2; } static Colorpairnode @@ -353,10 +353,10 @@ zcurses_colorget(const char *nam, char *colorpair) f = zcurses_color(cp); b = zcurses_color(bg+1); - if (f==-1 || b==-1) { - if (f == -1) + if (f==-2 || b==-2) { + if (f == -2) zwarnnam(nam, "foreground color `%s' not known", cp); - if (b == -1) + if (b == -2) zwarnnam(nam, "background color `%s' not known", bg+1); *bg = '/'; zsfree(cp); -- cgit v1.2.3 From fea013b8e8cc3b2d8e7ca59c1f32b27cdf376155 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Fri, 29 Apr 2016 13:34:19 +0200 Subject: 38356: allow integers as curses colours --- ChangeLog | 5 ++++- Doc/Zsh/mod_curses.yo | 6 +++++- Src/Modules/curses.c | 16 ++++++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'Src/Modules/curses.c') diff --git a/ChangeLog b/ChangeLog index 9577b14d3..29d2c386b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2016-04-29 Peter Stephenson - * Sebastian: 39354: Src/Modules/curses.c: alter internal return + * Sebastian: 38356: Src/Modules/curses.c, Doc/Zsh/mod_curses.yo: + allow integers as colours in curses. + + * Sebastian: 38354: Src/Modules/curses.c: alter internal return code so as not to mask curses error code. 2016-04-26 Barton E. Schaefer diff --git a/Doc/Zsh/mod_curses.yo b/Doc/Zsh/mod_curses.yo index 8104572a6..72dc4094a 100644 --- a/Doc/Zsh/mod_curses.yo +++ b/Doc/Zsh/mod_curses.yo @@ -111,7 +111,11 @@ Each var(fg_col)tt(/)var(bg_col) attribute (to be read as for character output. The color tt(default) is sometimes available (in particular if the library is ncurses), specifying the foreground or background color with which the terminal started. The color pair -tt(default/default) is always available. +tt(default/default) is always available. To use more than the 8 named +colors (red, green, etc.) construct the var(fg_col)tt(/)var(bg_col) +pairs where var(fg_col) and var(bg_col) are decimal integers, e.g +tt(128/200). The maximum color value is 254 if the terminal supports +256 colors. tt(bg) overrides the color and other attributes of all characters in the window. Its usual use is to set the background initially, but it will diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c index 7fff858f4..63c6748f5 100644 --- a/Src/Modules/curses.c +++ b/Src/Modules/curses.c @@ -350,8 +350,20 @@ zcurses_colorget(const char *nam, char *colorpair) } *bg = '\0'; - f = zcurses_color(cp); - b = zcurses_color(bg+1); + + // cp/bg can be {number}/{number} or {name}/{name} + + if( cp[0] >= '0' && cp[0] <= '9' ) { + f = atoi(cp); + } else { + f = zcurses_color(cp); + } + + if( (bg+1)[0] >= '0' && (bg+1)[0] <= '9' ) { + b = atoi(bg+1); + } else { + b = zcurses_color(bg+1); + } if (f==-2 || b==-2) { if (f == -2) -- cgit v1.2.3