rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: ~ expansion
@ 1993-01-19  5:07 Paul Haahr
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Haahr @ 1993-01-19  5:07 UTC (permalink / raw)
  To: steve; +Cc: rc

well, the one from es could be lifted quite easily and retrofitted.
it's ftp'able from ftp.white.toronto.edu.


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

* Re: ~ expansion
  1993-01-19  3:35 Steve Rikli
@ 1993-01-19  7:14 ` brendan
  0 siblings, 0 replies; 3+ messages in thread
From: brendan @ 1993-01-19  7:14 UTC (permalink / raw)
  To: Steve Rikli; +Cc: rc


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)


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

* ~ expansion
@ 1993-01-19  3:35 Steve Rikli
  1993-01-19  7:14 ` brendan
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Rikli @ 1993-01-19  3:35 UTC (permalink / raw)
  To: rc

Would some kind soul who archived the ~username expansion discussion
be so kind as to forward it to me?

Failing that, would someone who has hacked a workable ~username 
definition/function be willing to share?

thnx,
sr.


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

end of thread, other threads:[~1993-01-19  7:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-01-19  5:07 ~ expansion Paul Haahr
  -- strict thread matches above, loose matches on Subject: below --
1993-01-19  3:35 Steve Rikli
1993-01-19  7:14 ` brendan

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).