Re: Add exit status to route.8

2023-08-02 Thread A Tammy


On 8/2/23 18:59, Matthew Martin wrote:
> On Wed, Aug 02, 2023 at 06:36:26PM -0400, A Tammy wrote:
>> Not a huge fan of this complicated representation.
>>> +.Ar command
>>> +was invoked but failed with this exit status;
>>> +see its manual page for more information.
>>> +.It 126
>>> +.Ar command
>>> +was found but could not be invoked, or it was invoked but failed
>>> +with exit status 126.
>>> +.It 127
>>> +.Ar command
>>> +could not be found, or it was invoked but failed with exit status 127.
>>> +.El
>> A lot of repetition of ' but failed with exit status
>> 1/126/127' maybe condense them into something like: route exits with the
>> exit status of the invoked command on successful execution or with the
>> following special exit codes - then the 1/126/127 thing.
>>>  .Sh EXAMPLES
>>>  Show the current IPv4 routing tables,
>>>  without attempting to print hostnames symbolically:
> I agree; was just trying to match the existing docs. How is the below?

Looks a lot better,

thanks, committed!

> diff --git route.8 route.8
> index 887446c1420..5a7b0355520 100644
> --- route.8
> +++ route.8
> @@ -281,7 +281,8 @@ and/or a gateway.
>  .Op Fl T Ar rtable
>  .Tg
>  .Cm exec
> -.Op Ar command ...
> +.Ar command
> +.Op Ar arg ...
>  .Xc
>  Execute a command, forcing the process and its children to use the
>  routing table and appropriate routing domain as specified with the
> @@ -514,6 +515,35 @@ host and network name database
>  .It Pa /etc/mygate
>  default gateway address
>  .El
> +.Sh EXIT STATUS
> +For commands other than
> +.Cm exec ,
> +the
> +.Nm
> +utility exits 0 on success, and >0 if an error occurs.
> +.Pp
> +For the
> +.Cm exec
> +command the
> +.Nm
> +utility exits with the exit status of
> +.Ar command
> +if it could be invoked.
> +Otherwise the
> +.Nm
> +utility exits with one of the following values:
> +.Bl -tag -width Ds
> +.It 1
> +An invalid command line option was passed to
> +.Nm
> +or setting the routing table failed.
> +.It 126
> +.Ar command
> +was found but could not be invoked.
> +.It 127
> +.Ar command
> +could not be found.
> +.El
>  .Sh EXAMPLES
>  Show the current IPv4 routing tables,
>  without attempting to print hostnames symbolically:
>



Re: Add exit status to route.8

2023-08-02 Thread Matthew Martin
On Wed, Aug 02, 2023 at 06:36:26PM -0400, A Tammy wrote:
> Not a huge fan of this complicated representation.
> > +.Ar command
> > +was invoked but failed with this exit status;
> > +see its manual page for more information.
> > +.It 126
> > +.Ar command
> > +was found but could not be invoked, or it was invoked but failed
> > +with exit status 126.
> > +.It 127
> > +.Ar command
> > +could not be found, or it was invoked but failed with exit status 127.
> > +.El
> A lot of repetition of ' but failed with exit status
> 1/126/127' maybe condense them into something like: route exits with the
> exit status of the invoked command on successful execution or with the
> following special exit codes - then the 1/126/127 thing.
> >  .Sh EXAMPLES
> >  Show the current IPv4 routing tables,
> >  without attempting to print hostnames symbolically:

I agree; was just trying to match the existing docs. How is the below?

diff --git route.8 route.8
index 887446c1420..5a7b0355520 100644
--- route.8
+++ route.8
@@ -281,7 +281,8 @@ and/or a gateway.
 .Op Fl T Ar rtable
 .Tg
 .Cm exec
-.Op Ar command ...
+.Ar command
+.Op Ar arg ...
 .Xc
 Execute a command, forcing the process and its children to use the
 routing table and appropriate routing domain as specified with the
@@ -514,6 +515,35 @@ host and network name database
 .It Pa /etc/mygate
 default gateway address
 .El
+.Sh EXIT STATUS
+For commands other than
+.Cm exec ,
+the
+.Nm
+utility exits 0 on success, and >0 if an error occurs.
+.Pp
+For the
+.Cm exec
+command the
+.Nm
+utility exits with the exit status of
+.Ar command
+if it could be invoked.
+Otherwise the
+.Nm
+utility exits with one of the following values:
+.Bl -tag -width Ds
+.It 1
+An invalid command line option was passed to
+.Nm
+or setting the routing table failed.
+.It 126
+.Ar command
+was found but could not be invoked.
+.It 127
+.Ar command
+could not be found.
+.El
 .Sh EXAMPLES
 Show the current IPv4 routing tables,
 without attempting to print hostnames symbolically:



Re: Add exit status to route.8

2023-08-02 Thread A Tammy


On 8/2/23 18:23, Matthew Martin wrote:
> A user in IRC asked about route exec's exit status which seems
> a reasonable thing to document.
>
> The text is a combination of .Ex -std and env(1). Also route exec
> requires a command, so fix the .Op markup.
>
>
> diff --git route.8 route.8
> index 887446c1420..ee5bd15fa1a 100644
> --- route.8
> +++ route.8
> @@ -281,7 +281,8 @@ and/or a gateway.
>  .Op Fl T Ar rtable
>  .Tg
>  .Cm exec
> -.Op Ar command ...
> +.Ar command
> +.Op Ar arg ...
>  .Xc
>  Execute a command, forcing the process and its children to use the
>  routing table and appropriate routing domain as specified with the
> @@ -514,6 +515,44 @@ host and network name database
>  .It Pa /etc/mygate
>  default gateway address
>  .El
> +.Sh EXIT STATUS
> +For commands other than
> +.Cm exec ,
> +the
> +.Nm
> +utility exits 0 on success, and >0 if an error occurs.
> +.Pp
> +For the
> +.Cm exec
> +command the
> +.Nm
> +utility exits with one of the following values:
> +.Bl -tag -width Ds
> +.It 0
> +.Nm
> +completed successfully and
> +.Ar command
> +was invoked and completed successfully too.
> +.It 1
> +An invalid command line option was passed to
> +.Nm
> +or setting the routing table failed and
> +.Ar command
> +was not invoked, or
> +.Ar command
> +was invoked but failed with exit status 1.
> +.It 2\(en125, 128\(en255
Not a huge fan of this complicated representation.
> +.Ar command
> +was invoked but failed with this exit status;
> +see its manual page for more information.
> +.It 126
> +.Ar command
> +was found but could not be invoked, or it was invoked but failed
> +with exit status 126.
> +.It 127
> +.Ar command
> +could not be found, or it was invoked but failed with exit status 127.
> +.El
A lot of repetition of ' but failed with exit status
1/126/127' maybe condense them into something like: route exits with the
exit status of the invoked command on successful execution or with the
following special exit codes - then the 1/126/127 thing.
>  .Sh EXAMPLES
>  Show the current IPv4 routing tables,
>  without attempting to print hostnames symbolically:
>