mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
remove compfmt; a bit of explanation for compfiles and compgroups (12068)
This commit is contained in:
parent
470515922c
commit
3ff5a17d8c
@ -1,5 +1,8 @@
|
||||
2000-06-26 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 12068: Doc/Zsh/mod_computil.yo, Src/Zle/computil.c: remove
|
||||
compfmt; a bit of explanation for compfiles and compgroups
|
||||
|
||||
* 12067: Completion/Core/_history, Src/Zle/zle_tricky.c: typo in
|
||||
_history; missing free()s in zle_tricky.c
|
||||
|
||||
|
@ -43,16 +43,22 @@ tt(compadd) to register the matches with the completion code.
|
||||
findex(compfiles)
|
||||
item(tt(compfiles))(
|
||||
Used by the tt(_path_files) function to optimize complex recursive
|
||||
filename generation (globbing).
|
||||
)
|
||||
findex(compfmt)
|
||||
item(tt(compfmt))(
|
||||
An obsolete form of `tt(zformat -f)'. Do not use this.
|
||||
filename generation (globbing). It does three things. With the
|
||||
tt(-p) and tt(-P) options it builds the glob patterns to use,
|
||||
including the paths already handled and trying to optimize the
|
||||
patterns with respect to the prefix and suffix from the line and the
|
||||
match specification currently used. The tt(-i) option does the
|
||||
directory tests for the tt(ignore-parents) style and the tt(-r) option
|
||||
tests if a component for some of the matches are equal to the string
|
||||
on the line and removes all other matches if that is true.
|
||||
)
|
||||
findex(compgroups)
|
||||
item(tt(compgroups))(
|
||||
Used by the tt(_tags) function to implement the internals of the
|
||||
tt(group-order) style.
|
||||
tt(group-order) style. This only takes its arguments as names of
|
||||
completion groups and creates the groups for it (all six types: sorted
|
||||
and unsorted, both without removing duplicates, with removing all
|
||||
duplicates and with removing consecutive duplicates).
|
||||
)
|
||||
findex(compquote)
|
||||
item(tt(compquote) var(names) ...)(
|
||||
|
@ -3026,50 +3026,6 @@ bin_comptry(char *nam, char **args, char *ops, int func)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
fmtstr(char *str, char c, char *repl)
|
||||
{
|
||||
int len, num, rlen;
|
||||
char *s, *ret, *rp;
|
||||
|
||||
len = strlen(str);
|
||||
rlen = strlen(repl);
|
||||
|
||||
for (num = 0, s = str; *s; s++)
|
||||
if (*s == '%' && s[1] == c)
|
||||
num++, s++;
|
||||
|
||||
ret = (char *) zhalloc((num * (rlen - 2)) + len + 1);
|
||||
|
||||
for (s = str, rp = ret; *s; s++) {
|
||||
if (*s == '%' && s[1] == c) {
|
||||
strcpy(rp, repl);
|
||||
rp += rlen;
|
||||
s++;
|
||||
} else
|
||||
*rp++ = *s;
|
||||
}
|
||||
*rp = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
bin_compfmt(char *nam, char **args, char *ops, int func)
|
||||
{
|
||||
char *param = args[0], *str = args[1];
|
||||
|
||||
for (args += 2; *args; args++) {
|
||||
if (args[0][1] != ':') {
|
||||
zwarnnam(nam, "invalid argument `%s'", args[0], 0);
|
||||
return 1;
|
||||
}
|
||||
str = fmtstr(str, **args, *args + 2);
|
||||
}
|
||||
setsparam(param, ztrdup(str));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PATH_MAX2 (PATH_MAX * 2)
|
||||
|
||||
static LinkList
|
||||
@ -3699,7 +3655,6 @@ static struct builtin bintab[] = {
|
||||
BUILTIN("compquote", 0, bin_compquote, 1, -1, 0, NULL, NULL),
|
||||
BUILTIN("comptags", 0, bin_comptags, 1, -1, 0, NULL, NULL),
|
||||
BUILTIN("comptry", 0, bin_comptry, 0, -1, 0, NULL, NULL),
|
||||
BUILTIN("compfmt", 0, bin_compfmt, 2, -1, 0, NULL, NULL),
|
||||
BUILTIN("compfiles", 0, bin_compfiles, 1, -1, 0, NULL, NULL),
|
||||
BUILTIN("compgroups", 0, bin_compgroups, 1, -1, 0, NULL, NULL),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user