Index: head/lib/libdpv/dpv.3 =================================================================== --- head/lib/libdpv/dpv.3 (revision 330938) +++ head/lib/libdpv/dpv.3 (revision 330939) @@ -1,531 +1,531 @@ .\" Copyright (c) 2013-2016 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd Mar 13, 2018 +.Dd March 13, 2018 .Dt DPV 3 .Os .Sh NAME .Nm dpv .Nd dialog progress view library .Sh LIBRARY .Lb libdpv .Sh SYNOPSIS .In dpv.h .Ft int .Fo dpv .Fa "struct dpv_config *config" .Fa "struct dpv_file_node *file_list" .Fc .Ft void .Fo dpv_free .Fa "void" .Fc .Sh DESCRIPTION The .Nm library provides an interface for creating complex .Dq gauge widgets for displaying progress on various actions. The .Nm library can display progress with one of .Xr dialog 3 , .Xr dialog 1 , or .Xr Xdialog 1 .Pq x11/xdialog from the ports tree . .Pp The .Fn dpv .Fa config argument properties for configuring global display features: .Bd -literal -offset indent struct dpv_config { uint8_t keep_tite; /* Cleaner exit for scripts */ enum dpv_display display_type; /* Def. DPV_DISPLAY_LIBDIALOG */ enum dpv_output output_type; /* Default DPV_OUTPUT_NONE */ int debug; /* Enable debug on stderr */ int display_limit; /* Files/page. Default -1 */ int label_size; /* Label size. Default 28 */ int pbar_size; /* Mini-progress size */ int dialog_updates_per_second; /* Default 16 */ int status_updates_per_second; /* Default 2 */ uint16_t options; /* Default 0 (none) */ char *title; /* Widget title */ char *backtitle; /* Widget backtitle */ char *aprompt; /* Append. Default NULL */ char *pprompt; /* Prefix. Default NULL */ char *msg_done; /* Default `Done' */ char *msg_fail; /* Default `Fail' */ char *msg_pending; /* Default `Pending' */ char *output; /* Output format string */ const char *status_solo; /* dialog(3) solo-status format. * Default DPV_STATUS_SOLO */ const char *status_many; /* dialog(3) many-status format. * Default DPV_STATUS_MANY */ /* * Function pointer; action to perform data transfer */ int (*action)(struct dpv_file_node *file, int out); }; enum dpv_display { DPV_DISPLAY_LIBDIALOG = 0, /* Use dialog(3) (default) */ DPV_DISPLAY_STDOUT, /* Use stdout */ DPV_DISPLAY_DIALOG, /* Use spawned dialog(1) */ DPV_DISPLAY_XDIALOG, /* Use spawned Xdialog(1) */ }; enum dpv_output { DPV_OUTPUT_NONE = 0, /* No output (default) */ DPV_OUTPUT_FILE, /* Read `output' member as file path */ DPV_OUTPUT_SHELL, /* Read `output' member as shell cmd */ }; .Ed .Pp The .Va options member of the .Fn dpv .Fa config argument is a mask of bit fields indicating various processing options. Possible flags are: .Bl -tag -width DPV_NO_OVERRUN .It Dv DPV_TEST_MODE Enable test mode. In test mode, the .Fn action callback of the .Fa config argument is not called but instead simulated-data is used to drive progress. Appends .Dq [TEST MODE] to the status line .Po to override, set the .Va status_format member of the .Fn dpv .Fa config argument; for example, to .Dv DPV_STATUS_DEFAULT .Pc . .It Dv DPV_WIDE_MODE Enable wide mode. In wide mode, the length of the .Va aprompt and .Va pprompt members of the .Fn dpv .Fa config argument will bump the width of the gauge widget. Prompts wider than the maximum width will wrap .Po unless using .Xr Xdialog 1 ; see BUGS section below .Pc . .It Dv DPV_NO_LABELS Disables the display of labels associated with each transfer .Po .Va label_size member of .Fn dpv .Fa config argument is ignored .Pc . .It Dv DPV_USE_COLOR Force the use of color even if the .Va display_type does not support color .Po .Ev USE_COLOR environment variable is ignored .Pc . .It Dv DPV_NO_OVERRUN When enabled, callbacks for the current .Vt dpv_file_node are terminated when .Fn action returns 100 or greater .Po alleviates the need to change the .Va status of the current .Vt dpv_file_node but may also cause file truncation if the stream exceeds expected length .Pc . .El .Pp The .Fa file_list argument to .Fn dpv is a pointer to a .Dq linked-list , described in .In dpv.h : .Bd -literal -offset indent struct dpv_file_node { enum dpv_status status; /* status of read operation */ char *msg; /* display instead of "Done/Fail" */ char *name; /* name of file to read */ char *path; /* path to file */ long long length; /* expected size */ long long read; /* number units read (e.g., bytes) */ struct dpv_file_node *next;/* pointer to next (end with NULL) */ }; .Ed .Pp For each of the items in the .Fa file_list .Dq linked-list argument, the .Fn action callback member of the .Fn dpv .Fa config argument is called. The .Fn action function performs a .Dq nominal action on the file and return. The return value of .Vt int represents the current progress percentage .Pq 0-100 for the current file. .Pp The .Fn action callback provides two variables for each call. .Fa file provides a reference to the current .Vt dpv_file_node being processed. .Fa out provides a file descriptor where the data goes. .Pp If the .Va output member of the .Fn dpv .Fa config argument was set to DPV_OUTPUT_NONE .Pq default ; when invoking Fn dpv , the .Fa out file descriptor of .Fn action will be zero and can be ignored. If .Fa output was set to DPV_OUTPUT_FILE, .Fa out will be an open file descriptor to a file. If .Fa output was set to DPV_OUTPUT_SHELL, .Fa out will be an open file descriptor to a pipe for a spawned shell program. When .Fa out is greater than zero, write data that has been read back to .Fa out . .Pp To abort .Fn dpv , either from the .Fn action callback or asynchronously from a signal handler, two globals are provided via .In dpv.h : .Bd -literal -offset indent extern int dpv_interrupt; /* Set to TRUE in interrupt handler */ extern int dpv_abort; /* Set to true in callback to abort */ .Ed .Pp These globals are not automatically reset and must be manually maintained. Do not forget to reset these globals before subsequent invocations of .Fn dpv when making multiple calls from the same program. .Pp In addition, the .Va status member of the .Fn action .Fa file argument can be used to control callbacks for the current file. The .Va status member can be set to any of the below from .In dpv.h : .Bd -literal -offset indent enum dpv_status { DPV_STATUS_RUNNING = 0, /* Running (default) */ DPV_STATUS_DONE, /* Completed */ DPV_STATUS_FAILED, /* Oops, something went wrong */ }; .Ed .Pp The default .Fa status is zero, DPV_STATUS_RUNNING, which keeps the callbacks coming for the current .Fn file . Setting .Ql file->status to anything other than DPV_STATUS_RUNNING will cause .Fn dpv to loop to the next file, effecting the next callback, if any. .Pp The .Fn action callback is responsible for calculating percentages and .Pq recommended maintaining a .Nm global counter so .Fn dpv can display throughput statistics. Percentages are reported through the .Vt int return value of the .Fn action callback. Throughput statistics are calculated from the below global .Vt int in .In dpv.h : .Bd -literal -offset indent extern int dpv_overall_read; .Ed .Pp Set this to the number of bytes that have been read for all files. Throughput information is displayed in the status line .Pq only available when using Xr dialog 3 at the bottom of the screen. See DPV_DISPLAY_LIBDIALOG above. .Pp Note that .Va dpv_overall_read does not have to represent bytes. For example, the .Va status_format can be changed to display something other than .Dq Li bytes and increment .Va dpv_overall_read accordingly .Pq for example, counting lines . .Pp When .Fn dpv is processing the current file, the .Va length and .Va read members of the .Fn action .Fa file argument are used for calculating the display of mini progress bars .Po if enabled; see .Va pbar_size above .Pc . If the .Va length member of the current .Fa file is less than zero .Pq indicating an unknown file length , a .Xr humanize_number 3 version of the .Va read member is used instead of a traditional progress bar. Otherwise a progress bar is calculated as percentage read to file length. .Fn action callback must maintain these member values for mini-progress bars. .Pp The .Fn dpv_free function performs .Xr free 3 on private global variables initialized by .Fn dpv . .Sh ENVIRONMENT The below environment variables are referenced by .Nm : .Bl -tag -width ".Ev USE_COLOR" .It Ev DIALOG Override command string used to launch .Xr dialog 1 .Pq requires Dv DPV_DISPLAY_DIALOG or .Xr Xdialog 1 .Pq requires Dv DPV_DISPLAY_XDIALOG ; default is either .Ql dialog .Pq for Dv DPV_DISPLAY_DIALOG or .Ql Xdialog .Pq for Dv DPV_DISPLAY_XDIALOG . .It Ev DIALOGRC If set and non-NULL, path to .Ql .dialogrc file. .It Ev HOME If .Ql Ev $DIALOGRC is either not set or NULL, used as a prefix to .Ql .dialogrc .Pq that is, Ql $HOME/.dialogrc . .It Ev USE_COLOR If set and NULL, disables the use of color when using .Xr dialog 1 .Pq does not apply to Xr Xdialog 1 . .It Ev msg_done Ev msg_fail Ev msg_pending Internationalization strings for overriding the default English strings .Ql Done , .Ql Fail , and .Ql Pending respectively. To prevent their usage, explicitly set the .Va msg_done , .Va msg_fail , and .Va msg_pending members of .Fn dpv .Fa config argument to default macros .Pq DPV_DONE_DEFAULT, DPV_FAIL_DEFAULT, and DPV_PENDING_DEFAULT or desired values. .El .Sh FILES .Bl -tag -width ".Pa $HOME/.dialogrc" -compact .It Pa $HOME/.dialogrc .El .Sh SEE ALSO .Xr dialog 1 , .Xr Xdialog 1 , .Xr dialog 3 .Sh HISTORY The .Nm library first appeared in .Fx 10.2 . .Sh AUTHORS .An Devin Teske Aq dteske@FreeBSD.org .Sh BUGS .Xr Xdialog 1 , when given both .Ql Fl -title Ar title .Po see above .Ql Va title member of .Va struct dpv_config .Pc and .Ql Fl -backtitle Ar backtitle .Po see above .Ql Va backtitle member of .Va struct dpv_config .Pc , displays the backtitle in place of the title and vice-versa. .Pp .Xr Xdialog 1 does not wrap long prompt texts received after initial launch. This is a known issue with the .Ql --gauge widget in .Xr Xdialog 1 . Embed escaped newlines within prompt text to force line breaks. .Pp .Xr dialog 1 does not display the first character after a series of escaped escape-sequences (for example, ``\\\\n'' produces ``\\'' instead of ``\\n''). This is a known issue with .Xr dialog 1 and does not affect .Xr dialog 3 or .Xr Xdialog 1 . .Pp If an application ignores .Ev USE_COLOR when set and NULL before calling .Fn dpv with color escape sequences anyway, .Xr dialog 3 and .Xr dialog 1 may not render properly. Workaround is to detect when .Ev USE_COLOR is set and NULL and either not use color escape sequences at that time or use .Xr unsetenv 3 to unset .Ev USE_COLOR , forcing interpretation of color sequences. This does not effect .Xr Xdialog 1 , which renders the color escape sequences as plain text. See .Do embedded "\\Z" sequences .Dc in .Xr dialog 1 for additional information. Index: head/lib/libfigpar/figpar.3 =================================================================== --- head/lib/libfigpar/figpar.3 (revision 330938) +++ head/lib/libfigpar/figpar.3 (revision 330939) @@ -1,265 +1,265 @@ .\" Copyright (c) 2013-2015 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd Mar 13, 2018 +.Dd March 13, 2018 .Dt FIGPAR 3 .Os .Sh NAME .Nm figpar , .Nm parse_config , .Nm get_config_option .Nd configuration file parsing library .Sh LIBRARY .Lb libfigpar .Sh SYNOPSIS .In figpar.h .Ft int .Fo parse_config .Fa "struct figpar_config options[]" .Fa "const char *path" .Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option" .Fa "uint32_t line" .Fa "char *directive" .Fa "char *value\*[rp]" .Fa "uint8_t processing_options" .Fc .Ft "struct figpar_config *" .Fo get_config_option .Fa "struct figpar_config options[]" .Fa "const char *directive" .Fc .In string_m.h .Ft int .Fo replaceall .Fa "char *source" .Fa "const char *find" .Fa "const char *replace" .Fc .Ft unsigned int .Fo strcount .Fa "const char *source" .Fa "const char *find" .Fc .Ft void .Fo strexpand .Fa "char *source" .Fc .Ft void .Fo strexpandnl .Fa "char *source" .Fc .Ft void .Fo strtolower .Fa "char *source" .Fc .Sh DESCRIPTION The .Nm library provides a light-weight, portable framework for parsing configuration files. The library uses .Xr open 2 , .Xr read 2 , and .Xr lseek 2 within the file pointed to by .Fa path to find directives and values which are then made available to the application. .Pp Due to the fact that configuration files may have basic syntax differences, the library does not attempt to impose any structure on the data but instead provides raw data to a set of callback functions. These callback functions can in-turn initiate abort through their return value, allowing custom syntax validation during parsing. .Pp Configuration directives, types, and callback functions are provided through data structures defined in .In figpar.h : .Bd -literal -offset indent struct figpar_config { enum figpar_cfgtype type; /* value type */ const char *directive; /* keyword */ union figpar_cfgvalue value; /* value */ /* Pointer to function used when directive is found */ int (*action)(struct figpar_config *option, uint32_t line, char *directive, char *value); }; enum figpar_cfgtype { FIGPAR_TYPE_NONE = 0x0000, /* directives with no value */ FIGPAR_TYPE_BOOL = 0x0001, /* boolean */ FIGPAR_TYPE_INT = 0x0002, /* signed 32 bit integer */ FIGPAR_TYPE_UINT = 0x0004, /* unsigned 32 bit integer */ FIGPAR_TYPE_STR = 0x0008, /* string pointer */ FIGPAR_TYPE_STRARRAY = 0x0010, /* string array pointer */ FIGPAR_TYPE_DATA1 = 0x0020, /* void data type-1 (open) */ FIGPAR_TYPE_DATA2 = 0x0040, /* void data type-2 (open) */ FIGPAR_TYPE_DATA3 = 0x0080, /* void data type-3 (open) */ FIGPAR_TYPE_RESERVED1 = 0x0100, /* reserved data type-1 */ FIGPAR_TYPE_RESERVED2 = 0x0200, /* reserved data type-2 */ FIGPAR_TYPE_RESERVED3 = 0x0400, /* reserved data type-3 */ }; union figpar_cfgvalue { void *data; /* Pointer to NUL-terminated string */ char *str; /* Pointer to NUL-terminated string */ char **strarray; /* Pointer to an array of strings */ int32_t num; /* Signed 32-bit integer value */ uint32_t u_num; /* Unsigned 32-bit integer value */ uint32_t boolean:1; /* Boolean integer value (0 or 1) */ }; .Ed .Pp The .Fa processing_options argument to .Fn parse_config is a mask of bit fields which indicate various processing options. The possible flags are: .Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON .It Dv FIGPAR_BREAK_ON_EQUALS An equals sign .Pq Ql Li = is normally considered part of the directive. This flag enables terminating the directive at the equals sign. Also makes equals sign optional and transient. .It Dv FIGPAR_BREAK_ON_SEMICOLON A semicolon .Pq Ql Li \; is normally considered part of the value. This flag enables terminating the value at the semicolon. Also allows multiple statements on a single line separated by semicolon. .It Dv FIGPAR_CASE_SENSITIVE Normally directives are matched case insensitively using .Xr fnmatch 3 . This flag enables directive matching to be case sensitive. .It Dv FIGPAR_REQUIRE_EQUALS If a directive is not followed by an equals, processing is aborted. .It Dv FIGPAR_STRICT_EQUALS Equals must be part of the directive to be considered a delimiter between directive and value. .El .Pp The .Fa options struct array pointer can be NULL and every directive will run the .Fn unknown function argument. .Pp The directive for each figpar_config item in the .Fn parse_config options argument is matched against each parsed directive using .Xr fnmatch 3 until a match is found. If a match is found, the .Fn action function for that figpar_config directive is run with the line number, directive, and value. Otherwise if no match, the .Fn unknown function is run .Pq with the same arguments . .Pp If either .Fa action or .Fa unknown return non-zero, .Fn parse_config aborts reading the file and returns the error value to its caller. .Pp .Fn get_config_option traverses the options-array and returns the option that matches via .Xr strcmp 3 , or if no match a pointer to a static dummy struct is returned .Pq whose values are all zero or NULL . .Pp The use of .Fa "struct figpar_config" is entirely optional as-is the use of .Fa "enum figpar_cfgtype" or .Fa "union figpar_cfgvalue" . For example, a NULL pointer can be passed to .Fn parse_config for the first argument while providing a simple .Fa unknown function based on .Xr queue 3 that populates a singly-linked list of a struct containing the .Fa directive and .Fa value . .Pp In addition, miscellaneous string manipulation routines are provided by .In string_m.h : .Bl -tag -width strexpandnl() .It Fn replaceall Replace all occurrences of .Fa find in .Fa source with .Fa replace . .It Fn strcount Count the number of occurrences of one string that appear in the .Fa source string. Return value is the total count. An example use would be to show how large a block of memory needs to be for a .Fn replaceall series. .It Fn strexpand Expand escape sequences in a buffer pointed to by .Fa source . .It Fn strexpandnl Expand only the escaped newlines in a buffer pointed to by .Fa source . .It Fn strtolower Convert a string to lower case. .El .Sh SEE ALSO .Xr queue 3 .Sh HISTORY The .Nm library first appeared in .Fx 10.2 . .Sh AUTHORS .An Devin Teske Aq dteske@FreeBSD.org .Sh BUGS This is the first implementation of the library, and the interface may be subject to refinement. Index: head/usr.bin/dpv/dpv.1 =================================================================== --- head/usr.bin/dpv/dpv.1 (revision 330938) +++ head/usr.bin/dpv/dpv.1 (revision 330939) @@ -1,433 +1,433 @@ .\" Copyright (c) 2013-2016 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd Jan 26, 2016 +.Dd January 26, 2016 .Dt DPV 1 .Os .Sh NAME .Nm dpv .Nd stream data from stdin or multiple paths with dialog progress view .Sh SYNOPSIS .Nm .Op options .Ar [bytes:]label .Nm .Op options .Fl m .Ar [bytes1:]label1 .Ar path1 .Op Ar [bytes2:]label2 path2 ... .Sh DESCRIPTION .Nm provides a dialog progress view, allowing a user to see current throughput rate and total data transferred for one or more streams. .Pp The .Nm utility has two main modes for processing input. .Pp The default input mode, without .Ql Fl m , .Nm reads bytes from standard input. A label for the data must be provided. .Pp The secondary input mode, with .Ql Fl m , .Nm reads multiple paths .Pq up to 2047 or Dq ARG_MAX/2-1 , sequentially. .Pp Data read in either mode is either thrown away .Pq default , sent to a spawned instance of the program specified via .Ql Fl x Ar cmd , or sent to a unique file specified by .Ql Fl o Ar file . .Pp With or without .Ql Fl m , progress is displayed using one of .Xr dialog 3 .Pq default , .Xr dialog 1 .Pq see Ql Fl D , or instead .Xr Xdialog 1 .Pq see Ql Fl X . .Pp The following options are available: .Bl -tag -width ".Fl b Ar backtitle" .It Fl a Ar text Display .Ar text below the file progress indicator(s). .It Fl b Ar backtitle Display .Ar backtitle on the backdrop, at top-left, behind the dialog widget. When using .Xr Xdialog 1 , this is displayed inside the window .Pq at the top followed by a separator line. .It Fl d Debug mode. Print dialog prompt data to standard out and provide additional debugging on standard error. .It Fl D Do not use the default interface of .Xr dialog 3 , but instead spawn an instance of .Xr dialog 1 . The path to .Xr dialog 1 is taken from the .Ev DIALOG environment variable or simply .Dq Li dialog if unset or NULL. .It Fl h Produce a short syntax usage with brief option descriptions and exit. Output is produced on standard error. .It Fl i Ar format Customize the single-file format string used to update the status line. Ignored when using either .Ql Fl D or .Ql Fl X which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is .Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . This format is used when handling one file. .It Fl I Ar format Customize the multi-file format string used to update the status line. Ignored when using either .Ql Fl D or .Ql Fl X which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is .Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . This format is used when handling more than one file. .It Fl k Keep tite. Prevent visually distracting initialization/exit routines for scripts running .Xr dialog 1 several times. .It Fl l Line mode. Read lines from input instead of bytes. .It Fl L Ar size Label size. If negative, shrink to longest label width. .It Fl m Multi-input mode. Instead of reading bytes from standard input, read from a set of paths .Pq one for each label . By default, each path is processed sequentially in the order given. .It Fl n Ar num Display at-most .Ar num progress indicators per screen. If zero, display as many as possible. If negative, only display the main progress indicator. Default is 0. Maximum value is 10. .It Fl N No overrun. If enabled, stop reading known-length inputs when input reaches stated length. .It Fl o Ar file Output data to .Ar file . The first occurrence of .Ql %s .Pq if any in .Ql Ar file will be replaced with the .Ar label text. .It Fl p Ar text Display .Ar text above the file progress indicator(s). .It Fl P Ar size Mini-progressbar size. If negative, don't display mini-progressbars .Pq only the large overall progress indicator is shown . If zero, auto-adjust based on number of files to read. When zero and only one file to read, defaults to -1. When zero and more than one file to read, defaults to 17. .It Fl t Ar title Display .Ar title atop the dialog box. Note that if you use this option at the same time as .Ql Fl X and .Ql Fl b Ar backtitle , the .Ar backtitle and .Ar title are effectively switched .Pq see BUGS section below . .It Fl T Test mode. Simulate reading a number of bytes, divided evenly across the number of files, while stepping through each percent value of each file to process. Appends .Dq Li [TEST MODE] to the status line .Pq to override, use Ql Fl u Ar format . No data is actually read. .It Fl U Ar num Update status line .Ar num times per-second. Default value is .Ql Li 2 . A value of .Ql Li 0 disables status line updates. If negative, update the status line as fast as possible. Ignored when using either .Ql Fl D or .Ql Fl X which lack the ability to display the status line .Pq containing bytes/rate/thread information . .It Fl w Wide mode. Allows long .Ar text arguments used with .Ql Fl p and .Ql Fl a to bump the dialog width. Prompts wider than the maximum width will wrap .Pq unless using Xr Xdialog 1 ; see BUGS section below . .It Fl x Ar cmd Execute .Ar cmd .Pq via Xr sh 1 and send it data that has been read. Data is available to .Ar cmd on standard input. With .Ql Fl m , .Ar cmd is executed once for each .Ar path argument. The first occurrence of .Ql %s .Pq if any in .Ql Ar cmd will be replaced with the .Ar label text. .It Fl X Enable X11 mode by using .Xr Xdialog 1 instead of .Xr dialog 1 or .Xr dialog 3 . .El .Sh ENVIRONMENT The following environment variables are referenced by .Nm : .Bl -tag -width ".Ev USE_COLOR" .It Ev DIALOG Override command string used to launch .Xr dialog 1 .Pq requires Ql Fl D or .Xr Xdialog 1 .Pq requires Ql Fl X ; default is either .Ql dialog .Pq for Ql Fl D or .Ql Xdialog .Pq for Ql Fl X . .It Ev DIALOGRC If set and non-NULL, path to .Ql .dialogrc file. .It Ev HOME If .Ql Ev $DIALOGRC is either not set or NULL, used as a prefix to .Ql .dialogrc .Pq i.e., Ql $HOME/.dialogrc . .It Ev USE_COLOR If set and NULL, disables the use of color when using .Xr dialog 1 .Pq does not apply to Xr Xdialog 1 . .El .Sh DEPENDENCIES If using .Ql Fl D , .Xr dialog 1 is required. .Pp If using .Ql Fl X , .Xr Xdialog 1 is required. .Sh FILES .Bl -tag -width ".Pa $HOME/.dialogrc" -compact .It Pa $HOME/.dialogrc .El .Sh EXAMPLES Simple example to show how fast .Xr yes 1 produces lines .Pq usually about ten-million per-second; your results may vary : .Bd -literal -offset indent yes | dpv -l yes .Ed .Pp Display progress while timing how long it takes .Xr yes 1 to produce a half-billion lines .Pq usually under one minute; your results may vary : .Bd -literal -offset indent time yes | dpv -Nl 500000000:yes .Ed .Pp An example to watch how quickly a file is transferred using .Xr nc 1 : .Bd -literal -offset indent dpv -x "nc -w 1 somewhere.com 3000" -m label file .Ed .Pp A similar example, transferring a file from another process and passing the expected size to .Nm : .Bd -literal -offset indent cat file | dpv -x "nc -w 1 somewhere.com 3000" 12345:label .Ed .Pp A more complicated example: .Bd -literal -offset indent tar cf - . | dpv -x "gzip -9 > out.tgz" \\ $( du -s . | awk '{print $1 * 1024}' ):label .Ed .Pp Taking an image of a disk: .Bd -literal -offset indent dpv -o disk-image.img -m label /dev/ada0 .Ed .Pp Writing an image back to a disk: .Bd -literal -offset indent dpv -o /dev/ada0 -m label disk-image.img .Ed .Pp Zeroing a disk: .Bd -literal -offset indent dpv -o /dev/md42 < /dev/zero .Ed .Sh SEE ALSO .Xr dialog 1 , .Xr sh 1 , .Xr Xdialog 1 , .Xr dialog 3 .Sh HISTORY A .Nm utility first appeared in .Fx 10.2 . .Sh AUTHORS .An Devin Teske Aq dteske@FreeBSD.org .Sh BUGS .Xr Xdialog 1 , when given both .Ql Fl -title Ar title .Pq see above Ql Fl t Ar title and .Ql Fl -backtitle Ar backtitle .Pq see above Ql Fl b Ar backtitle , displays the backtitle in place of the title and vice-versa. .Pp .Xr Xdialog 1 does not wrap long prompt texts received after initial launch. This is a known issue with the .Ql --gauge widget in .Xr Xdialog 1 . .Pp .Xr dialog 1 does not display the first character after a series of escaped escape-sequences (e.g., ``\\\\n'' produces ``\\'' instead of ``\\n''). This is a known issue with .Xr dialog 1 and does not affect .Xr dialog 3 or .Xr Xdialog 1 . .Pp If your application ignores .Ev USE_COLOR when set and NULL before calling .Xr dpv 1 with color escape sequences anyway, .Xr dialog 3 and .Xr dialog 1 may not render properly. Workaround is to detect when .Ev USE_COLOR is set and NULL and either not use color escape sequences at that time or use .Xr unset 1 .Xr [ sh 1 ] or .Xr unsetenv 1 .Xr [ csh 1 ] to unset .Ev USE_COLOR , forcing interpretation of color sequences. This does not effect .Xr Xdialog 1 , which renders the color escape sequences as plain text. See .Do embedded "\\Z" sequences .Dc in .Xr dialog 1 for additional information. Index: head/usr.sbin/bsdconfig/bsdconfig.8 =================================================================== --- head/usr.sbin/bsdconfig/bsdconfig.8 (revision 330938) +++ head/usr.sbin/bsdconfig/bsdconfig.8 (revision 330939) @@ -1,254 +1,254 @@ .\" Copyright (c) 2012 Ron McDowell .\" Copyright (c) 2012-2013 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd Jun 5, 2013 +.Dd June 5, 2013 .Dt BSDCONFIG 8 .Os .Sh NAME .Nm bsdconfig .Nd system configuration utility .Sh SYNOPSIS .Nm .Op Fl h .Nm .Ar command .Op Fl h .Nm .Op OPTIONS .Op command Op OPTIONS .Sh DESCRIPTION .Nm is used to set up many system configuration settings, both for new systems, as well as changing configuration settings of existing systems. .Pp .Nm optionally takes a command as an argument. If invoked with no arguments, it will bring up an interactive menu listing the available modules. .Pp The following options are available: .Bl -tag -width indent+ .It Fl d Provide lots of debugging info on standard-out when running. .It Fl D Ar file Send debugging info to file. If file begins with a plus-sign debug info is sent to both standard-out and file (minus the leading plus). .It Fl f Ar file Load .Ar file as script and then exit. If multiple occurrences, program will only exit after last occurrence. If .Ar file is a single dash .Pq Sq Fl , .Nm reads from standard input. .It Fl h Print usage statement and exit. .It Fl S Secure X11 mode .Pq implies Fl X . As root, always prompt-for and validate .Xr sudo 8 username/password before starting. .It Fl X Use .Xr Xdialog 1 in place of .Xr dialog 1 . .El .Sh COMMANDS The following commands .Pq sorted alphabetically are currently included in the base .Nm program, with more to be added soon. Other commands can be added, as detailed below in the .Cm ADDING COMMANDS section, and once added, will appear in the master menu as well as in the .Cm -h listing. .Bl -tag -width ".Cm syscons_screenmap" .It Cm console Utilities to customize the behavior of the system console. .It Cm defaultrouter Shortcut to the Default Router/Gateway menu under networking. .It Cm diskmgmt Manage disk partitions and/or labels. Executes .Xr sade 8 . .It Cm docsinstall Executes the .Cm bsdinstall docsinstall sub-utility to allow installation/re-installation of the FreeBSD Documentation set(s). .It Cm dot Generate a graphviz .Xr dot 1 language file .Pq printed on stdout visualizing the .Nm menu, include, and shortcut structure relationships. See .Dq bsdconfig dot -h for more details. .It Cm groupadd Shortcut to the Add Groups menu under groupmgmt. .It Cm groupdel Shortcut to the Delete Groups menu under groupmgmt. .It Cm groupedit Shortcut to the Edit/View Groups menu under groupmgmt. .It Cm groupmgmt Utilities to Add/Change/View/Delete Group Accounts. .It Cm hostname Shortcut to the Hostname/Domain menu under networking. .It Cm kern_securelevel Shortcut to the kern.securelevel menu under security. .It Cm mouse Utilities for configuring, exploring, and enabling console mouse support. .It Cm mouse_disable Shortcut to the Disable menu under mouse. .It Cm mouse_enable Shortcut to the Enable menu under mouse. .It Cm mouse_flags Shortcut to the Flags menu under mouse. .It Cm mouse_port Shortcut to the Port menu under mouse. .It Cm mouse_type Shortcut to the Type menu under mouse. .It Cm nameservers Shortcut to the DNS Nameservers menu under networking. .It Cm netdev Shortcut to the Network Interfaces menu under networking. .It Cm networking Utilities to set/change Hostname/Domain, Network Interfaces, Default Router/Gateway, and DNS Nameservers. .It Cm packages Browse, install, uninstall, or re-install packaged software. .It Cm password Set the system administrator .Pq root password. .It Cm security Configure various system security settings. .It Cm startup Configure various aspects of system startup. .It Cm startup_misc Shortcut to the Miscellaneous Startup Services menu under startup. .It Cm startup_rcadd Shortcut to the Add New menu under the View/Edit Startup Configuration menu (startup_rcconf) of startup. .It Cm startup_rcconf Shortcut to the View/Edit Startup Configuration menu under startup. .It Cm startup_rcdelete Shortcut to the Delete menu under the View/Edit Startup Configuration menu (startup_rcconf) of startup. .It Cm startup_rcvar Shortcut to the Toggle Startup Services menu under startup. .\" use neutral name, e.g. console_keymap instead of syscons_keymap? .\" font (encoding) selection not applicable to vt(4)! .It Cm syscons_font Shortcut to the Font menu under console. .\" .It Cm console_keymap .\" Shortcut to the Keymap menu under console. .It Cm syscons_keymap Shortcut to the Keymap menu under console. .\" .It Cm vt_repeat .\" Shortcut to the Repeat menu under console. .It Cm syscons_repeat Shortcut to the Repeat menu under console. .\" .It Cm vt_saver .\" Shortcut to the Saver menu under console. .It Cm syscons_saver Shortcut to the Saver menu under console. .\" screenmap (encoding) selection not applicable to vt(4)! .It Cm syscons_screenmap Shortcut to the Screenmap menu under console. .\" .It Cm vt_syscons_ttys .\" Shortcut to the Ttys menu under console. .It Cm syscons_ttys Shortcut to the Ttys menu under console. .It Cm timezone Set the regional timezone of the local machine. .It Cm ttys Edit the .Xr ttys 5 database with your favorite editor. .It Cm useradd Shortcut to the Add Users menu under usermgmt. .It Cm userdel Shortcut to the Delete Users menu under usermgmt. .It Cm useredit Shortcut to the Edit/View Users menu under usermgmt. .It Cm usermgmt Utilities to Add/Edit/View/Delete User Accounts. .El .Sh INTERNATIONALIZATION i18n features are built into .Nm and language-specific translation files will be added as they become available. In the absence of language-specific translation files, the default .Pq en_US.ISO8859-1 files will be used. .Sh ADDING COMMANDS To be documented later. Document menu_selection="command|*" syntax of INDEX files. .Sh ENVIRONMENT VARIABLES The following environment variables affect the execution of .Nm : .Bl -tag -width ".Ev LC_ALL" .It Ev LANG If LANG is set, messages and index information will be read from files named messages.$LANG and INDEX.$LANG and fall back to files named messages and INDEX if messages.$LANG and INDEX.$LANG do not exist. LANG takes precedence over LC_ALL. .It Ev LC_ALL If LC_ALL is set, messages and index information will be read from files named messages.$LC_ALL and INDEX.$LC_ALL and fall back to files named messages and INDEX if messages.$LC_ALL and INDEX.$LC_ALL do not exist. .El .Sh FILES /usr/share/examples/bsdconfig/bsdconfigrc can be copied to $HOME/.bsdconfigrc and customized as needed. .Sh EXIT STATUS .Ex -std .Sh SEE ALSO .Xr bsdinstall 8 .Sh HISTORY .Nm first appeared in .Fx 9.2 . .Sh AUTHORS .An Ron McDowell .An Devin Teske Aq Mt dteske@FreeBSD.org .Sh BUGS The docsinstall and diskmgmt modules call bsdinstall. Bugs found in these modules should be considered those of bsdinstall, not .Nm .