|
NAMEdpv —
dialog progress view library
LIBRARYlibrary “libdpv”SYNOPSIS#include <dpv.h>
int
void
DESCRIPTIONThedpv library provides an interface for creating
complex “gauge” widgets for displaying progress on various
actions. The dpv library can display progress with one
of
dialog(3),
dialog(1),
or
Xdialog(1)
(x11/xdialog from the ports tree).
The 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 */ }; The options member of the
The file_list argument to
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) */ }; For each of the items in the file_list
“linked-list” argument, the The If the output member of the
To abort extern int dpv_interrupt; /* Set to TRUE in interrupt handler */ extern int dpv_abort; /* Set to true in callback to abort */ These globals are not automatically reset and must be manually
maintained. Do not forget to reset these globals before subsequent
invocations of In addition, the status member of the
enum dpv_status { DPV_STATUS_RUNNING = 0, /* Running (default) */ DPV_STATUS_DONE, /* Completed */ DPV_STATUS_FAILED, /* Oops, something went wrong */ }; The default status is zero,
DPV_STATUS_RUNNING, which keeps the callbacks coming for the current
The extern int dpv_overall_read; Set this to the number of bytes that have been read for all files. Throughput information is displayed in the status line (only available when using dialog(3)) at the bottom of the screen. See DPV_DISPLAY_LIBDIALOG above. Note that dpv_overall_read does not have to
represent bytes. For example, the status_format can be
changed to display something other than
“ When The ENVIRONMENTThe below environment variables are referenced bydpv :
FILES
SEE ALSOdialog(1), Xdialog(1), dialog(3)HISTORYThedpv library first appeared in
FreeBSD 10.2.
AUTHORSDevin Teske ⟨dteske@FreeBSD.org⟩BUGSXdialog(1), when given both ‘ ’ (see above
‘title ’ member of
struct dpv_config) and
‘ ’ (see above
‘backtitle ’ member
of struct dpv_config), displays the backtitle in place
of the title and vice-versa.
Xdialog(1)
does not wrap long prompt texts received after initial launch. This is a
known issue with the ‘ 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 dialog(1) and does not affect dialog(3) or Xdialog(1). If an application ignores
Visit the GSP FreeBSD Man Page Interface. |