Commit Graph

8 Commits

Author SHA1 Message Date
Stefan Eßer
56d11d4a37 Make use of the getlocalbase() function for run-time adjustment of the
local software base directory, as committed in SVN rev. 367813.

The pkg and mailwrapper programs used the LOCALBASE environment variable
for this purpose and this functionality is preserved by getlocalbase().

After this change, the value of the user.localbase sysctl variable is used
if present (and not overridden in the environment).

The nvmecontrol program gains support of a dynamic path to its plugin
directory with this update.

Differential Revision:	https://reviews.freebsd.org/D27237
2020-11-18 20:00:55 +00:00
Scott Long
8e1031086d Revert the whole getlocalbase() set of changes while a different design is
hashed out.
2020-11-15 20:24:59 +00:00
Scott Long
7ca0d5403e Replace hardcoded references to _PATH_LOCALBASE with calls to getlocalbase.3
Reviewed by:	imp, se
2020-11-14 18:01:14 +00:00
Alexander Motin
5dc463f9a5 Improve nvmecontrol error reporting.
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-11-13 02:05:45 +00:00
Warner Losh
21fae2d64f Assume all the short args have optional args so allocate space for the
':'. It's slightly wasteful, but much easier (and the savings in bytes
at runtime would be tiny, but the code to do it larger).

Submitted by: Sebastian Huber
2019-09-11 13:34:19 +00:00
Alexander Motin
628d03169e Fix usage printing for nested subcommands.
Instead of `nvmecontrol create` should be `nvmecontrol ns create`, etc.

MFC after:	2 weeks
2019-07-31 03:48:48 +00:00
Warner Losh
ae5f2ca7b9 Fix several related coverity issues:
Make sure to always free shortopts and lopts when returning.
Fix minor logic bug to guard against NULLs properly.

CID: 1403654, 1403656, 1403658
2019-07-24 23:04:26 +00:00
Warner Losh
f634b4c1be Create generic command / arg parsing routines
Create a set of routines and structures to hold the data for the args
for a command. Use them to generate help and to parse args. Convert
all the current commands over to the new format. "comnd" is a hat-tip
to the TOPS-20 %COMND JSYS that (very) loosely inspired much of the
subsequent command line notions in the industry, but this is far
simpler (the %COMND man page is longer than this code) and not in the
kernel... Also, it implements today's de-facto
	command [verb]+ [opts]* [args]*
format rather than the old, archaic TOPS-20 command format :)

This is a snapshot of a work in progress to get the nvme passthru
stuff committed. In time it will become a private library and used
by some other programs in the tree that conform to the above pattern.

Differential Revision: https://reviews.freebsd.org/D19296
2019-07-16 17:24:03 +00:00