zsh-users
 help / color / mirror / code / Atom feed
* twiddle-number problem?
@ 1996-09-25 22:49 Colin Holmes
  1996-09-26 13:11 ` Zefram
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Holmes @ 1996-09-25 22:49 UTC (permalink / raw)
  To: zsh-users

Hi,

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.  When referring to this
user home directory with ~4Dgifts, zsh tells me

fuligin_3:37PM>ls ~4Dgifts
zsh: not enough directory stack entries.

and the same error for echo ~4Dgifts

tcsh handles this user correctly.

Details:  this problem was observed in zsh-2.6beta17 and now in zsh-3.0.0
on Irix 5.3 and 6.2

BTW: zsh-3.0.0 built clean "out of the box" on both Irix 5.3 and 6.2.  No
other obvious problems seen yet....

Colin.

-- 

* CJ Holmes, PhD, 			
* Dept Neurology, UCLA School of Medicine, 4238 Reed Bldg, Box 951769
* 710 Westwood Plaza, Los Angeles, CA 90095-1769
* ph 310-206-2101 fx 310-206-5518 email holmes@loni.ucla.edu


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: twiddle-number problem?
  1996-09-25 22:49 twiddle-number problem? Colin Holmes
@ 1996-09-26 13:11 ` Zefram
  1996-09-26 17:42   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Zefram @ 1996-09-26 13:11 UTC (permalink / raw)
  To: Colin Holmes; +Cc: zsh-users

>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.  You'll have to
give the directory some other name; "fourd=/home/4Dgifts" would make
~fourd work.

-zefram


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: twiddle-number problem?
  1996-09-26 13:11 ` Zefram
@ 1996-09-26 17:42   ` Bart Schaefer
  1996-09-27  7:26     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1996-09-26 17:42 UTC (permalink / raw)
  To: Zefram, Colin Holmes, zsh-users

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"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: twiddle-number problem?
  1996-09-26 17:42   ` Bart Schaefer
@ 1996-09-27  7:26     ` Peter Stephenson
  1996-09-27  8:28       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 1996-09-27  7:26 UTC (permalink / raw)
  To: zsh-users

"Bart Schaefer" wrote:
> I can't find anything that the following patch breaks (except a directory
> stack 1000+ levels deep).  Can anyone else?

Actually, anyone with 1000 levels is presumably not going to be fazed
by having to type ~+1000, so I don't even think that's an objection.

> *** Src/subst.c.0	Mon Sep 23 22:04:54 1996
> --- Src/subst.c	Thu Sep 26 10:13:40 1996
> ...
> ! 	} else if (idigit(str[1]) &&   			/* ~42 */
> ! 		   (isend(str[2]) ||
> ! 		    (idigit(str[2]) &&
> ! 		     (isend(str[3]) ||
> ! 		      (idigit(str[3]) &&
> ! 		       isend(str[4]))))) {
> ...

Oops, there's a close parenthesis missing in that list line.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: twiddle-number problem?
  1996-09-27  7:26     ` Peter Stephenson
@ 1996-09-27  8:28       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1996-09-27  8:28 UTC (permalink / raw)
  To: Peter Stephenson, zsh-users

On Sep 27,  9:26am, Peter Stephenson wrote:
} Subject: Re: twiddle-number problem?
}
} > *** Src/subst.c.0	Mon Sep 23 22:04:54 1996
} > --- Src/subst.c	Thu Sep 26 10:13:40 1996
} > ...
} > ! 	} else if (idigit(str[1]) &&   			/* ~42 */
} > ! 		   (isend(str[2]) ||
} > ! 		    (idigit(str[2]) &&
} > ! 		     (isend(str[3]) ||
} > ! 		      (idigit(str[3]) &&
} > ! 		       isend(str[4]))))) {
} > ...
} 
} Oops, there's a close parenthesis missing in that list line.

Hmm, that's funny, it's not missing in the copy I compiled.  How did I
manage that?  Oh well, add the paren by hand ...


-- 
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"


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-09-27  8:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-09-25 22:49 twiddle-number problem? Colin Holmes
1996-09-26 13:11 ` Zefram
1996-09-26 17:42   ` Bart Schaefer
1996-09-27  7:26     ` Peter Stephenson
1996-09-27  8:28       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).