Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: twiddle-number problem?
- X-seq: zsh-users 426
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Zefram <zefram@xxxxxxxxxxxxxxxxx>, colin@xxxxxxxxxxxxxxxxxxxxx (Colin Holmes), zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: twiddle-number problem?
- Date: Thu, 26 Sep 1996 10:42:53 -0700
- In-reply-to: Zefram <zefram@xxxxxxxxxxxxxxxxx> "Re: twiddle-number problem?" (Sep 26, 2:11pm)
- References: <6675.199609261311@xxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Sep 26, 2:11pm, Zefram wrote:
} Subject: Re: twiddle-number problem?
}
} >Can anyone explain how I can get tilde-user completion to
} >handle usernames starting with numbers? On SGIs, there's
} >a default user called "4Dgifts" that contains nice source
} >code examples and other goodies.
}
} *sigh*
}
} When I proposed using ~<number> instead of =<number> for the directory
} stack, I assumed that no one would be perverse enough to have a
} username start with a digit or punctuation character.
What, you've never seen AOL and MCImail and CompuServe usernames in your
email? There are many thousands, if not millions, of such perversities.
This can't be *that* hard to fix in a reasonable manner. If you assume
that nobody is going to have a username consisting *entirely* of digits,
and you further assume that nobody is going to have a directory stack more
than 99 (or 999 if you're paranoid) directories deep, you can do a really
fast test to determine whether something beginning with ~<number> is a
directory stack reference or a username.
zagzig<2> echo ~5
/usr/src/local/zsh-3.0.1-test2-work/Src
zagzig<3> echo ~3
/usr/src/local
zagzig<4> echo ~4DGifts
zsh: no such user or named directory: 4DGifts
I can't find anything that the following patch breaks (except a directory
stack 1000+ levels deep). Can anyone else?
*** Src/subst.c.0 Mon Sep 23 22:04:54 1996
--- Src/subst.c Thu Sep 26 10:13:40 1996
***************
*** 344,350 ****
} else if (str[1] == '-' && idigit(str[2])) { /* ~-42 */
str++;
goto dstack;
! } else if (idigit(str[1])) { /* ~42 */
char *ds, *ptr;
int val;
dstack:
--- 344,355 ----
} else if (str[1] == '-' && idigit(str[2])) { /* ~-42 */
str++;
goto dstack;
! } else if (idigit(str[1]) && /* ~42 */
! (isend(str[2]) ||
! (idigit(str[2]) &&
! (isend(str[3]) ||
! (idigit(str[3]) &&
! isend(str[4]))))) {
char *ds, *ptr;
int val;
dstack:
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author