Re: [patch] exiting bgplgsh with ^D

2017-10-04 Thread Denis Fondras
On Wed, Oct 04, 2017 at 09:04:43PM +0200, Sebastian Benoit wrote:
> I also noticed that the help message does not tell you to use exit to quit
> ;)
> 

I noticed this too but as ^D is a well-known command to exit a shell, I wonder
if it is useful to add exit to the help message. Plus it is not relevant for
bgplg (they share the command list/help message).



Re: [patch] exiting bgplgsh with ^D

2017-10-04 Thread Sebastian Benoit
Jeremie Courreges-Anglas(j...@wxcvbn.org) on 2017.10.04 20:25:26 +0200:
> On Wed, Oct 04 2017, Denis Fondras  wrote:
> > Hi,
> >
> > Here is a patch to make ^D (CTRL-D) escape from bgplgsh instead of 
> > displaying
> > help.
> 
> This makes sense, but I'm wondering if this changes anything when
> actually using bgplg?  Reyk, do you remember if there was a specific
> reason to keep running on EOF?

This is only in the bgplgsh shell. People should not be surprised about
Ctrl-D = quit there. And yes, the diff works.

So ok benno@, but wait a bit for a possible reply from reyk.

I also noticed that the help message does not tell you to use exit to quit
;)

> 
> > Denis
> >
> > Index: bgplgsh.c
> > ===
> > RCS file: /cvs/src/usr.bin/bgplg/bgplgsh.c,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 bgplgsh.c
> > --- bgplgsh.c   9 Dec 2015 17:52:24 -   1.8
> > +++ bgplgsh.c   4 Oct 2017 13:12:02 -
> > @@ -229,8 +229,8 @@ main(void)
> >  
> > if ((line = readline(prompt)) == NULL) {
> > printf("\n");
> > -   lg_help(cmds, NULL);
> > -   continue;
> > +   quit = 1;
> > +   goto next;
> > }
> > if (!lg_strip(line))
> > goto next;
> >
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 



Re: [patch] exiting bgplgsh with ^D

2017-10-04 Thread Jeremie Courreges-Anglas
On Wed, Oct 04 2017, Denis Fondras  wrote:
> Hi,
>
> Here is a patch to make ^D (CTRL-D) escape from bgplgsh instead of displaying
> help.

This makes sense, but I'm wondering if this changes anything when
actually using bgplg?  Reyk, do you remember if there was a specific
reason to keep running on EOF?

> Denis
>
> Index: bgplgsh.c
> ===
> RCS file: /cvs/src/usr.bin/bgplg/bgplgsh.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 bgplgsh.c
> --- bgplgsh.c 9 Dec 2015 17:52:24 -   1.8
> +++ bgplgsh.c 4 Oct 2017 13:12:02 -
> @@ -229,8 +229,8 @@ main(void)
>  
>   if ((line = readline(prompt)) == NULL) {
>   printf("\n");
> - lg_help(cmds, NULL);
> - continue;
> + quit = 1;
> + goto next;
>   }
>   if (!lg_strip(line))
>   goto next;
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



[patch] exiting bgplgsh with ^D

2017-10-04 Thread Denis Fondras
Hi,

Here is a patch to make ^D (CTRL-D) escape from bgplgsh instead of displaying
help.

Denis

Index: bgplgsh.c
===
RCS file: /cvs/src/usr.bin/bgplg/bgplgsh.c,v
retrieving revision 1.8
diff -u -p -r1.8 bgplgsh.c
--- bgplgsh.c   9 Dec 2015 17:52:24 -   1.8
+++ bgplgsh.c   4 Oct 2017 13:12:02 -
@@ -229,8 +229,8 @@ main(void)
 
if ((line = readline(prompt)) == NULL) {
printf("\n");
-   lg_help(cmds, NULL);
-   continue;
+   quit = 1;
+   goto next;
}
if (!lg_strip(line))
goto next;