From c41287b318da8849ea61cf712a303f0a84da56dd Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Thu, 5 Jun 2014 08:57:40 -0700 Subject: 32716: properly test iconv return values for error conditions --- ChangeLog | 5 +++++ Src/utils.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index adc98a6a1..ab953e675 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-06-05 Barton E. Schaefer + + * 32716 (via Jun T. 31714): Src/utils.c: properly test iconv + return values for error conditions + 2014-06-04 Barton E. Schaefer * 32711: Test/A07control.ztst: run "continue" test in a new diff --git a/Src/utils.c b/Src/utils.c index 8b512bbd9..59b9435ff 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -4287,7 +4287,7 @@ zreaddir(DIR *dir, int ignoredots) #if defined(HAVE_ICONV) && defined(__APPLE__) if (!conv_ds) conv_ds = iconv_open("UTF-8", "UTF-8-MAC"); - if (conv_ds) { + if (conv_ds != (iconv_t)(-1)) { /* Force initial state in case re-using conv_ds */ (void) iconv(conv_ds, 0, &orig_name_len, 0, &conv_name_len); @@ -4298,12 +4298,11 @@ zreaddir(DIR *dir, int ignoredots) conv_name_len = orig_name_len; if (iconv(conv_ds, &orig_name_ptr, &orig_name_len, - &conv_name_ptr, &conv_name_len) >= 0) { - if (orig_name_len == 0) { + &conv_name_ptr, &conv_name_len) != (size_t)(-1) && + orig_name_len == 0) { /* Completely converted, metafy and return */ *conv_name_ptr = '\0'; return metafy(conv_name, -1, META_STATIC); - } } /* Error, or conversion incomplete, keep the original name */ } -- cgit 1.4.1 From 32756f78afc81bdc42b47c7bdb522c582b9d896a Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Thu, 5 Jun 2014 21:10:23 -0700 Subject: 32723: add braces around some if/else branches --- ChangeLog | 2 ++ Src/glob.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab953e675..45066e8d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-05 Barton E. Schaefer + * 32723: Src/glob.c: add braces around some if/else branches + * 32716 (via Jun T. 31714): Src/utils.c: properly test iconv return values for error conditions diff --git a/Src/glob.c b/Src/glob.c index c6cb3d2fc..15a5f70b7 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -462,18 +462,19 @@ scanner(Complist q, int shortcircuit) int errssofar = errsfound; struct dirsav ds; - init_dirsav(&ds); if (!q) return; + init_dirsav(&ds); if ((closure = q->closure)) { /* (foo/)# - match zero or more dirs */ if (q->closure == 2) /* (foo/)## - match one or more dirs */ q->closure = 1; - else + else { scanner(q->next, shortcircuit); if (shortcircuit && shortcircuit == matchct) return; + } } p = q->pat; /* Now the actual matching for the current path section. */ @@ -518,10 +519,11 @@ scanner(Complist q, int shortcircuit) } if (add) { addpath(str, l); - if (!closure || !statfullpath("", NULL, 1)) + if (!closure || !statfullpath("", NULL, 1)) { scanner((q->closure) ? q : q->next, shortcircuit); if (shortcircuit && shortcircuit == matchct) return; + } pathbuf[pathpos = oppos] = '\0'; } } @@ -618,11 +620,12 @@ scanner(Complist q, int shortcircuit) memcpy(subdirs + subdirlen, (char *)&errsfound, sizeof(int)); subdirlen += sizeof(int); - } else + } else { /* if the last filename component, just add it */ insert(fn, 1); if (shortcircuit && shortcircuit == matchct) return; + } } } closedir(lock); -- cgit 1.4.1 From 605cc1ba579ad6de619f1dca0f3d2857350a3c07 Mon Sep 17 00:00:00 2001 From: Andrew Magee Date: Wed, 4 Jun 2014 17:03:41 +1000 Subject: 19939: hg committable files --- ChangeLog | 5 +++++ Completion/Unix/Command/_hg | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 45066e8d2..2c44530d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-06-06 Peter Stephenson + + * Andrew Magee: 32698: Completion/Unix/Command/_hg: show + committable files. + 2014-06-05 Barton E. Schaefer * 32723: Src/glob.c: add braces around some if/else branches diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index f48598278..c18500bcb 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -226,6 +226,16 @@ _hg_modified() { _wanted files expl 'modified files' _multi_parts / status_files } +_hg_committable() { + typeset -a status_files + # A file is a candidate for `hg commit` if it is: + # - modified (m), or + # - added (a), or + # - removed (r) + _hg_status mar + _wanted files expl 'committable files' _multi_parts / status_files +} + _hg_resolve() { local rstate rpath @@ -476,7 +486,7 @@ _hg_cmd_commit() { '(--logfile -l)'{-l+,--logfile}'[read commit message from specified file]:log file:_files' \ '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ - '*:file:_hg_files' + '*:file:_hg_committable' } _hg_cmd_copy() { -- cgit 1.4.1 From 7f6dc0fe8e3c9aaec8aa295cc4459eabb8f2ada2 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 6 Jun 2014 21:56:47 +0100 Subject: 32682 with tweaks: Add INC_APPEND_HISTORY_TIME. Revert INC_APPEND_HISTORY behaviour. --- ChangeLog | 5 +++++ Doc/Zsh/options.yo | 30 ++++++++++++++++++++++++------ Src/hist.c | 14 +++++++++----- Src/options.c | 1 + Src/zsh.h | 1 + 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c44530d7..776e4d980 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2014-06-06 Peter Stephenson + * 32682 with tweaks: Doc/Zsh/options.yo, Src/hist.c, + Src/options.c, Src/zsh.h: INC_APPEND_HISTORY_TIME is new + behaviour, with INC_APPEND_HISTORY reverting to its previous + behaviour. + * Andrew Magee: 32698: Completion/Unix/Command/_hg: show committable files. diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index 349946d82..7788cd755 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -971,6 +971,23 @@ The file will still be periodically re-written to trim it when the number of lines grows 20% beyond the value specified by tt($SAVEHIST) (see also the HIST_SAVE_BY_COPY option). ) +pindex(INC_APPEND_HISTORY_TIME) +pindex(NO_INC_APPEND_HISTORY_TIME) +pindex(INCAPPENDHISTORYTIME) +pindex(NOINCAPPENDHISTORYTIME) +cindex(history, incremental appending to a file with time) +item(tt(INC_APPEND_HISTORY_TIME))( +This option is a variant of tt(INC_APPEND_HISTORY) in which, where +possible, the history entry is written out to the file after the +command is finished, so that the time taken by the command is recorded +correctly in the history file in tt(EXTENDED_HISTORY) format. This +means that the history entry will not be available immediately from +other instances of the shell that are using the same history file. + +This option is only useful if tt(INC_APPEND_HISTORY) and +tt(SHARE_HISTORY) are turned off. The three options should be +considered mutually exclusive. +) pindex(SHARE_HISTORY) pindex(NO_SHARE_HISTORY) pindex(SHAREHISTORY) @@ -981,10 +998,10 @@ item(tt(SHARE_HISTORY) )( This option both imports new commands from the history file, and also causes your typed commands to be appended to the history file (the -latter is like specifying tt(INC_APPEND_HISTORY)). -The history lines are also output with timestamps ala -tt(EXTENDED_HISTORY) (which makes it easier to find the spot where -we left off reading the file after it gets re-written). +latter is like specifying tt(INC_APPEND_HISTORY), which should be turned +off if this option is in effect). The history lines are also output +with timestamps ala tt(EXTENDED_HISTORY) (which makes it easier to find +the spot where we left off reading the file after it gets re-written). By default, history movement commands visit the imported lines as well as the local lines, but you can toggle this on and off with the @@ -994,8 +1011,9 @@ some include them. If you find that you want more control over when commands get imported, you may wish to turn tt(SHARE_HISTORY) off, -tt(INC_APPEND_HISTORY) on, and then manually import -commands whenever you need them using `tt(fc -RI)'. +tt(INC_APPEND_HISTORY) or tt(INC_APPEND_HISTORY_TIME) (see above) on, +and then manually import commands whenever you need them using `tt(fc +-RI)'. ) enditem() diff --git a/Src/hist.c b/Src/hist.c index 1182994a2..64f88f559 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -935,9 +935,11 @@ hbegin(int dohist) hf = getsparam("HISTFILE"); /* - * For INCAPPENDHISTORY, when interactive, save the history here + * For INCAPPENDHISTORYTIME, when interactive, save the history here * as it gives a better estimate of the times of commands. * + * If INCAPPENDHISTORY is also set we've already done it. + * * If SHAREHISTORY is also set continue to do so in the * standard place, because that's safer about reading and * rewriting history atomically. @@ -950,7 +952,8 @@ hbegin(int dohist) * so that (correctly) nothing happens here. But it shows * I thought about it. */ - if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) && + if (isset(INCAPPENDHISTORYTIME) && !isset(SHAREHISTORY) && + !isset(INCAPPENDHISTORY) && !(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); } @@ -1378,7 +1381,8 @@ hend(Eprog prog) * For normal INCAPPENDHISTORY case and reasoning, see hbegin(). */ if (isset(SHAREHISTORY) ? histfileIsLocked() : - (isset(INCAPPENDHISTORY) && histsave_stack_pos != 0)) + (isset(INCAPPENDHISTORY) || (isset(INCAPPENDHISTORYTIME) && + histsave_stack_pos != 0))) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); unlockhistfile(hf); /* It's OK to call this even if we aren't locked */ /* @@ -2542,7 +2546,7 @@ savehistfile(char *fn, int err, int writeflags) } if (writeflags & HFILE_USE_OPTIONS) { if (isset(APPENDHISTORY) || isset(INCAPPENDHISTORY) - || isset(SHAREHISTORY)) + || isset(INCAPPENDHISTORYTIME) || isset(SHAREHISTORY)) writeflags |= HFILE_APPEND | HFILE_SKIPOLD; else histfile_linect = 0; @@ -2578,7 +2582,7 @@ savehistfile(char *fn, int err, int writeflags) tmpfile = NULL; if (err) { if (isset(APPENDHISTORY) || isset(INCAPPENDHISTORY) - || isset(SHAREHISTORY)) + || isset(INCAPPENDHISTORYTIME) || isset(SHAREHISTORY)) zerr("rewriting %s would change its ownership -- skipped", fn); else zerr("rewriting %s would change its ownership -- history not saved", fn); diff --git a/Src/options.c b/Src/options.c index e83dc5839..2163bff4d 100644 --- a/Src/options.c +++ b/Src/options.c @@ -165,6 +165,7 @@ static struct optname optns[] = { {{NULL, "ignoreclosebraces", OPT_EMULATE}, IGNORECLOSEBRACES}, {{NULL, "ignoreeof", 0}, IGNOREEOF}, {{NULL, "incappendhistory", 0}, INCAPPENDHISTORY}, +{{NULL, "incappendhistorytime", 0}, INCAPPENDHISTORYTIME}, {{NULL, "interactive", OPT_SPECIAL}, INTERACTIVE}, {{NULL, "interactivecomments",OPT_BOURNE}, INTERACTIVECOMMENTS}, {{NULL, "ksharrays", OPT_EMULATE|OPT_BOURNE}, KSHARRAYS}, diff --git a/Src/zsh.h b/Src/zsh.h index 620883b81..05d582cda 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2115,6 +2115,7 @@ enum { IGNORECLOSEBRACES, IGNOREEOF, INCAPPENDHISTORY, + INCAPPENDHISTORYTIME, INTERACTIVE, INTERACTIVECOMMENTS, KSHARRAYS, -- cgit 1.4.1 From d7ca50c8720379d55f7edec3a65bdb12d37c9f52 Mon Sep 17 00:00:00 2001 From: Jun T Date: Thu, 5 Jun 2014 23:56:22 +0900 Subject: 32715: doc formatting fixes --- ChangeLog | 3 +++ Doc/Zsh/calsys.yo | 21 +++++++++++---------- Doc/Zsh/grammar.yo | 51 ++++++++++++++++++++++++++------------------------- Doc/Zsh/zle.yo | 20 ++++++++++---------- 4 files changed, 50 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 776e4d980..5d9818e20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-06-06 Peter Stephenson + * Jun T: 32715: Doc/Zsh/calsys.yo, Doc/Zsh/grammar.yo, + Doc/Zsh/zle.yo: formatting fixes. + * 32682 with tweaks: Doc/Zsh/options.yo, Src/hist.c, Src/options.c, Src/zsh.h: INC_APPEND_HISTORY_TIME is new behaviour, with INC_APPEND_HISTORY reverting to its previous diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo index 7dc51ab11..0d7abbf86 100644 --- a/Doc/Zsh/calsys.yo +++ b/Doc/Zsh/calsys.yo @@ -547,35 +547,36 @@ and status 2 if the wrong number of arguments were passed; it also sets the parameter tt(reply) to an empty associative array. Otherwise, it returns status 0 and sets elements of the associative array tt(reply) as follows: + startsitem() -sitem(time)(The time as a string of digits in the same units as +sitem(tt(time))(The time as a string of digits in the same units as tt($EPOCHSECONDS)) -sitem(schedtime)(The regularly scheduled time. This may differ from +sitem(tt(schedtime))(The regularly scheduled time. This may differ from the actual event time tt(time) if this is a recurring event and the next occurrence has been rescheduled. Then tt(time) gives the actual time and tt(schedtime) the time of the regular recurrence before modification.) -sitem(text1)(The text from the line not including the date and time of the +sitem(tt(text1))(The text from the line not including the date and time of the event, but including any tt(WARN) or tt(RPT) keywords and values.) -sitem(warntime)(Any warning time given by the tt(WARN) keyword as a string +sitem(tt(warntime))(Any warning time given by the tt(WARN) keyword as a string of digits containing the time at which to warn in the same units as tt($EPOCHSECONDS). (Note this is an absolute time, not the relative time passed down.) Not set no tt(WARN) keyword and value were matched.) -sitem(warnstr)(The raw string matched after the tt(WARN) keyword, else unset.) -sitem(rpttime)(Any recurrence time given by the tt(RPT) keyword as a string +sitem(tt(warnstr))(The raw string matched after the tt(WARN) keyword, else unset.) +sitem(tt(rpttime))(Any recurrence time given by the tt(RPT) keyword as a string of digits containing the time of the recurrence in the same units as tt($EPOCHSECONDS). (Note this is an absolute time.) Not set if no tt(RPT) keyword and value were matched.) -sitem(schedrpttime)(The next regularly scheduled occurrence of a recurring +sitem(tt(schedrpttime))(The next regularly scheduled occurrence of a recurring event before modification. This may differ from tt(rpttime), which is the actual time of the event that may have been rescheduled from the regular time.) -sitem(rptstr)(The raw string matched after the tt(RPT) keyword, else unset.) -sitem(text2)(The text from the line after removal of the date and any +sitem(tt(rptstr))(The raw string matched after the tt(RPT) keyword, else unset.) +sitem(tt(text2))(The text from the line after removal of the date and any keywords and values.) ) endsitem() -) + findex(calendar_showdate) item(tt(calendar_showdate) [ tt(-r) ] [ tt(-f) var(fmt) ] var(date-spec ...))( The given var(date-spec) is interpreted and the corresponding date and diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo index dde67ebcb..9a1e261ae 100644 --- a/Doc/Zsh/grammar.yo +++ b/Doc/Zsh/grammar.yo @@ -465,37 +465,38 @@ shell constructs such as loops or conditions; this somewhat illogical behaviour can be recovered by setting the option tt(CONTINUE_ON_ERROR). Fatal errors found in non-interactive shells include: -startlist() -list(Failure to parse shell options passed when invoking the shell) -list(Failure to change options with the tt(set) builtin) -list(Parse errors of all sorts, including failures to parse + +startitemize() +itemiz(Failure to parse shell options passed when invoking the shell) +itemiz(Failure to change options with the tt(set) builtin) +itemiz(Parse errors of all sorts, including failures to parse mathematical expressions) -list(Failures to set or modify variable behaviour with tt(typeset), +itemiz(Failures to set or modify variable behaviour with tt(typeset), tt(local), tt(declare), tt(export), tt(integer), tt(float)) -list(Execution of incorrectly positioned loop control structures +itemiz(Execution of incorrectly positioned loop control structures (tt(continue), tt(break))) -list(Attempts to use regular expression with no regular expression +itemiz(Attempts to use regular expression with no regular expression module available) -list(Disallowed operations when the tt(RESTRICTED) options is set) -list(Failure to create a pipe needed for a pipeline) -list(Failure to create a multio) -list(Failure to autoload a module needed for a declared shell feature) -list(Errors creating command or process substitutions) -list(Syntax errors in glob qualifiers) -list(File generation errors where not caught by the option tt(BAD_PATTERN)) -list(All bad patterns used for matching within case statements) -list(File generation failures where not caused by tt(NO_MATCH) or -list(All file generation errors where the pattern was used to create a +itemiz(Disallowed operations when the tt(RESTRICTED) options is set) +itemiz(Failure to create a pipe needed for a pipeline) +itemiz(Failure to create a multio) +itemiz(Failure to autoload a module needed for a declared shell feature) +itemiz(Errors creating command or process substitutions) +itemiz(Syntax errors in glob qualifiers) +itemiz(File generation errors where not caught by the option tt(BAD_PATTERN)) +itemiz(All bad patterns used for matching within case statements) +itemiz(File generation failures where not caused by tt(NO_MATCH) or +itemiz(All file generation errors where the pattern was used to create a multio) -list(Memory errors where detected by the shell) -list(Invalid subscripts to shell variables) -list(Attempts to assign read-only variables) -list(Logical errors with variables such as assignment to the wrong type) -list(Use of invalid variable names) -list(Errors in variable substitution syntax) -list(Failure to convert characters in tt($')...tt(') expressions) +itemiz(Memory errors where detected by the shell) +itemiz(Invalid subscripts to shell variables) +itemiz(Attempts to assign read-only variables) +itemiz(Logical errors with variables such as assignment to the wrong type) +itemiz(Use of invalid variable names) +itemiz(Errors in variable substitution syntax) +itemiz(Failure to convert characters in tt($')...tt(') expressions) similar options) -endlist() +enditemize() If the tt(POSIX_BUILTINS) option is set, more errors associated with shell builtin commands are treated as fatal, as specified by the POSIX diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 4b1022614..2a907c52c 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -732,16 +732,16 @@ The context in which zle was called to read a line; read-only. One of the values: startitem() -item(start)( +item(tt(start))( The start of a command line (at prompt tt(PS1)). ) -item(cont)( +item(tt(cont))( A continuation to a command line (at prompt tt(PS2)). ) -item(select)( +item(tt(select))( In a tt(select) loop. ) -item(vared)( +item(tt(vared))( Editing a variable in tt(vared). ) enditem() @@ -878,21 +878,21 @@ is needed for character indexing to include tt(PREDISPLAY). Each string consists of the following parts: -startlist() -list(Optionally, a `tt(P)' to signify that the start and end offset that +startitemize() +itemiz(Optionally, a `tt(P)' to signify that the start and end offset that follow include any string set by the tt(PREDISPLAY) special parameter; this is needed if the predisplay string itself is to be highlighted. Whitespace may follow the `tt(P)'.) -list(A start offset in the same units as tt(CURSOR), terminated by +itemiz(A start offset in the same units as tt(CURSOR), terminated by whitespace.) -list(An end offset in the same units as tt(CURSOR), terminated by +itemiz(An end offset in the same units as tt(CURSOR), terminated by whitespace.) -list(A highlight specification in the same format as +itemiz(A highlight specification in the same format as used for contexts in the parameter tt(zle_highlight), ifnzman(noderef(Character Highlighting))\ ifzman(see Character Highlighting below); for example, tt(standout) or tt(fg=red,bold)). -endlist() +enditemize() For example, -- cgit 1.4.1 From 37ccdf58c09941a0e649551b8c30add1dfe512d5 Mon Sep 17 00:00:00 2001 From: Jun T Date: Fri, 6 Jun 2014 01:22:13 +0900 Subject: 32719: minor doc issues --- ChangeLog | 2 ++ Doc/Zsh/contrib.yo | 31 ++++++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d9818e20..056ad1f3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-06 Peter Stephenson + * Jun T: 32719: Doc/Zsh/contrib.yo: minor issues. + * Jun T: 32715: Doc/Zsh/calsys.yo, Doc/Zsh/grammar.yo, Doc/Zsh/zle.yo: formatting fixes. diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index af300fd86..2fcfbbdc7 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -3411,21 +3411,22 @@ by the prompt theme system (ifzman(see above)\ ifnzman(noderef(Prompt Themes))). You seldom should need to run tt(colors) more than once. -The eight base colors are: black, red, green, yellow, blue, magenta, cyan, -and white. Each of these has codes for foreground and background. In -addition there are eight intensity attributes: bold, faint, standout, -underline, blink, reverse, and conceal. Finally, there are six codes used -to negate attributes: none (reset all attributes to the defaults), normal -(neither bold nor faint), no-standout, no-underline, no-blink, and -no-reverse. +The eight base colors are: tt(black), tt(red), tt(green), tt(yellow), +tt(blue), tt(magenta), tt(cyan), and tt(white). Each of these has codes for +foreground and background. In addition there are seven intensity attributes: +tt(bold), tt(faint), tt(standout), tt(underline), tt(blink), tt(reverse), +and tt(conceal). Finally, there are seven codes used to negate attributes: +tt(none) (reset all attributes to the defaults), tt(normal) +(neither bold nor faint), tt(no-standout), tt(no-underline), tt(no-blink), +tt(no-reverse), and tt(no-conceal). Some terminals do not support all combinations of colors and intensities. The associative arrays are: startitem() -xitem(color) -item(colour)( +xitem(tt(color)) +item(tt(colour))( Map all the color names to their integer codes, and integer codes to the color names. The eight base names map to the foreground color codes, as do names prefixed with `tt(fg-)', such as `tt(fg-red)'. Names prefixed @@ -3436,16 +3437,16 @@ and the tt(bg-) form for backgrounds. Although it is a misnomer to call them `colors', these arrays also map the other fourteen attributes from names to codes and codes to names. ) -xitem(fg) -xitem(fg_bold) -item(fg_no_bold)( +xitem(tt(fg)) +xitem(tt(fg_bold)) +item(tt(fg_no_bold))( Map the eight basic color names to ANSI terminal escape sequences that set the corresponding foreground text properties. The tt(fg) sequences change the color without changing the eight intensity attributes. ) -xitem(bg) -xitem(bg_bold) -item(bg_no_bold)( +xitem(tt(bg)) +xitem(tt(bg_bold)) +item(tt(bg_no_bold))( Map the eight basic color names to ANSI terminal escape sequences that set the corresponding background properties. The tt(bg) sequences change the color without changing the eight intensity attributes. -- cgit 1.4.1 From 4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 7 Jun 2014 13:48:40 -0700 Subject: 32737, 32736 (32741), 32735, 32734, 32733, 32732 (32739): Strict compilation fixes Src/utils.c: properly ifdef declarations Src/zsh_system.h: memmove() should return its dest argument Src/signals.c: define ret before use Src/mem.c: remove unused pointers Src/prototypes.h: use size_t in bcopy() Src/compat.c: fix const declaration inconsistency --- ChangeLog | 16 ++++++++++++++++ Src/compat.c | 2 +- Src/mem.c | 6 +++--- Src/prototypes.h | 2 +- Src/signals.c | 2 +- Src/utils.c | 8 +++++--- Src/zsh_system.h | 5 ++++- 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 056ad1f3e..3a304c0ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2014-06-07 Barton E. Schaefer + + * Nikolas Garofil: 32737: Src/utils.c: properly ifdef declarations + + * Nikolas Garofil: 32736 (tweak per 32741): Src/zsh_system.h: + memmove() should return its dest argument + + * Nikolas Garofil: 32735: Src/signals.c: define ret before use + + * Nikolas Garofil: 32734: Src/mem.c: remove unused pointers + + * Nikolas Garofil: 32733: Src/prototypes.h: use size_t in bcopy() + + * Nikolas Garofil: 32732 (tweak per 32739): Src/compat.c: fix + const declaration inconsistency + 2014-06-06 Peter Stephenson * Jun T: 32719: Doc/Zsh/contrib.yo: minor issues. diff --git a/Src/compat.c b/Src/compat.c index cc4e876da..b0bcb6265 100644 --- a/Src/compat.c +++ b/Src/compat.c @@ -37,7 +37,7 @@ char * strstr(const char *s, const char *t) { - char *p1, *p2; + const char *p1, *p2; for (; *s; s++) { for (p1 = s, p2 = t; *p2; p1++, p2++) diff --git a/Src/mem.c b/Src/mem.c index a7f11a62b..f19817723 100644 --- a/Src/mem.c +++ b/Src/mem.c @@ -1508,7 +1508,7 @@ zsfree(char *p) MALLOC_RET_T realloc(MALLOC_RET_T p, MALLOC_ARG_T size) { - struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mp, *mt; + struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mt; char *r; int i, l = 0; @@ -1524,10 +1524,10 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size) /* check if we are reallocating a small block, if we do, we have to compute the size of the block from the sort of block it is in */ for (i = 0; i < M_NSMALL; i++) { - for (mp = NULL, mt = m_small[i]; + for (mt = m_small[i]; mt && (((char *)mt) > ((char *)p) || (((char *)mt) + mt->len) < ((char *)p)); - mp = mt, mt = mt->next); + mt = mt->next); if (mt) { l = M_BSLEN(mt->len); diff --git a/Src/prototypes.h b/Src/prototypes.h index 00988ac4c..e3db4f5ee 100644 --- a/Src/prototypes.h +++ b/Src/prototypes.h @@ -130,5 +130,5 @@ extern char *strerror _((int errnum)); /***************************************************/ #ifndef HAVE_MEMMOVE -extern void bcopy _((const void *, void *, int)); +extern void bcopy _((const void *, void *, size_t)); #endif diff --git a/Src/signals.c b/Src/signals.c index a6eb8038b..cb2b58161 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -369,7 +369,7 @@ signal_suspend(UNUSED(int sig), int wait_cmd) #ifdef POSIX_SIGNALS # ifdef BROKEN_POSIX_SIGSUSPEND sigprocmask(SIG_SETMASK, &set, &oset); - pause(); + ret = pause(); sigprocmask(SIG_SETMASK, &oset, NULL); # else /* not BROKEN_POSIX_SIGSUSPEND */ ret = sigsuspend(&set); diff --git a/Src/utils.c b/Src/utils.c index 59b9435ff..cef2abef8 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2712,8 +2712,11 @@ ztrftimebuf(int *bufsizeptr, int decr) mod_export int ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm) { - int hr12, decr; -#ifndef HAVE_STRFTIME + int hr12; +#ifdef HAVE_STRFTIME + int decr; + char tmp[4]; +#else static char *astr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; static char *estr[] = @@ -2721,7 +2724,6 @@ ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm) "Aug", "Sep", "Oct", "Nov", "Dec"}; #endif char *origbuf = buf; - char tmp[4]; while (*fmt) diff --git a/Src/zsh_system.h b/Src/zsh_system.h index e68fd62f9..6887a135b 100644 --- a/Src/zsh_system.h +++ b/Src/zsh_system.h @@ -708,7 +708,10 @@ struct timezone { #endif #ifndef HAVE_MEMMOVE -# define memmove(dest, src, len) bcopy((src), (dest), (len)) +# ifndef memmove +static char *zmmv; +# define memmove(dest, src, len) (bcopy((src), zmmv = (dest), (len)), zmmv) +# endif #endif #ifndef offsetof -- cgit 1.4.1