diff -pur global-6.2.12/global/convert.c global-6.2-12/global/convert.c --- global-6.2.12/global/convert.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/global/convert.c 2014-04-01 22:46:36 +1000 @@ -82,15 +82,33 @@ static void set_color_method(void) { STATIC_STRBUF(sb); - const char *sgr = getenv("GREP_COLOR"); + const char *sgr = DEFAULT_COLOR; + const char *col = getenv("GREP_COLOR"); + int len; - if (sgr == NULL) - sgr = DEFAULT_COLOR; + if (col != NULL) + sgr = col; + len = strlen(sgr); + col = getenv("GREP_COLORS"); + if (col != NULL) { + const char *part = strstr(col, "mt="); + if (part == NULL) + part = strstr(col, "ms="); + if (part != NULL) { + const char *sep = strchr(part, ':'); + if (sep == NULL) + sep = strchr(part, '\0'); + if (sep[-1] != '=') { + sgr = part + 3; + len = sep - sgr; + } + } + } strbuf_clear(sb); /* begin coloring */ strbuf_putc(sb, ESC); strbuf_putc(sb, '['); - strbuf_puts(sb, sgr); + strbuf_nputs(sb, sgr, len); strbuf_putc(sb, EOE); /* tag name */ strbuf_putc(sb, '&'); @@ -207,7 +225,7 @@ set_color_tag(const char *pattern) flags |= REG_ICASE; /* compile the regular expression */ if (rewrite_pattern(rewrite, strbuf_value(sb), flags) < 0) - die("illegal regular expression. '%s'", strbuf_value(sb)); + die("invalid regular expression. '%s'", strbuf_value(sb)); } /** * set_print0: change newline to @CODE{'\0'}. @@ -393,7 +411,7 @@ convert_put(CONVERT *cv, const char *cta for (; *p && !isspace(*p); p++) ; if (*p == '\0') - die("illegal ctags-x format (line number not found)."); + die("invalid ctags-x format (line number not found)."); tagnextp = p; tagnextc = *p; *p++ = '\0'; @@ -401,7 +419,7 @@ convert_put(CONVERT *cv, const char *cta for (; *p && isspace(*p); p++) ; if (*p == '\0') - die("illegal ctags-x format (line number not found)."); + die("invalid ctags-x format (line number not found)."); /* * line number */ @@ -409,13 +427,13 @@ convert_put(CONVERT *cv, const char *cta for (; *p && !isspace(*p); p++) ; if (*p == '\0') - die("illegal ctags-x format (path name not found)."); + die("invalid ctags-x format (path name not found)."); *p++ = '\0'; /* skip blanks */ for (; *p && isspace(*p); p++) ; if (*p == '\0') - die("illegal ctags-x format (path name not found)."); + die("invalid ctags-x format (path name not found)."); /* * path name */ @@ -423,7 +441,7 @@ convert_put(CONVERT *cv, const char *cta for (; *p && !isspace(*p); p++) ; if (*p == '\0') - die("illegal ctags-x format (line image not found)."); + die("invalid ctags-x format (line image not found)."); *p++ = '\0'; rest = p; } diff -pur global-6.2.12/global/global.c global-6.2-12/global/global.c --- global-6.2.12/global/global.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/global/global.c 2014-04-01 23:27:50 +1000 @@ -191,6 +191,7 @@ static struct option const long_options[ /* long name only */ {"color", optional_argument, NULL, USE_COLOR}, + {"colour", optional_argument, NULL, USE_COLOR}, {"encode-path", required_argument, NULL, ENCODE_PATH}, {"from-here", required_argument, NULL, FROM_HERE}, {"debug", no_argument, &debug, 1}, @@ -358,7 +359,7 @@ main(int argc, char **argv) int option_index = 0; logging_arguments(argc, argv); - while ((optchar = getopt_long(argc, argv, "acCde:ifgGIlL:noOpPqrsS:tTuvVx", long_options, &option_index)) != EOF) { + while ((optchar = getopt_long(argc, argv, "acde:ifgGIlL:noOpPqrsS:tTuvVx", long_options, &option_index)) != EOF) { switch (optchar) { case 0: break; @@ -602,7 +603,7 @@ main(int argc, char **argv) * replace it with the relative or the absolute path name. * * By default, if we are in src/ directory, the output - * should be converted like follws: + * should be converted like follows: * * main 10 ./src/main.c main(argc, argv)\n * main 22 ./libc/func.c main(argc, argv)\n @@ -610,7 +611,7 @@ main(int argc, char **argv) * main 10 main.c main(argc, argv)\n * main 22 ../libc/func.c main(argc, argv)\n * - * Similarly, the --path-covert=absolute option specified, then + * Similarly, the --path-convert=absolute option specified, then * v * main 10 /prj/xxx/src/main.c main(argc, argv)\n * main 22 /prj/xxx/libc/func.c main(argc, argv)\n @@ -620,7 +621,7 @@ main(int argc, char **argv) char *ctags_x; if (argc < 3) - die("global --path-covert: 3 arguments needed."); + die("global --path-convert: 3 arguments needed."); cv = convert_open(convert_type, FORMAT_CTAGS_X, argv[0], argv[1], argv[2], stdout, NOTAGS); while ((ctags_x = strbuf_fgets(ib, stdin, STRBUF_NOCRLF)) != NULL) convert_put(cv, ctags_x); @@ -864,7 +865,7 @@ main(int argc, char **argv) type = PATH_RELATIVE; abslib++; } else - die("illegal path style."); + die("invalid path style."); } /* * exec lid(idutils). @@ -1025,7 +1026,7 @@ completion_idutils(const char *dbpath, c for (p = line; *p && *p != ' '; p++) ; if (*p == '\0') { - warning("Illegal line: %s", line); + warning("Invalid line: %s", line); continue; } *p = '\0'; diff -pur global-6.2.12/global/manual.in global-6.2-12/global/manual.in --- global-6.2.12/global/manual.in 2014-03-31 14:45:05 +1000 +++ global-6.2-12/global/manual.in 2014-04-01 23:21:02 +1000 @@ -95,12 +95,13 @@ @begin_itemize @address@hidden, @option{--absolute}} Print absolute path names. By default, print relative path names. - @address@hidden @arg{when}} + @address@hidden, @option{--colour} @arg{when}} Use color to highlight the pattern within the line; @arg{when} may be one of: @arg{never}, @arg{always} or @arg{auto} (default). The default color is bold red text on current background; the environment - variable @var{GREP_COLOR} defines it. - This option is effective to the following commands: , -f, -g, -I, -P. + variable @var{GREP_COLORS} or @var{GREP_COLOR} defines it. + This option is effective to the following commands: + , -f, -g, -I, -P. @address@hidden, @option{--definition}} Print locations of definitions. @address@hidden, @option{--regexp} @arg{pattern}} @@ -133,7 +134,6 @@ Specify how path name completion should match, where @arg{part} is one of: @val{first}, @val{last} or @val{all} (default). This option is valid only with the @option{-c} command in conjunction with @option{-P}. - @address@hidden, @option{--nofilter}} Suppress sort filter and path conversion filter. @address@hidden, @option{--only-other}} @@ -242,7 +242,9 @@ @begin_itemize @address@hidden - The color to use for @option{--color}. + The color to use for @option{--color}; @var{GREP_COLORS} has precedence. + @address@hidden + The color (@arg{mt} or @arg{ms}) to use for @option{--color}; see @xref{grep,1}. @address@hidden If this variable is set, the @option{--encode-path=" "} option is specified. diff -pur global-6.2.12/global/output.c global-6.2-12/global/output.c --- global-6.2.12/global/output.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/global/output.c 2014-04-01 21:34:35 +1000 @@ -142,7 +142,7 @@ put_compact_format(CONVERT *cv, GTP *gtp * Unfold compact format. */ if (!isdigit(*p)) - die("illegal compact format."); + die("invalid compact format."); if (flags & GTAGS_COMPLINE) { /* * If GTAGS_COMPLINE flag is set, each line number is expressed as diff -pur global-6.2.12/gozilla/gozilla.c global-6.2-12/gozilla/gozilla.c --- global-6.2.12/gozilla/gozilla.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/gozilla/gozilla.c 2014-04-01 21:34:35 +1000 @@ -370,7 +370,7 @@ getdefinitionURL(const char *arg, const die("cannot open '%s'.", path); while ((p = strbuf_fgets(sb, fp, STRBUF_NOCRLF)) != NULL) { if (split(p, 2, &ptable) != 2) - die("illegal format."); + die("invalid format."); if (!strcmp(arg, ptable.part[0].start)) { status = 0; break; diff -pur global-6.2.12/gtags.pl global-6.2-12/gtags.pl --- global-6.2.12/gtags.pl 2014-03-31 14:45:05 +1000 +++ global-6.2-12/gtags.pl 2014-04-01 21:34:35 +1000 @@ -252,7 +252,7 @@ sub parse_version { # # i) $v version # i) $sv supported version -# r) -1: illegal +# r) -1: invalid # 1: supported # 0: not supported # diff -pur global-6.2.12/htags/anchor.c global-6.2-12/htags/anchor.c --- global-6.2.12/htags/anchor.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/htags/anchor.c 2014-04-01 21:34:35 +1000 @@ -159,7 +159,7 @@ anchor_load(const char *path) ; if (!*p) { recover(&ptable); - die("The output of parser is illegal.\n%s", ctags_x); + die("The output of parser is invalid.\n%s", ctags_x); } /* * Function header is applied only to the anchor whoes type is 'D'. diff -pur global-6.2.12/htags/cflowindex.c global-6.2-12/htags/cflowindex.c --- global-6.2.12/htags/cflowindex.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/htags/cflowindex.c 2014-04-01 21:34:35 +1000 @@ -42,7 +42,7 @@ makecflowindex(const char *output, const STRBUF *input = strbuf_open(0); FILE *ip, *op; char *cflow_posix, *p; - const char *m0 = "Gave up making call-tree because of illegal POSIX cflow format."; + const char *m0 = "Gave up making call-tree because of invalid POSIX cflow format."; const char *m1 = ""; const char *title = locatestring(output, "callee", MATCH_AT_FIRST) ? title_callee_tree : title_call_tree; int line = 0; diff -pur global-6.2.12/htags-refkit/htags_path2url.c global-6.2-12/htags-refkit/htags_path2url.c --- global-6.2.12/htags-refkit/htags_path2url.c 2014-03-31 14:45:05 +1000 +++ global-6.2-12/htags-refkit/htags_path2url.c 2014-04-01 21:34:35 +1000 @@ -135,7 +135,7 @@ cmp(const void *s1, const void *s2) * @param[out] lines @a map lines * @return 0: succesful
* -1: out of memory.
- * -5: illegal format. + * -5: invalid format. */ static int create_filemap_index(char *area, int size, struct map **map, int *lines) diff -pur global-6.2.12/libutil/abs2rel.c global-6.2-12/libutil/abs2rel.c --- global-6.2.12/libutil/abs2rel.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/abs2rel.c 2014-04-01 21:34:35 +1000 @@ -381,7 +381,7 @@ abs2rel(const char *path, const char *ba if (*pp == EOE) pp++; else - die("illegal escape sequence in the path. '%s'", path); + die("invalid escape sequence in the path. '%s'", path); } #endif if (*pp != *bp) @@ -411,7 +411,7 @@ abs2rel(const char *path, const char *ba if (*pp == EOE) pp++; else - die("illegal escape sequence in the path. '%s'", path); + die("invalid escape sequence in the path. '%s'", path); } #endif if ((*pp == 0 && *bp == '/') || (*pp == '/' && *bp == 0)) diff -pur global-6.2.12/libutil/args.c global-6.2-12/libutil/args.c --- global-6.2.12/libutil/args.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/args.c 2014-04-01 21:34:35 +1000 @@ -133,7 +133,7 @@ args_read(void) p = strbuf_fgets(sb, ip, STRBUF_NOCRLF); break; default: - die("args_read: illegal type."); + die("args_read: invalid type."); } return p; } diff -pur global-6.2.12/libutil/dbop.c global-6.2-12/libutil/dbop.c --- global-6.2.12/libutil/dbop.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/dbop.c 2014-04-01 21:34:35 +1000 @@ -656,7 +656,7 @@ dbop_getoption(DBOP *dbop, const char *k if ((p = dbop_get(dbop, key)) == NULL) return NULL; if (dbop->lastsize <= strlen(key)) - die("illegal format (dbop_getoption)."); + die("invalid format (dbop_getoption)."); for (p += strlen(key); *p && isspace((unsigned char)*p); p++) ; strlimcpy(buf, p, sizeof(buf)); diff -pur global-6.2.12/libutil/gtagsop.c global-6.2-12/libutil/gtagsop.c --- global-6.2.12/libutil/gtagsop.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/gtagsop.c 2014-04-01 21:41:02 +1000 @@ -741,7 +741,7 @@ gtags_first(GTOP *gtop, const char *patt if (gtop->preg == NULL) die("gtags_first: impossible (3)."); if (regcomp(gtop->preg, strbuf_value(regex), regflags) != 0) - die("illegal regular expression."); + die("invalid regular expression."); } /* * If GTOP_PATH is set, at first, we collect all path names in a pool and @@ -772,7 +772,7 @@ again0: /* extract file id */ p = locatestring(tagline, " ", MATCH_FIRST); if (p == NULL) - die("Illegal tag record. '%s'\n", tagline); + die("Invalid tag record. '%s'\n", tagline); *p = '\0'; entry = strhash_assign(gtop->path_hash, tagline, 1); /* new entry: get path name and set. */ @@ -1132,7 +1132,7 @@ segment_read(GTOP *gtop) gtp->path = sh->name; lineno = seekto(gtp->tagline, SEEKTO_LINENO); if (lineno == NULL) - die("illegal tag record.\n%s", tagline); + die("invalid tag record.\n%s", tagline); gtp->lineno = atoi(lineno); } /* diff -pur global-6.2.12/libutil/rewrite.c global-6.2-12/libutil/rewrite.c --- global-6.2.12/libutil/rewrite.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/rewrite.c 2014-04-01 21:34:35 +1000 @@ -58,7 +58,7 @@ rewrite_close(rewrite); * @param[in] replace (allows '&') * @param[in] flags for regcomp(3) * @return rewrite #REWRITE structure - * NULL: illegal regular expression + * NULL: invalid regular expression */ REWRITE * rewrite_open(const char *pattern, const char *replace, int flags) @@ -97,7 +97,7 @@ rewrite_open(const char *pattern, const * @param[in] pattern * @param[in] flags for regcomp(3) * @return 0: normal - * -1: illegal regular expression + * -1: invalid regular expression */ int rewrite_pattern(REWRITE *rewrite, const char *pattern, int flags) diff -pur global-6.2.12/libutil/split.c global-6.2-12/libutil/split.c --- global-6.2.12/libutil/split.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/split.c 2014-04-01 21:34:35 +1000 @@ -185,7 +185,7 @@ parse_xid(const char *ctags_xid, char *s s_fid[i++] = *p; } if (*p++ != ' ') - die("illegal ctags-xid format record. '%s'", ctags_xid); + die("invalid ctags-xid format record. '%s'", ctags_xid); if (s_fid) s_fid[i] = '\0'; if (n_fid != NULL) diff -pur global-6.2.12/libutil/varray.c global-6.2-12/libutil/varray.c --- global-6.2.12/libutil/varray.c 2014-03-31 14:45:06 +1000 +++ global-6.2-12/libutil/varray.c 2014-04-01 21:34:35 +1000 @@ -118,7 +118,7 @@ void * varray_assign(VARRAY *vb, int index, int force) { if (index < 0) - die("varray_assign: illegal index value."); + die("varray_assign: invalid index value."); if (index >= vb->length) { if (force) vb->length = index + 1;