zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Zefram <zefram@dcs.warwick.ac.uk>,
	colin@fuligin.loni.ucla.edu (Colin Holmes),
	zsh-users@math.gatech.edu
Subject: Re: twiddle-number problem?
Date: Thu, 26 Sep 1996 10:42:53 -0700	[thread overview]
Message-ID: <960926104254.ZM15298@candle.brasslantern.com> (raw)
In-Reply-To: Zefram <zefram@dcs.warwick.ac.uk> "Re: twiddle-number problem?" (Sep 26,  2:11pm)

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"


  reply	other threads:[~1996-09-26 17:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-25 22:49 Colin Holmes
1996-09-26 13:11 ` Zefram
1996-09-26 17:42   ` Bart Schaefer [this message]
1996-09-27  7:26     ` Peter Stephenson
1996-09-27  8:28       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960926104254.ZM15298@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=colin@fuligin.loni.ucla.edu \
    --cc=schaefer@nbn.com \
    --cc=zefram@dcs.warwick.ac.uk \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).