rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: brendan@cygnus.com
To: Steve Rikli <steve@archone.tamu.edu>
Cc: rc@archone.tamu.edu
Subject: Re: ~ expansion
Date: Tue, 19 Jan 1993 02:14:46 -0500	[thread overview]
Message-ID: <9301190714.AA21881@cygnus.com> (raw)
In-Reply-To: Your message of "Mon, 18 Jan 93 22:35:07 EST." <93Jan18.213510cst.45316@archone.tamu.edu>


Here's my hack for it:

*** glob.c.~1~	Mon Feb 17 14:45:24 1992
--- glob.c	Tue Nov 10 02:08:26 1992
*************** static List *doglob(char *w, char *m) {
*** 194,198 ****
  	   zero) since doglob gets called iff there's a metacharacter to be matched
  	*/
! 	if (*s == '\0') {
  		matched = dmatch(".", dir, metadir);
  		goto end;
--- 195,199 ----
  	   zero) since doglob gets called iff there's a metacharacter to be matched
  	*/
! 	if (*s == '\0' && *w != '~') {
  		matched = dmatch(".", dir, metadir);
  		goto end;
*************** static List *doglob(char *w, char *m) {
*** 203,206 ****
--- 204,216 ----
  		firstdir.n = NULL;
  		matched = &firstdir;
+ 	} else if (*w == '~') {
+ 		firstdir.w = varlookup("home")->w;
+ 		firstdir.n = NULL;
+ 		matched = &firstdir;
+ 		if (*s == '\0') {
+ 			firstdir.m = NULL;
+ 			goto end;
+ 		}
+ 		firstdir.m = metadir;
  	} else {
  		/*
*** lex.c.~1~	Tue Mar 31 08:40:20 1992
--- lex.c	Tue Nov 10 02:04:25 1992
***************
*** 38,42 ****
  	1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
  	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,
! 	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
--- 38,42 ----
  	1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
  	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,
! 	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, /* ~ */ 0, 0,
  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
*************** top:	while ((c = gchar()) == ' ' || c ==
*** 98,104 ****
  		w = RW;
  		i = 0;
  	read:	do {
  			buf[i++] = c;
! 			if (c == '?' || c == '[' || c == '*')
  				saw_meta = TRUE;
  			if (i >= bufsize)
--- 98,111 ----
  		w = RW;
  		i = 0;
+ 		if (c == '~') {
+ 			c = gchar();
+ 			ugchar(c);
+ 			if (c == ' ' || c == '\t')
+ 				return TWIDDLE;
+ 			c = '~';
+ 		}
  	read:	do {
  			buf[i++] = c;
! 			if (c == '?' || c == '[' || c == '*' || c == '~')
  				saw_meta = TRUE;
  			if (i >= bufsize)


  reply	other threads:[~1993-01-19  7:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-01-19  3:35 Steve Rikli
1993-01-19  7:14 ` brendan [this message]
1993-01-19  5:07 Paul Haahr

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=9301190714.AA21881@cygnus.com \
    --to=brendan@cygnus.com \
    --cc=rc@archone.tamu.edu \
    --cc=steve@archone.tamu.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.
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).