yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
174 stars 27 forks source link

display the output of 'show interface' via the pager #130

Closed stspdotname closed 1 year ago

stspdotname commented 1 year ago

The output of 'show interface' can be very long so use of a pager seems appropriate. Unfortunately, this requires changes across many routines inherited from ifconfig which were hard-coded to write to stdout. This commit changes such prints to write to a temporary file instead, and hopefully I caught them all.

For now, error messages still go to standard output. In some cases the propagation of error return codes is inconsistent and won't allow callers to know whether an error occurred. This should be fixed first. I did consider writing all errors to the temporary file as part of regular output but I am undecided whether this is the best approach. If nsh ever becomes a multi-process program we will likely want errors to appear on a dedicated channel.

smytht commented 1 year ago

Im Ok with this but I would like Chris C to have a look as he brought up the Pager issue and might have more insights than I ...