This does not include UTF8 basic character,

so if someone do <something> <internationnal file name>

And it want to do it again for that file ... sviňák , does not work.

This problem should be address in isalnum, i guess, i think some c++
lib did it already,
and i have a headache everytime i want to use \w in a regexp.

current $ ./a.out élol
NOP
_____
~
current $ ./a.out elol
elol_____
~
current $ cat /tmp/foo.c
#include <stdio.h>

int main(int argc, char** argv) {
  if (isalnum(argv[1][0] )) printf("%s", argv[1]); else printf ("NOP\n");
}

On Thu, Sep 8, 2016 at 6:08 AM, Stuart Henderson <s...@spacehopper.org> wrote:
> On 2016/09/08 10:45, Nicholas Marriott wrote:
>> Yeah we probably shouldn't bother to look for commands that aren't 
>> [A-Za-z0-9_-]:
>
> I don't think - is necessary, it's not a valid character for an array
> name so it can't be used here anyway. Otherwise OK.
>
>> Index: edit.c
>> ===================================================================
>> RCS file: /cvs/src/bin/ksh/edit.c,v
>> retrieving revision 1.56
>> diff -u -p -r1.56 edit.c
>> --- edit.c    7 Sep 2016 04:42:31 -0000       1.56
>> +++ edit.c    8 Sep 2016 09:45:21 -0000
>> @@ -584,9 +584,8 @@ x_try_array(const char *buf, int buflen,
>>      int *nwords, char ***words)
>>  {
>>       const char *cmd, *cp;
>> -     int cmdlen, n;
>> +     int cmdlen, n, i, slen;
>>       char *name, *s;
>> -     size_t slen;
>>       struct tbl *v, *vp;
>>
>>       *nwords = 0;
>> @@ -604,6 +603,10 @@ x_try_array(const char *buf, int buflen,
>>       cmdlen = 0;
>>       while (cmd + cmdlen < want && !isspace((u_char)cmd[cmdlen]))
>>               cmdlen++;
>> +     for (i = 0; i < cmdlen; i++) {
>> +             if (!isalnum((u_char)cmd[i]) && cmd[i] != '_' && cmd[i] != '-')
>> +                     return 0;
>> +     }
>>
>>       /* Take a stab at argument count from here. */
>>       n = 1;
>>
>>
>> On Thu, Sep 08, 2016 at 09:43:53AM +0100, Stuart Henderson wrote:
>> > I just ran into this which was introduced with custom completions
>> > (I haven't setup any complete_* arrays).
>> >
>> > $ ag "(foo)[^_]" /u<tab>
>> >
>> > results in
>



-- 
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\

Reply via email to