9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Practical issue on using rc shell
@ 2009-11-13 18:41 Maurí­cio CA
  2009-11-13 18:52 ` erik quanstrom
  2009-11-13 18:54 ` Tim Newsham
  0 siblings, 2 replies; 9+ messages in thread
From: Maurí­cio CA @ 2009-11-13 18:41 UTC (permalink / raw)
  To: 9fans

Hi,

I'm new to plan9 from user space. I've started using rc shell for
scripts and, for daily use, I would like to solve a problem.

I see that rc isn't built with readline or similar. So, do you use
some alternative? Or do you think I can live without it?

Thanks,
Maur�cio




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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 18:41 [9fans] Practical issue on using rc shell Maurí­cio CA
@ 2009-11-13 18:52 ` erik quanstrom
  2009-11-13 18:54 ` Tim Newsham
  1 sibling, 0 replies; 9+ messages in thread
From: erik quanstrom @ 2009-11-13 18:52 UTC (permalink / raw)
  To: 9fans

what i find i can't live without is a record
of the commands i've typed.  sometimes a
one-liner from last week is useful.  i use the
commands - and -- (source: /n/sources/contrib/quanstro/src/history.c)
along with the following patch to rc to make it
go.

- erik

; 9diff fns.h
/n/sources/plan9//sys/src/cmd/rc/fns.h:61,66 - fns.h:61,67
  void	start(code*, int, var*);
  int	truestatus(void);
  void	usage(char*);
+ void whistory(tree*);
  int	wordchr(int);
  void	yyerror(char*);
  int	yylex(void);
