search for: matchlen

Displaying 7 results from an estimated 7 matches for "matchlen".

2006 Apr 01
0
sftp tab completion patch (First release - NOT FOR INCLUDING YET)
..."rue the day" + * XXX Wait for Theo to rip me a new one due to the code below + * XXX Sit on the patch for another year and rewrite using libunedit 2.0 + */ +char * +complete_ambiguous(char *word, char **list, size_t count) +{ + if (count > 1) { + char *match = list[0]; + size_t y, matchlen = strlen(match); + + printf("\n"); + printf("%s\t", list[0]); + for (y = 1; list[y]; y++) { + int x; + + printf("%s\t", list[y]); + for (x = 0; x < matchlen; x++) + if (match[x] != list[y][x]) + break; + + matchlen = x; + } + printf("\n&qu...
2012 Sep 07
1
[LLVMdev] teaching FileCheck to handle variations in order
...alse) : MatchEOF(matchEOF) { } + Pattern(enum MatchType t = MatchStr) : Type(t) { } bool ParsePattern(StringRef PatternStr, SourceMgr &SM); @@ -285,9 +297,18 @@ bool Pattern::AddRegExToRegEx(StringRef RegexStr, unsigned &CurParen, size_t Pattern::Match(StringRef Buffer, size_t &MatchLen, StringMap<StringRef> &VariableTable) const { // If this is the EOF pattern, match it immediately. - if (MatchEOF) { + switch (Type) { + case MatchStr: + break; + case MatchCurrent: + MatchLen = 0; + return 0; + case MatchEndOfFile: MatchLen =...
2007 Dec 12
0
Revisiting sftp tab completion patch
...ot;%-*s", colspace, tmp); + if (m >= columns) { + printf("\n"); + m = 1; + } else + m++; + } + printf("\n"); +} + +char * +complete_ambiguous(const char *word, char **list, size_t count) +{ + if (word == NULL) + return (NULL); + + if (count > 0) { + u_int y, matchlen = strlen(list[0]); + + for (y = 1; list[y]; y++) { + int x; + + for (x = 0; x < matchlen; x++) + if (list[0][x] != list[y][x]) + break; + + matchlen = x; + } + + if (matchlen > strlen(word)) { + char *tmp = xstrdup(list[0]); + + tmp[matchlen] = NULL; + return (tmp); +...
2012 Sep 07
5
[LLVMdev] teaching FileCheck to handle variations in order
...alse) : MatchEOF(matchEOF) { } + Pattern(enum MatchType t = MatchStr) : Type(t) { } bool ParsePattern(StringRef PatternStr, SourceMgr &SM); @@ -285,9 +297,18 @@ bool Pattern::AddRegExToRegEx(StringRef RegexStr, unsigned &CurParen, size_t Pattern::Match(StringRef Buffer, size_t &MatchLen, StringMap<StringRef> &VariableTable) const { // If this is the EOF pattern, match it immediately. - if (MatchEOF) { + switch (Type) { + case MatchStr: + break; + case MatchCurrent: + MatchLen = 0; + return 0; + case MatchEndOfFile: MatchLen =...
2012 Sep 07
0
[LLVMdev] teaching FileCheck to handle variations in order
On 9/7/2012 7:20 AM, Matthew Curtis wrote: > > The attached patch implements one possible solution. It introduces a > position stack and a couple of directives: > > * 'CHECK-PUSH:' pushes the current match position onto the stack. > * 'CHECK-POP:' pops the top value off of the stack and uses it to set > the current match position. > > The above
2012 Apr 20
1
[PATCH] multiqueue: a hodge podge of things
...} #define fc_enum_name_match(title, table_type, table) \ static int get_fc_##title##_match(const char *table_key, \ enum table_type *value) \ { \ int i; \ \ for (i = 0; i < ARRAY_SIZE(table); i++) { \ if (strncmp(table_key, table[i].name, \ table[i].matchlen) == 0) { \ *value = table[i].value; \ return 0; /* success */ \ } \ } \ return 1; /* failure */ \ } /* Convert fc_port_type values to ascii string name */ static struct { enum fc_port_type value; char *name; } fc_port_type_names[] = { { FC_PORTTYPE_UNKNOWN,...
2012 Apr 20
1
[PATCH] multiqueue: a hodge podge of things
...} #define fc_enum_name_match(title, table_type, table) \ static int get_fc_##title##_match(const char *table_key, \ enum table_type *value) \ { \ int i; \ \ for (i = 0; i < ARRAY_SIZE(table); i++) { \ if (strncmp(table_key, table[i].name, \ table[i].matchlen) == 0) { \ *value = table[i].value; \ return 0; /* success */ \ } \ } \ return 1; /* failure */ \ } /* Convert fc_port_type values to ascii string name */ static struct { enum fc_port_type value; char *name; } fc_port_type_names[] = { { FC_PORTTYPE_UNKNOWN,...