rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Stefan Dalibor <dalibor@immd3.informatik.uni-erlangen.de>
To: rc-owner
Subject: Re: Question about input redirection in -c
Date: Wed, 18 Aug 1993 03:47:25 -0400	[thread overview]
Message-ID: <9308180747.AA13051@faui33.informatik.uni-erlangen.de> (raw)


> I.e., you are conflating "stdin" with "the place rc reads commands
> from".

Yes, thanks - I was indeed under the impression that `<' would do
input source redirection, not just file-descriptor manipulation.
In the end, it turned out to be easy (like most things with rc):
  rc -c 'pwd; exec <0=]; . -i /dev/tty'
does what I want (use readline() when sourcing the tty). 

Some memory nitpicking: Purify suggested the following changes to
input.c; the first hunk avoids a memory leak when using rc with
readline (the documentation for GNU-readline says that the strings
returned by readline() should be freed if no longer needed), the
second prevents accessing uninitialized memory (as istack's
fd-component isn't initialized by pushstring()). The diffs are against
plain rc-1.4. Purify detected a few other minor memory leaks, but I
leave it to the author to plug them in the next release, as promised
in an earlier message :).

Stefan

*** rc-1.4/input.c	Fri Dec 11 10:21:17 1992
--- input.c	Tue Aug 17 17:04:51 1993
***************
*** 129,132 ****
--- 129,133 ----
  					strcpy(inbuf+2, rlinebuf);
  					strcat(inbuf+2, "\n");
+ 					efree(rlinebuf);
  				}
  			} else
***************
*** 214,222 ****
  	efree(inbuf);
  	--istack;
! 	realgchar = (istack->t == iString ? stringgchar : fdgchar);
! 	if (istack->fd == -1) { /* top of input stack */
  		realgchar = dead;
  		realugchar = ugdead;
  	}
  	last = istack->last;
  	eofread = istack->eofread;
--- 215,226 ----
  	efree(inbuf);
  	--istack;
! 	if(istack->t == iString)
! 		realgchar = stringgchar;
! 	else if (istack->fd == -1) { /* top of input stack */
  		realgchar = dead;
  		realugchar = ugdead;
  	}
+ 	else
+ 		realgchar = fdgchar;
  	last = istack->last;
  	eofread = istack->eofread;


             reply	other threads:[~1993-08-18 16:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-18  7:47 Stefan Dalibor [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-08-13 21:17 Byron Rakitzis
1993-08-13 15:47 Stefan Dalibor

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=9308180747.AA13051@faui33.informatik.uni-erlangen.de \
    --to=dalibor@immd3.informatik.uni-erlangen.de \
    /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).