; 9diff *.y
post...
/n/sources/plan9//sys/src/cmd/rc/syn.y:12,17 - syn.y:12,28
  %{
  #include "rc.h"
  #include "fns.h"
+
+ int
+ hcompile(tree *t)
+ {
+ 	int i;
+
+ 	if(i = compile(t))
+ 		whistory(t);
+ 	return !i;
+ }
+
  %}
  %union{
  	struct tree *tree;
/n/sources/plan9//sys/src/cmd/rc/syn.y:22,28 - syn.y:33,39
  %type<tree> WORD REDIR DUP PIPE
  %%
  rc:				{ return 1;}
- |	line '\n'		{return !compile($1);}
+ |	line '\n'			{ return hcompile($1); }
  line:	cmd
  |	cmdsa line		{$$=tree2(';', $1, $2);}
  body:	cmd
; cat history.c
#include "rc.h"
#include "exec.h"
#include "fns.h"
#include "io.h"

void
whistory(tree *t){
	char* s;
	int fd, flags;
	io* o;
	var* v;

	if(!runq->iflag || !t)
		return;
	v = vlook("history");
	if(!v->val || count(v->val) != 1)
		return;
	if(v->fn)
		return;	/* fn history {echo $*>>$history_file} ? */

	s = v->val->word;
	flags = OWRITE;
	if((fd=open(s, flags))<0 && (fd=create(s, flags, DMAPPEND|0666L))<0){
		/* setvar("history", 0); */
		return;
	}

	o = openfd(fd);
	seek(fd, 0, 2);
	pfmt(o, "%t\n", t);
	closeio(o);
}



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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 18:41 [9fans] Practical issue on using rc shell Maurí­cio CA
  2009-11-13 18:52 ` erik quanstrom
@ 2009-11-13 18:54 ` Tim Newsham
  2009-11-13 19:02   ` David Leimbach
  1 sibling, 1 reply; 9+ messages in thread
From: Tim Newsham @ 2009-11-13 18:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: TEXT/PLAIN, Size: 630 bytes --]

> Hi,
>
> I'm new to plan9 from user space. I've started using rc shell for
> scripts and, for daily use, I would like to solve a problem.
>
> I see that rc isn't built with readline or similar. So, do you use
> some alternative? Or do you think I can live without it?

For scripting it shouldn't be an issue. For interactive use
it can be a pain if you are using a normal terminal environment.
In plan9 you'd usually run rc in a rio window or in acme where
the environment lets you edit and reuse commands from the scrollback.

> Thanks,
> Maurício

Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com

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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 18:54 ` Tim Newsham
@ 2009-11-13 19:02   ` David Leimbach
  2009-11-13 20:46     ` pmarin
  0 siblings, 1 reply; 9+ messages in thread
From: David Leimbach @ 2009-11-13 19:02 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

On Fri, Nov 13, 2009 at 10:54 AM, Tim Newsham <newsham@lava.net> wrote:

> Hi,
>>
>> I'm new to plan9 from user space. I've started using rc shell for
>> scripts and, for daily use, I would like to solve a problem.
>>
>> I see that rc isn't built with readline or similar. So, do you use
>> some alternative? Or do you think I can live without it?
>>
>
> For scripting it shouldn't be an issue. For interactive use
> it can be a pain if you are using a normal terminal environment.
> In plan9 you'd usually run rc in a rio window or in acme where
> the environment lets you edit and reuse commands from the scrollback.
>
>
If you've already got plan9 from user space, try using rc with 9term, or
inside an Acme "win" session.

Plan 9 is very mouse driven and you should use a terminal window that lets
you take advantage of that interactivity.

Dave



>  Thanks,
>> Maurício
>>
>
> Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com

[-- Attachment #2: Type: text/html, Size: 1868 bytes --]

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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 19:02   ` David Leimbach
@ 2009-11-13 20:46     ` pmarin
  2009-11-13 20:50       ` Venkatesh Srinivas
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: pmarin @ 2009-11-13 20:46 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Fortu

On Fri, Nov 13, 2009 at 8:02 PM, David Leimbach <leimy2k@gmail.com> wrote:
>
>
> On Fri, Nov 13, 2009 at 10:54 AM, Tim Newsham <newsham@lava.net> wrote:
>>>
>>> Hi,
>>>
>>> I'm new to plan9 from user space. I've started using rc shell for
>>> scripts and, for daily use, I would like to solve a problem.
>>>
>>> I see that rc isn't built with readline or similar. So, do you use
>>> some alternative? Or do you think I can live without it?
>>
>> For scripting it shouldn't be an issue. For interactive use
>> it can be a pain if you are using a normal terminal environment.
>> In plan9 you'd usually run rc in a rio window or in acme where
>> the environment lets you edit and reuse commands from the scrollback.
>>
>
> If you've already got plan9 from user space, try using rc with 9term, or
> inside an Acme "win" session.
> Plan 9 is very mouse driven and you should use a terminal window that lets
> you take advantage of that interactivity.
> Dave
>
>>>
>>> Thanks,
>>> Maurício
>>
>> Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com
>

fortunately, the unix world is less radical, you can use rlfe
http://per.bothner.com/software/

pmarin



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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 20:46     ` pmarin
@ 2009-11-13 20:50       ` Venkatesh Srinivas
  2009-11-13 20:55       ` Roman Shaposhnik
  2009-11-13 21:00       ` Nick LaForge
  2 siblings, 0 replies; 9+ messages in thread
From: Venkatesh Srinivas @ 2009-11-13 20:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

The other (Byron Rakitzis) unix port of rc can be linked against
either readline or editline.

-- vs



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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 20:46     ` pmarin
  2009-11-13 20:50       ` Venkatesh Srinivas
@ 2009-11-13 20:55       ` Roman Shaposhnik
  2009-11-13 21:00       ` Nick LaForge
  2 siblings, 0 replies; 9+ messages in thread
From: Roman Shaposhnik @ 2009-11-13 20:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Nov 13, 2009 at 12:46 PM, pmarin <pacogeek@gmail.com> wrote:
> fortunately, the unix world is less radical, you can use rlfe
> http://per.bothner.com/software/

There's also versatile socat:
    http://www.dest-unreach.org/socat/doc/socat.html#EXAMPLE_ADDRESS_READLINE

Thanks,
Roman.



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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 20:46     ` pmarin
  2009-11-13 20:50       ` Venkatesh Srinivas
  2009-11-13 20:55       ` Roman Shaposhnik
@ 2009-11-13 21:00       ` Nick LaForge
  2009-11-13 21:10         ` pmarin
  2 siblings, 1 reply; 9+ messages in thread
From: Nick LaForge @ 2009-11-13 21:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Nov 13, 2009 at 12:46 PM, pmarin <pacogeek@gmail.com> wrote:
> Fortu
>
> fortunately, the unix world is less radical, you can use rlfe
> http://per.bothner.com/software/
>
> pmarin

fortunately, plan9 includes a c compiler

Nick



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

* Re: [9fans] Practical issue on using rc shell
  2009-11-13 21:00       ` Nick LaForge
@ 2009-11-13 21:10         ` pmarin
  0 siblings, 0 replies; 9+ messages in thread
From: pmarin @ 2009-11-13 21:10 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

fortunately,  in unix you can run go :).


On Fri, Nov 13, 2009 at 10:00 PM, Nick LaForge <nicklaforge@gmail.com> wrote:
> On Fri, Nov 13, 2009 at 12:46 PM, pmarin <pacogeek@gmail.com> wrote:
>> Fortu
>>
>> fortunately, the unix world is less radical, you can use rlfe
>> http://per.bothner.com/software/
>>
>> pmarin
>
> fortunately, plan9 includes a c compiler
>
> Nick
>
>



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

end of thread, other threads:[~2009-11-13 21:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-13 18:41 [9fans] Practical issue on using rc shell Maurí­cio CA
2009-11-13 18:52 ` erik quanstrom
2009-11-13 18:54 ` Tim Newsham
2009-11-13 19:02   ` David Leimbach
2009-11-13 20:46     ` pmarin
2009-11-13 20:50       ` Venkatesh Srinivas
2009-11-13 20:55       ` Roman Shaposhnik
2009-11-13 21:00       ` Nick LaForge
2009-11-13 21:10         ` pmarin

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