MixerTUI is an audio mixer with a terminal user interface (TUI) for the FreeBSD sound system. It allow to switch easily between laptop and HDMI, headphones and speakers, and so on. Features include: show the current driver configuration, select an audio device to get information, change the volume, or make the device the default. The version 1.5 is out!
To install the port audio/mixertui:
# cd /usr/ports/audio/mixertui/ && make install clean
To add the package:
# pkg install mixertui
To build from sources:
Step 1. Install deps
# pkg install bsddialog libsysctlmibinfo2
Step 2. Download, build, and run
% git clone https://gitlab.com/alfix/mixertui.git
% cd mixertui
% make % ./mixertui
1) Pop-ups are implemented using libbsddialog, for example the screenshot shows a bsddialog menu. Curiosity, the first version of bsddialog was just a copy of the mixertui pop-ups to implement dialogs, now mixertui uses libbsddialog to show pop-ups.
2) Improvements for the menu to select the device/pcm. The item with the default pcm (sysctl hw.snd.default_unit) has the “(Default)” prefix; pcm4 in the screenshot. Opening the menu the selected item is the current pcm; pcm2 in the screenshot.
3) Fix fault with terminals without colors. Example
% env TERM=vt220 mixertui
4) Few internal refactoring. Probably this is the last C/ncurses version, (see Future subsection below).
MixerTUI started out as a personal project (…game :D). I spent 30 minutes to set up my microphone to record my BSDCan presentation during the first lockdown. I set audio quickly via alsamixer in the past. Now my main laptop runs FreeBSD, so I wrote mixertui to avoid to waste time setting up a microphone, headphones, accessibility, and so on.
The first version was just 1000 lines of code; mainly ncurses stuff because the sound system interface is actually easy: just some ioctl and sysctl. However several users started to use it. I received a lot of tips, feedback, merge request, iussues, email, and so on.
The utility grew messy to implement the user requests. Mainly I spent time to use libncurses, because it does not provides widgets (buttons, title, bars, …), it is just a “render” library. I would have preferred to spend time implementing new audio features instead of “drawing” a bar. ncurses is not suitable. I am considering other TUI libraries to rewrite MixerTUI in the next version 2.0. Under the radar: brick/haskell, tui-rs/rust, FTXUI/C++.
Conclusion, this is just a TUI improvements version. I’ ll rewrite mixertui. TODO, Ideas and new audio features in the future: mouse, virtual_oss, devd, sound(4) improvements, accessibility, and so on.
The FreeBSD 3q2023 status report is online!
My contribution is PortOptsCLI (Port Options CLI), a new utility to select the port options using a Command Line Interface. It is suitable for a speech synthesizer (currently tested with the speech synthesizer of accessibility/orca), so it is accessible to users with vision impairment.
To know more:
The FreeBSD Operating System provides the Ports Collection to give users and administrators a simple way to install applications.
It is possible to configure a port before the building and installation. The configuration consists of a set of lists: checklists to enable or disable an option, radiolist to select at the most one option. Some list is mandatory, at least one option has to be active.
ports-mgmt/dialog4ports and ports-mgmt/portconfig allow to set up a port via an interactive Text User Interface. They are implicitly used by “make config”, example editors/vim port:
# cd /usr/ports/editors/vim # make config
The black and white theme can provide high-contrast accessibility for users with low vision, for portconfig >= 0.6:
# env NO_COLOR="YES" make config
Older versions:
# env PORTCONFIG_THEME="blackwhite" make config
Unfortunately screen readers perform terrible with TUI; it is a well-known accessibility problem. FreeBSD provides tens of thousands of ports; port configuration is a key feature, unfortunately it is inaccessible to users with vision impairment.
PortOptsCLI (Port Options CLI) is an utility for setting the port options via a Command Line Interface. Properly PortOptsCLI provides commands to navigate lists (checklists and/or radiolists) and set up their items interactively also suitable for a speech synthesizer. Currently it is tested with the speech synthesizer of orca https://wiki.gnome.org/Projects/Orca, FreeBSD provides a port and a package https://www.freshports.org/accessibility/orca/.
Preview https://twitter.com/alfsiciliano/status/1694858990440648711, video description and transcription are available in the Demo section later.
To install the port:
# cd /usr/ports/ports-mgmt/portoptscli/ && make install clean
or to install the package:
# pkg install portoptscli
After the installation, add to /etc/make.conf:
#DIALOG4PORTS?= ${LOCALBASE}/bin/dialog4ports
${LOCALBASE}/bin/portoptscli DIALOG4PORTS=
Now ‘make config’ uses portoptscli automatically.
To start to set up a port are sufficient few commands:
h: specific port help if exist.
n: next element (header, list, option, end line).
p: previous element.
r: reprint current element.
space: enable or disable a checklist item, select a radiolist item.
a: abandon without saving.
q: save and quit.
All features are linked in the Documentation section later.
PortOptsCLI disables ECHO and ENTER. However this demo surrounds runtime commands and comments by square brackets in a new line for ease of understanding. To note some speech synthesizer can read the typed keys depending on the current setting.
# cd /usr/ports/editors/neovim
[ENTER]
# make config
[ENTER, start implicitly portoptscli]
Configuration for neovim-0.9.1 port, 1 list total 2 options.
[v]
Verbose mode on.
n: next, p: previous, r: reprint, space: select or unselect.
[n]
List 1. Generic options. Checklist with 2 options.
[n]
1 NLS: Native Language Support. Enabled.
[n]
2 PYNVIM: Enable support for plugins written in python. Disabled.
[SPACE]
option PYNVIM enabled.
[n]
End configuration. q: save and quit, a: abandon without saving, t: go to top.
[q]
Save and quit. #
Another demo without commands and comments:
# cd /usr/ports/editors/vim
# make config
Configuration for vim-9.0.1671 port, 3 lists total 12 options.
Verbose mode on.
n: next, p: previous, r: reprint, space: select or unselect.
List 1. Generic options. Checklist with 3 options.
1 MAKE_JOBS: Enable parallel build. Disabled.
2 NLS: Native Language Support. Enabled.
3 XTERM_SAVE: Restore xterm screen after exit. Disabled.
option XTERM_SAVE enabled.
List 2. Optional language bindings. Checklist with 6 options.
1 LUA: Lua scripting language support. Disabled.
2 PERL: Perl scripting language support. Disabled.
3 PYTHON: Python bindings or support. Enabled.
4 RUBY: Ruby bindings or support. Disabled.
5 SCHEME: MzScheme (Racket) bindings. Disabled.
6 TCL: Tcl scripting language support. Disabled.
List 3. CTAGS. RadioList with 3 options, mandatory list select at least one option.
1 CTAGS_BASE: Use system ctags. Selected.
2 CTAGS_EXUBERANT: Use exctags instead of ctags.
3 CTAGS_UNIVERSAL: Use uctags instead of ctags.
option CTAGS_UNIVERSAL selected previous CTAGS_BASE unselected.
End configuration. q: save and quit, a: abandon without saving, t: go to top.
Save and quit. #
Verbose mode can be set by the PORTOPTSCLI_VERBOSE=“YES” environment variable.
The c key prints the short commands list described in the Getting Started:
# make config
Configuration for neovim-0.9.1 port, 1 list total 2 options.
[c]
Short commands list.
h: specific port help if exist.
i: port and lists info.
n: next element.
p: previouse element.
r: reprint element.
space: select or unselect an option.
a: abandon without saving.
q: save and quit.
[a]
===> Options unchanged #
Some port has a specific help file, if it exists PortOptsCLI informs at startup/top, h key to print it:
# cd /usr/ports/devel/pcre/
# make config
Configuration for pcre-8.45_3 port, 2 lists total 6 options.
The port has a help file, h: to print.
[h]
Help file /usr/ports/devel/pcre/pkg-help.
Using the heap rather than the stack for recursion (i.e., turning the
STACK_RECURSION knob off) is slower but less prone to segfaults from
stack exhaustion when matching certain patterns.
End help file.
[a]
===> Options unchanged
FreeBSD also allows you to configure a port using environment variables or configuration files, both ways are described in the port(7) manual.
Resources and links for further information:
A system call is the “tool” used by a software in the userspace to request a “service” to the kernel. The FreeBSD Operating System provides over 400 system calls. They are defined in syscalls.master, this file is processed by makesyscalls.lua to create: init_sysent.c, syscall.h, and so on.
The system calls list has 588 entries (15: unimplemented, 53: nosys/lkmnosys, 46: compat and 72: old/obsolete) for 15-CURRENT at the time of writing. The entry point of a system call is sys_{name}, except syscall and __syscall described below.
This table is partially auto-generated by scanning init_sysent.c and manually filled, indeed its purpose is just a personal study of the FreeBSD kernel.
Number | Name (and manual link) | Short Description | Implementation |
---|---|---|---|
0 | syscall | Indirect system call | kern/subr_syscall.c |
1 | exit | Terminate the calling process | kern/kern_exit.c |
2 | fork | Create a new process | kern/kern_fork.c |
3 | read | Read input | kern/sys_generic.c |
4 | write | Write output | kern/sys_generic.c |
5 | open | Open or create a file for reading, writing or executing | kern/vfs_syscalls.c |
6 | close | Delete a descriptor | kern/kern_descrip.c |
7 | wait4 | Wait for processes to change status | kern/kern_exit.c |
8 | [old] creat | ||
9 | link | Make a hard file link | kern/vfs_syscalls.c |
10 | unlink | Remove directory entry | kern/vfs_syscalls.c |
11 | [obsolete] execv | ||
12 | chdir | Change current working directory | kern/vfs_syscalls.c |
13 | fchdir | Change current working directory | kern/vfs_syscalls.c |
14 | [freebsd11] mknod | ||
15 | chmod | Change mode of file | kern/vfs_syscalls.c |
16 | chown | Change owner and group of a file | kern/vfs_syscalls.c |
17 | break | (no manual) | vm/vm_unix.c |
18 | [freebsd4] getfsstat | ||
19 | [old] lseek | ||
20 | getpid | Get parent or calling process identification | kern/kern_prot.c |
21 | mount | Mount or dismount a file system | kern/vfs_mount.c |
22 | unmount | Mount or dismount a file system | kern/vfs_mount.c |
23 | setuid | Set user and group ID | kern/kern_prot.c |
24 | getuid | Get user identification | kern/kern_prot.c |
25 | geteuid | Get user identification | kern/kern_prot.c |
26 | ptrace | Process tracing and debugging | kern/sys_process.c |
27 | recvmsg | Receive message(s) from a socket | kern/uipc_syscalls.c |
28 | sendmsg | Send message(s) from a socket | kern/uipc_syscalls.c |
29 | recvfrom | Receive message(s) from a socket | kern/uipc_syscalls.c |
30 | accept | Accept a connection on a socket | kern/uipc_syscalls.c |
31 | getpeername | Get name of connected peer | kern/uipc_syscalls.c |
32 | getsockname | Get socket name | kern/uipc_syscalls.c |
33 | access | Check accessibility of a file | kern/vfs_syscalls.c |
34 | chflags | Set file flags | kern/vfs_syscalls.c |
35 | fchflags | Set file flags | kern/vfs_syscalls.c |
36 | sync | Schedule file system updates | kern/vfs_syscalls.c |
37 | kill | Send signal to a process | kern/kern_sig.c |
38 | [old] stat | ||
39 | getppid | Get parent or calling process identification | kern/kern_prot.c |
40 | [old] lstat | ||
41 | dup | Duplicate an existing file descriptor | kern/kern_descrip.c |
42 | [freebsd10] pipe | ||
43 | getegid | Get group process identification | kern/kern_prot.c |
44 | profil | Control process profiling | kern/subr_prof.c |
45 | ktrace | Process tracing | kern/kern_ktrace.c |
46 | [old] sigaction | ||
47 | getgid | Get group process identification | kern/kern_prot.c |
48 | [old] sigprocmask | ||
49 | getlogin | Get login name | kern/kern_prot.c |
50 | setlogin | Set login name | kern/kern_prot.c |
51 | acct | Enable or disable process accounting | kern/kern_acct.c |
52 | [old] sigpending | ||
53 | sigaltstack | Set and/or get signal stack context | kern/kern_sig.c |
54 | ioctl | Control device | kern/sys_generic.c |
55 | reboot | Reboot system or halt processor | kern/kern_shutdown.c |
56 | revoke | Revoke file access | kern/vfs_syscalls.c |
57 | symlink | Make symbolic link to a file | kern/vfs_syscalls.c |
58 | readlink | Read value of a symbolic link | kern/vfs_syscalls.c |
59 | execve | Execute a file | kern/kern_exec.c |
60 | umask | Set file creation mode mask | kern/vfs_syscalls.c |
61 | chroot | Change root directory | kern/vfs_syscalls.c |
62 | [old] fstat | ||
63 | [old] getkerninfo | ||
64 | [old] getpagesize | ||
65 | msync | Synchronize a mapped region | vm/vm_mmap.c |
66 | vfork | Create a new process without copying the address space | kern/kern_fork.c |
67 | [obsolete] vread | ||
68 | [obsolete] vwrite | ||
69 | sbrk | change data segment size - EOPNOTSUPP | vm/vm_mmap.c |
70 | sstk | EOPNOTSUPP | vm/vm_mmap.c |
71 | [old] mmap | ||
72 | [freebsd11] vadvise | ||
73 | munmap | Remove a mapping | vm/vm_mmap.c |
74 | mprotect | Control the protection of pages | vm/vm_mmap.c |
75 | madvise | Give advice about use of memory | vm/vm_mmap.c |
76 | [obsolete] vhangup | ||
77 | [obsolete] vlimit | ||
78 | mincore | Determine residency of memory pages | vm/vm_mmap.c |
79 | getgroups | Get group access list | kern/kern_prot.c |
80 | setgroups | Set group access list | kern/kern_prot.c |
81 | getpgrp | Get process group | kern/kern_prot.c |
82 | setpgid | Set process group | kern/kern_prot.c |
83 | setitimer | Set value of interval timer | kern/kern_time.c |
84 | [old] wait | ||
85 | swapon | Control devices for interleaved paging/swapping | vm/swap_pager.c |
86 | getitimer | Get value of interval timer | kern/kern_time.c |
87 | [old] gethostname | ||
88 | [old] sethostname | ||
89 | getdtablesize | Get file descriptor limit | kern/kern_descrip.c |
90 | dup2 | Duplicate an existing file descriptor | kern/kern_descrip.c |
91 | [unimplemented] getdopt | ||
92 | fcntl | File control | kern/kern_descrip.c |
93 | select | Synchronous I/O multiplexing | kern/sys_generic.c |
94 | [unimplemented] setdopt | ||
95 | fsync | Synchronise changes to a file | kern/vfs_syscalls.c |
96 | setpriority | Set program scheduling priority | kern/kern_resource.c |
97 | socket | Create an endpoint for communication | kern/uipc_syscalls.c |
98 | connect | Initiate a connection on a socket | kern/uipc_syscalls.c |
99 | [old] accept | ||
100 | getpriority | Get program scheduling priority | kern/kern_resource.c |
101 | [old] send | ||
102 | [old] recv | ||
103 | [old] sigreturn | ||
104 | bind | Assign a local protocol address to a socket | kern/uipc_syscalls.c |
105 | setsockopt | Get and set options on sockets | kern/uipc_syscalls.c |
106 | listen | Listen for connections on a socket | kern/uipc_syscalls.c |
107 | [obsolete] vtimes | ||
108 | [old] sigvec | ||
109 | [old] sigblock | ||
110 | [old] sigsetmask | ||
111 | [old] sigsuspend | ||
112 | [old] sigstack | ||
113 | [old] recvmsg | ||
114 | [old] sendmsg | ||
115 | [obsolete] vtrace | ||
116 | gettimeofday | Get date and time | kern/kern_time.c |
117 | getrusage | Get information about resource utilization | kern/kern_resource.c |
118 | getsockopt | Get and set options on sockets | kern/uipc_syscalls.c |
119 | [unimplemented] resuba | ||
120 | readv | Read input | kern/sys_generic.c |
121 | writev | Write output | kern/sys_generic.c |
122 | settimeofday | Set date and time | kern/kern_time.c |
123 | fchown | Change owner and group of a file | kern/vfs_syscalls.c |
124 | fchmod | Change mode of file | kern/vfs_syscalls.c |
125 | [old] recvfrom | ||
126 | setreuid | Set real and effective user ID’s | kern/kern_prot.c |
127 | setregid | Set real and effective group ID | kern/kern_prot.c |
128 | rename | Change the name of a file | kern/vfs_syscalls.c |
129 | [old] truncate | ||
130 | [old] ftruncate | ||
131 | flock | Apply or remove an advisory lock on an open file | kern/kern_descrip.c |
132 | mkfifo | Make a fifo file | kern/vfs_syscalls.c |
133 | sendto | Send message(s) from a socket | kern/uipc_syscalls.c |
134 | shutdown | Disable sends and/or receives on a socket | kern/uipc_syscalls.c |
135 | socketpair | Create a pair of connected sockets | kern/uipc_syscalls.c |
136 | mkdir | Make a directory file | kern/vfs_syscalls.c |
137 | rmdir | Remove a directory file | kern/vfs_syscalls.c |
138 | utimes | Set file access and modification times | kern/vfs_syscalls.c |
139 | [obsolete] 4.2 sigreturn | ||
140 | adjtime | Correct the time to allow synchronization of the system clock | kern/kern_ntptime.c |
141 | [old] getpeername | ||
142 | [old] gethostid | ||
143 | [old] sethostid | ||
144 | [old] getrlimit | ||
145 | [old] setrlimit | ||
146 | [old] killpg | ||
147 | setsid | Create session and set process group ID | kern/kern_prot.c |
148 | quotactl | Manipulate file system quotas | kern/vfs_syscalls.c |
149 | [old] quota | ||
150 | [old] getsockname | ||
151 | [unimplemented] sem_lock | ||
152 | [unimplemented] sem_wakeup | ||
153 | [unimplemented] asyncdaemon | ||
154 | nlm_syscall | (no manual) | nlm/nlm_prot_impl.c |
155 | nfssvc | NFS services | nfs/nfs_nfssvc.c |
156 | [old] getdirentries | ||
157 | [freebsd4] statfs | ||
158 | [freebsd4] fstatfs | ||
159 | [nosys] | ||
160 | lgetfh | Get file handle | kern/vfs_syscalls.c |
161 | getfh | Get file handle | kern/vfs_syscalls.c |
162 | [freebsd4] getdomainname | ||
163 | [freebsd4] setdomainname | ||
164 | [freebsd4] uname | ||
165 | sysarch | Architecture-dependent system call | sys/ {arch}/ {arch}/ sys_machdep.c |
166 | rtprio | Examine or modify realtime or idle priority | kern/kern_resource.c |
167 | [nosys] | ||
168 | [nosys] | ||
169 | semsys | (no manual) | kern/sysv_sem.c |
170 | msgsys | (no manual) | kern/sysv_msg.c |
171 | shmsys | (no manual) | kern/sysv_shm.c |
172 | [nosys] | ||
173 | [freebsd6] pread | ||
174 | [freebsd6] pwrite | ||
175 | setfib | Set the default FIB (routing table) for the calling process | net/route/route_tables.c |
176 | ntp_adjtime | Network Time Protocol (NTP) daemon interface | kern/kern_ntptime.c |
177 | [unimplemented] sfork | ||
178 | [unimplemented] getdescriptor | ||
179 | [unimplemented] setdescriptor | ||
180 | [nosys] | ||
181 | setgid | Set user and group ID | kern/kern_prot.c |
182 | setegid | Set user and group ID | kern/kern_prot.c |
183 | seteuid | Set user and group ID | kern/kern_prot.c |
184 | [obsolete] lfs_bmapv | ||
185 | [obsolete] lfs_markv | ||
186 | [obsolete] lfs_segclean | ||
187 | [obsolete] lfs_segwait | ||
188 | [freebsd11] stat | ||
189 | [freebsd11] fstat | ||
190 | [freebsd11] lstat | ||
191 | pathconf | Get configurable pathname variables | kern/vfs_syscalls.c |
192 | fpathconf | Get configurable pathname variables | kern/kern_descrip.c |
193 | [nosys] | ||
194 | getrlimit | Control maximum system resource consumption | kern/kern_resource.c |
195 | setrlimit | Control maximum system resource consumption | kern/kern_resource.c |
196 | [freebsd11] getdirentries | ||
197 | [freebsd6] mmap | ||
198 | __syscall | Indirect system call for 64-bit args | kern/subr_syscall.c |
199 | [freebsd6] lseek | ||
200 | [freebsd6] truncate | ||
201 | [freebsd6] ftruncate | ||
202 | sysctl | Get or set system state | kern/kern_sysctl.c |
203 | mlock | Lock physical pages in memory | vm/vm_mmap.c |
204 | munlock | Unlock physical pages in memory | vm/vm_mmap.c |
205 | undelete | Attempt to recover a deleted file | kern/vfs_syscalls.c |
206 | futimes | Set file access and modification | kern/vfs_syscalls.c |
207 | getpgid | Get process group | kern/kern_prot.c |
208 | [nosys] | ||
209 | poll | Synchronous I/O multiplexing | kern/sys_generic.c |
210 | [lkmnosys] | ||
211 | [lkmnosys] | ||
212 | [lkmnosys] | ||
213 | [lkmnosys] | ||
214 | [lkmnosys] | ||
215 | [lkmnosys] | ||
216 | [lkmnosys] | ||
217 | [lkmnosys] | ||
218 | [lkmnosys] | ||
219 | [lkmnosys] | ||
220 | [freebsd7] __semctl | ||
221 | semget | Obtain a semaphore id | kern/sysv_sem.c |
222 | semop | Atomic array of operations on a semaphore set | kern/sysv_sem.c |
223 | [obsolete] semconfig | ||
224 | [freebsd7] msgctl | ||
225 | msgget | Get message queue | kern/sysv_msg.c |
226 | msgsnd | Send a message to a message queue | kern/sysv_msg.c |
227 | msgrcv | Receive a message from a message queue | kern/sysv_msg.c |
228 | shmat | Attach or detach shared memory | kern/sysv_shm.c |
229 | [freebsd7] shmctl | ||
230 | shmdt | Attach or detach shared memory | kern/sysv_shm.c |
231 | shmget | Obtain a shared memory identifier | kern/sysv_shm.c |
232 | clock_gettime | Get date and time | kern/kern_time.c |
233 | clock_settime | Set date and time | kern/kern_time.c |
234 | clock_getres | Calibrate date and time | kern/kern_time.c |
235 | ktimer_create | (no manual) | kern/kern_time.c |
236 | ktimer_delete | (no manual) | kern/kern_time.c |
237 | ktimer_settime | (no manual) | kern/kern_time.c |
238 | ktimer_gettime | (no manual) | kern/kern_time.c |
239 | ktimer_getoverrun | (no manual) | kern/kern_time.c |
240 | nanosleep | High resolution sleep | kern/kern_time.c |
241 | ffclock_getcounter | Retrieve feed-forward counter | kern/kern_ffclock.c |
242 | ffclock_setestimate | Set feed-forward clock estimates | kern/kern_ffclock.c |
243 | ffclock_getestimate | Get feed-forward clock estimates | kern/kern_ffclock.c |
244 | clock_nanosleep | High resolution sleep | kern/kern_time.c |
245 | [nosys] | ||
246 | [nosys] | ||
247 | clock_getcpuclockid2 | (no manual) | kern/kern_time.c |
248 | ntp_gettime | Network Time Protocol (NTP) daemon interface system calls | kern/kern_ntptime.c |
249 | [nosys] | ||
250 | minherit | Control the inheritance of pages | vm/vm_mmap.c |
251 | rfork | Manipulate process resources | kern/kern_fork.c |
252 | [obsolete] openbsd_poll | ||
253 | issetugid | Is current process tainted by uid or gid changes | kern/kern_prot.c |
254 | lchown | Change owner and group of a file | kern/vfs_syscalls.c |
255 | aio_read | Asynchronous read from a file (realtime) | kern/vfs_aio.c |
256 | aio_write | Asynchronous write to a file (realtime) | kern/vfs_aio.c |
257 | lio_listio | List directed I/O (realtime) | kern/vfs_aio.c |
258 | [nosys] | ||
259 | [nosys] | ||
260 | [nosys] | ||
261 | [nosys] | ||
262 | [nosys] | ||
263 | [nosys] | ||
264 | [nosys] | ||
265 | [nosys] | ||
266 | [nosys] | ||
267 | [nosys] | ||
268 | [nosys] | ||
269 | [nosys] | ||
270 | [nosys] | ||
271 | [nosys] | ||
272 | [freebsd11] getdents | ||
273 | [nosys] | ||
274 | lchmod | Change mode of file | kern/vfs_syscalls.c |
275 | [obsolete] netbsd_lchown | ||
276 | lutimes | Set file access and modification times | kern/vfs_syscalls.c |
277 | [obsolete] netbsd_msync | ||
278 | [freebsd11] nstat | ||
279 | [freebsd11] nfstat | ||
280 | [freebsd11] nlstat | ||
281 | [nosys] | ||
282 | [nosys] | ||
283 | [nosys] | ||
284 | [nosys] | ||
285 | [nosys] | ||
286 | [nosys] | ||
287 | [nosys] | ||
288 | [nosys] | ||
289 | preadv | Read input | kern/sys_generic.c |
290 | pwritev | Write output | kern/sys_generic.c |
291 | [nosys] | ||
292 | [nosys] | ||
293 | [nosys] | ||
294 | [nosys] | ||
295 | [nosys] | ||
296 | [nosys] | ||
297 | [freebsd4] fhstatfs | ||
298 | fhopen | Access file via file handle | kern/vfs_syscalls.c |
299 | [freebsd11] fhstat | ||
300 | modnext | Return the modid of the next kernel module | kern/kern_module.c |
301 | modstat | Get status of kernel module | kern/kern_module.c |
302 | modfnext | Return the modid of the next kernel module | kern/kern_module.c |
303 | modfind | Returns the modid of a kernel module | kern/kern_module.c |
304 | kldload | Load KLD files into the kernel | kern/kern_linker.c |
305 | kldunload | Unload kld files | kern/kern_linker.c |
306 | kldfind | Returns the fileid of a kld file | kern/kern_linker.c |
307 | kldnext | Return the fileid of the next kld file | kern/kern_linker.c |
308 | kldstat | Get status of kld file | kern/kern_linker.c |
309 | kldfirstmod | Return first module id from the kld file specified | kern/kern_linker.c |
310 | getsid | Get process session | kern/kern_prot.c |
311 | setresuid | Set real, effective and saved user or group ID | kern/kern_prot.c |
312 | setresgid | Set real, effective and saved user or group ID | kern/kern_prot.c |
313 | [obsolete] signanosleep | ||
314 | aio_return | Retrieve return status of asynchronous I/O operation (realtime) | kern/vfs_aio.c |
315 | aio_suspend | Suspend until asynchronous I/O operations or timeout complete (realtime) | kern/vfs_aio.c |
316 | aio_cancel | Cancel an outstanding asynchronous I/O operation (realtime) | kern/vfs_aio.c |
317 | aio_error | Retrieve error status of asynchronous I/O operation (realtime) | kern/vfs_aio.c |
318 | [freebsd6] aio_read | ||
319 | [freebsd6] aio_write | ||
320 | [freebsd6] lio_listio | ||
321 | yield | (no manual) | kern/kern_synch.c |
322 | [obsolete] thr_sleep | ||
323 | [obsolete] thr_wakeup | ||
324 | mlockall | Lock (unlock) the address space of a process | vm/vm_mmap.c |
325 | munlockall | Lock (unlock) the address space of a process | vm/vm_mmap.c |
326 | __getcwd | (getcwd(3) Get working directory pathname) | kern/vfs_cache.c |
327 | sched_setparam | Set scheduling parameters | kern/p1003_1b.c |
328 | sched_getparam | Get scheduling parameters | kern/p1003_1b.c |
329 | sched_setscheduler | Set scheduling policy and scheduler parameters | kern/p1003_1b.c |
330 | sched_getscheduler | Get scheduling policy and scheduler parameters | kern/p1003_1b.c |
331 | sched_yield | yield processor | kern/p1003_1b.c |
332 | sched_get_priority_max | Get scheduling parameter limits | kern/p1003_1b.c |
333 | sched_get_priority_min | Get scheduling parameter limits | kern/p1003_1b.c |
334 | sched_rr_get_interval | Get scheduling parameter limits | kern/p1003_1b.c |
335 | utrace | Insert user record in ktrace log | kern/kern_ktrace.c |
336 | [freebsd4] sendfile | ||
337 | kldsym | Look up address by symbol name in a KLD | kern/kern_linker.c |
338 | jail | Create and manage system jails | kern/kern_jail.c |
339 | nnpfs_syscall | (no manual) | |
340 | sigprocmask | Manipulate current signal mask | kern/kern_sig.c |
341 | sigsuspend | Atomically release blocked signals and wait for interrupt | kern/kern_sig.c |
342 | [freebsd4] sigaction | ||
343 | sigpending | Get pending signals | kern/kern_sig.c |
344 | [freebsd4] sigreturn | ||
345 | sigtimedwait | Wait for queued signals (realtime) | kern/kern_sig.c |
346 | sigwaitinfo | Wait for queued signals (realtime) | kern/kern_sig.c |
347 | __acl_get_file | (acl_get_file(3)) | kern/vfs_acl.c |
348 | __acl_set_file | (acl_set_file(3)) | kern/vfs_acl.c |
349 | __acl_get_fd | (acl_get_fd(3)) | kern/vfs_acl.c |
350 | __acl_set_fd | (acl_set_fd(3)) | kern/vfs_acl.c |
351 | __acl_delete_file | (acl_delete(3)) | kern/vfs_acl.c |
352 | __acl_delete_fd | (acl_delete(3)) | kern/vfs_acl.c |
353 | __acl_aclcheck_file | (no manual) | kern/vfs_acl.c |
354 | __acl_aclcheck_fd | (no manual) | kern/vfs_acl.c |
355 | extattrctl | (no manual) | kern/vfs_extattr.c |
356 | extattr_set_file | Manipulate VFS extended attributes | kern/vfs_extattr.c |
357 | extattr_get_file | Manipulate VFS extended attributes | kern/vfs_extattr.c |
358 | extattr_delete_file | Manipulate VFS extended attributes | kern/vfs_extattr.c |
359 | aio_waitcomplete | Wait for the next completion of an aio request | kern/vfs_aio.c |
360 | getresuid | Get real, effective and saved user or group ID | kern/kern_prot.c |
361 | getresgid | Get real, effective and saved user or group ID | kern/kern_prot.c |
362 | kqueue | Kernel event notification mechanism | kern/kern_event.c |
363 | [freebsd11] kevent | ||
364 | [obsolete] __cap_get_proc | ||
365 | [obsolete] __cap_set_proc | ||
366 | [obsolete] __cap_get_fd | ||
367 | [obsolete] __cap_get_file | ||
368 | [obsolete] __cap_set_fd | ||
369 | [obsolete] __cap_set_file | ||
370 | [nosys] | ||
371 | extattr_set_fd | Manipulate VFS extended attributes | kern/vfs_extattr.c |
372 | extattr_get_fd | Manipulate VFS extended attributes | kern/vfs_extattr.c |
373 | extattr_delete_fd | Manipulate VFS extended attributes | kern/vfs_extattr.c |
374 | __setugid | (no manual) | kern/kern_prot.c |
375 | [obsolete] nfsclnt | ||
376 | eaccess | Check accessibility of a file | kern/vfs_syscalls.c |
377 | afs3_syscall | (no manual) | |
378 | nmount | Mount or dismount a file system | kern/vfs_mount.c |
379 | [obsolete] kse_exit | ||
380 | [obsolete] kse_wakeup | ||
381 | [obsolete] kse_create | ||
382 | [obsolete] kse_thr_interrupt | ||
383 | [obsolete] kse_release | ||
384 | __mac_get_proc | (mac_get_proc(3)) | security/mac/mac_syscalls.c |
385 | __mac_set_proc | (mac_set_proc(3)) | security/mac/mac_syscalls.c |
386 | __mac_get_fd | (mac_get_fd(3)) | security/mac/mac_syscalls.c |
387 | __mac_get_file | (mac_get_file(3)) | security/mac/mac_syscalls.c |
388 | __mac_set_fd | (mac_set_fd(3)) | security/mac/mac_syscalls.c |
389 | __mac_set_file | (mac_set_file(3)) | security/mac/mac_syscalls.c |
390 | kenv | kernel environment | kern/kern_environment.c |
391 | lchflags | Set file flags | kern/vfs_syscalls.c |
392 | uuidgen | Generate universally unique identifiers | kern/kern_uuid.c |
393 | sendfile | Send a file to a socket | kern/kern_sendfile.c |
394 | mac_syscall | (no manual) | security/mac/mac_syscalls.c |
395 | [freebsd11] getfsstat | ||
396 | [freebsd11] statfs | ||
397 | [freebsd11] fstatfs | ||
398 | [freebsd11] fhstatfs | ||
399 | [nosys] | ||
400 | ksem_close | (no manual) | kern/uipc_sem.c |
401 | ksem_post | (no manual) | kern/uipc_sem.c |
402 | ksem_wait | (no manual) | kern/uipc_sem.c |
403 | ksem_trywait | (no manual) | kern/uipc_sem.c |
404 | ksem_init | (no manual) | kern/uipc_sem.c |
405 | ksem_open | (no manual) | kern/uipc_sem.c |
406 | ksem_unlink | (no manual) | kern/uipc_sem.c |
407 | ksem_getvalue | (no manual) | kern/uipc_sem.c |
408 | ksem_destroy | (no manual) | kern/uipc_sem.c |
409 | __mac_get_pid | (mac_get_pid(3)) | security/mac/mac_syscalls.c |
410 | __mac_get_link | (mac_get_link(3)) | security/mac/mac_syscalls.c |
411 | __mac_set_link | (mac_set_link(3)) | security/mac/mac_syscalls.c |
412 | extattr_set_link | Manipulate VFS extended attributes | kern/vfs_extattr.c |
413 | extattr_get_link | Manipulate VFS extended attributes | kern/vfs_extattr.c |
414 | extattr_delete_link | Manipulate VFS extended attributes | kern/vfs_extattr.c |
415 | __mac_execve | (no manual) | kern/kern_exec.c |
416 | sigaction | Software signal facilities | kern/kern_sig.c |
417 | sigreturn | Return from signal | sys/ {arch}/ {arch}/ sys_machdep.c |
418 | [unimplemented] __xstat | ||
419 | [unimplemented] __xfstat | ||
420 | [unimplemented] __xlstat | ||
421 | getcontext | Get user thread context | kern/kern_context.c |
422 | setcontext | Set user thread context | kern/kern_context.c |
423 | swapcontext | Modify and exchange user thread contexts | kern/kern_context.c |
424 | [freebsd13] swapoff | ||
425 | __acl_get_link | (acl_get(3)) | kern/vfs_acl.c |
426 | __acl_set_link | (acl_set(3)) | kern/vfs_acl.c |
427 | __acl_delete_link | (acl_delete(3)) | kern/vfs_acl.c |
428 | __acl_aclcheck_link | (no manual) | kern/vfs_acl.c |
429 | sigwait | Select a set of signals | kern/kern_sig.c |
430 | thr_create | (no manual) | kern/kern_thr.c |
431 | thr_exit | Terminate current thread | kern/kern_thr.c |
432 | thr_self | Return thread identifier for the calling thread | kern/kern_thr.c |
433 | thr_kill | Send signal to thread | kern/kern_thr.c |
434 | [freebsd10] _umtx_lock | ||
435 | [freebsd10] _umtx_unlock | ||
436 | jail_attach | Create and manage system jails | kern/kern_jail.c |
437 | extattr_list_fd | Manipulate VFS extended attributes | kern/vfs_extattr.c |
438 | extattr_list_file | Manipulate VFS extended attributes | kern/vfs_extattr.c |
439 | extattr_list_link | Manipulate VFS extended attributes | kern/vfs_extattr.c |
440 | [obsolete] kse_switchin | ||
441 | ksem_timedwait | (no manual) | kern/uipc_sem.c |
442 | thr_suspend | Suspend the calling thread | kern/kern_thr.c |
443 | thr_wake | Wake up the suspended thread | kern/kern_thr.c |
444 | kldunloadf | Unload kld files | kern/kern_linker.c |
445 | audit | Commit BSM audit record to audit log | security/audit/audit_syscalls.c |
446 | auditon | Configure system audit parameters | security/audit/audit_syscalls.c |
447 | getauid | Retrieve audit session ID | security/audit/audit_syscalls.c |
448 | setauid | Set audit session ID | security/audit/audit_syscalls.c |
449 | getaudit | Retrieve audit session state | security/audit/audit_syscalls.c |
450 | setaudit | Set audit session state | security/audit/audit_syscalls.c |
451 | getaudit_addr | Retrieve audit session state | security/audit/audit_syscalls.c |
452 | setaudit_addr | Set audit session state | security/audit/audit_syscalls.c |
453 | auditctl | Configure system audit parameters | security/audit/audit_syscalls.c |
454 | _umtx_op | Interface for implementation of userspace threading synchronization primitives | kern/kern_umtx.c |
455 | thr_new | Create new thread of execution | kern/kern_thr.c |
456 | sigqueue | Queue a signal to a process (realtime) | kern/kern_sig.c |
457 | kmq_open | (no manual) | kern/uipc_mqueue.c |
458 | kmq_setattr | (no manual) | kern/uipc_mqueue.c |
459 | kmq_timedreceive | (no manual) | kern/uipc_mqueue.c |
460 | kmq_timedsend | (no manual) | kern/uipc_mqueue.c |
461 | kmq_notify | (no manual) | kern/uipc_mqueue.c |
462 | kmq_unlink | (no manual) | kern/uipc_mqueue.c |
463 | abort2 | Abort process with diagnostics | kern/kern_exit.c |
464 | thr_set_name | Set user-visible thread name | kern/kern_thr.c |
465 | aio_fsync | Asynchronous file synchronization (realtime) | kern/vfs_aio.c |
466 | rtprio_thread | Examine or modify realtime or idle priority | kern/kern_resource.c |
467 | [nosys] | ||
468 | [nosys] | ||
469 | [unimplemented] __getpath_fromfd | ||
470 | [unimplemented] __getpath_fromaddr | ||
471 | sctp_peeloff | Detach an association from a one-to-many socket to its own fd | netinet/sctp_syscalls.c |
472 | sctp_generic_sendmsg | Send data to a peer | netinet/sctp_syscalls.c |
473 | sctp_generic_sendmsg_iov | Send data to a peer | netinet/sctp_syscalls.c |
474 | sctp_generic_recvmsg | Receive data from a peer | netinet/sctp_syscalls.c |
475 | pread | Read input | kern/sys_generic.c |
476 | pwrite | Write output | kern/sys_generic.c |
477 | mmap | Allocate memory, or map files or devices into memory | vm/vm_mmap.c |
478 | lseek | Reposition read/write file offset | kern/vfs_syscalls.c |
479 | truncate | Truncate or extend a file to a specified length | kern/vfs_syscalls.c |
480 | ftruncate | Truncate or extend a file to a specified length | kern/sys_generic.c |
481 | thr_kill2 | Send signal to thread | kern/kern_thr.c |
482 | [freebsd12] shm_open | ||
483 | shm_unlink | Shared memory object operations | kern/uipc_shm.c |
484 | cpuset | Manage CPU affinity sets | kern/kern_cpuset.c |
485 | cpuset_setid | Manage CPU affinity sets | kern/kern_cpuset.c |
486 | cpuset_getid | Manage CPU affinity sets | kern/kern_cpuset.c |
487 | cpuset_getaffinity | Manage CPU affinity | kern/kern_cpuset.c |
488 | cpuset_setaffinity | Manage CPU affinity | kern/kern_cpuset.c |
489 | faccessat | Check accessibility of a file | kern/vfs_syscalls.c |
490 | fchmodat | Change mode of file | kern/vfs_syscalls.c |
491 | fchownat | Change owner and group of a file | kern/vfs_syscalls.c |
492 | fexecve | Execute a file | kern/kern_exec.c |
493 | [freebsd11] fstatat | ||
494 | futimesat | Set file access and modification | kern/vfs_syscalls.c |
495 | linkat | Make a hard file link | kern/vfs_syscalls.c |
496 | mkdirat | Make a directory file | kern/vfs_syscalls.c |
497 | mkfifoat | Make a fifo file | kern/vfs_syscalls.c |
498 | [freebsd11] mknodat | Make a special file node | |
499 | openat | Open or create a file for reading, writing or executing | kern/vfs_syscalls.c |
500 | readlinkat | Read value of a symbolic link | kern/vfs_syscalls.c |
501 | renameat | Change the name of a file | kern/vfs_syscalls.c |
502 | symlinkat | Make symbolic link to a file | kern/vfs_syscalls.c |
503 | unlinkat | Remove directory entry | kern/vfs_syscalls.c |
504 | posix_openpt | Open a pseudo-terminal device | kern/tty_pts.c |
505 | gssd_syscall | (no manual) | kgssapi/gss_impl.c |
506 | jail_get | Create and manage system jails | kern/kern_jail.c |
507 | jail_set | Create and manage system jails | kern/kern_jail.c |
508 | jail_remove | Create and manage system jails | kern/kern_jail.c |
509 | [freebsd12] closefrom | ||
510 | __semctl | Control operations on a semaphore set | kern/sysv_sem.c |
511 | msgctl | Message control operations | kern/sysv_msg.c |
512 | shmctl | Shared memory control | kern/sysv_shm.c |
513 | lpathconf | Get configurable pathname variables | kern/vfs_syscalls.c |
514 | [obsolete] cap_new | ||
515 | __cap_rights_get | (cap_rights_get(3)) | kern/sys_capability.c |
516 | cap_enter | Capability mode system calls | kern/sys_capability.c |
517 | cap_getmode | Capability mode system calls | kern/sys_capability.c |
518 | pdfork | System calls to manage process descriptors | kern/kern_fork.c |
519 | pdkill | System calls to manage process descriptors | kern/kern_sig.c |
520 | pdgetpid | System calls to manage process descriptors | kern/sys_procdesc.c |
521 | [unimplemented] pdwait4 | ||
522 | pselect | Synchronous I/O multiplexing a la POSIX.1g | kern/sys_generic.c |
523 | getloginclass | Get login class | kern/kern_loginclass.c |
524 | setloginclass | Set login class | kern/kern_loginclass.c |
525 | rctl_get_racct | Manipulate and query the resource limits database | kern/kern_rctl.c |
526 | rctl_get_rules | Manipulate and query the resource limits database | kern/kern_rctl.c |
527 | rctl_get_limits | Manipulate and query the resource limits database | kern/kern_rctl.c |
528 | rctl_add_rule | Manipulate and query the resource limits database | kern/kern_rctl.c |
529 | rctl_remove_rule | Manipulate and query the resource limits database | kern/kern_rctl.c |
530 | posix_fallocate | Pre-allocate storage for a range in a file | kern/sys_generic.c |
531 | posix_fadvise | Give advice about use of file data | kern/vfs_syscalls.c |
532 | wait6 | Wait for processes to change status | kern/kern_exit.c |
533 | cap_rights_limit | Limit capability rights | kern/sys_capability.c |
534 | cap_ioctls_limit | Manage allowed ioctl commands | kern/sys_capability.c |
535 | cap_ioctls_get | Manage allowed ioctl commands | kern/sys_capability.c |
536 | cap_fcntls_limit | Manage allowed fcntl commands | kern/sys_capability.c |
537 | cap_fcntls_get | Manage allowed fcntl commands | kern/sys_capability.c |
538 | bindat | Assign a local protocol address to a socket | kern/uipc_syscalls.c |
539 | connectat | Initiate a connection on a socket | kern/uipc_syscalls.c |
540 | chflagsat | Set file flags | kern/vfs_syscalls.c |
541 | accept4 | Accept a connection on a socket | kern/uipc_syscalls.c |
542 | pipe2 | Create descriptor pair for interprocess communication | kern/sys_pipe.c |
543 | aio_mlock | asynchronous mlock(2) operation | kern/vfs_aio.c |
544 | procctl | Control processes | kern/kern_procctl.c |
545 | ppoll | Synchronous I/O multiplexing | kern/sys_generic.c |
546 | futimens | Set file access and modification times | kern/vfs_syscalls.c |
547 | utimensat | Set file access and modification times | kern/vfs_syscalls.c |
548 | [obsolete] numa_getaffinity | ||
549 | [obsolete] numa_setaffinity | ||
550 | fdatasync | Synchronise changes to a file | kern/vfs_syscalls.c |
551 | fstat | Get file status | kern/kern_descrip.c |
552 | fstatat | Get file status | kern/vfs_syscalls.c |
553 | fhstat | Access file via file handle | kern/vfs_syscalls.c |
554 | getdirentries | Get directory entries in a file system independent format | kern/vfs_syscalls.c |
555 | statfs | Get file system statistics | kern/vfs_syscalls.c |
556 | fstatfs | Get file system statistics | kern/vfs_syscalls.c |
557 | getfsstat | Get list of all mounted file systems | kern/vfs_syscalls.c |
558 | fhstatfs | Access file via file handle | kern/vfs_syscalls.c |
559 | mknodat | Make a special file node | kern/vfs_syscalls.c |
560 | kevent | Kernel event notification mechanism | kern/kern_event.c |
561 | cpuset_getdomain | Manage memory domain policy | kern/kern_cpuset.c |
562 | cpuset_setdomain | Manage memory domain policy | kern/kern_cpuset.c |
563 | getrandom | Get random data | kern/sys_getrandom.c |
564 | getfhat | Get file handle | kern/vfs_syscalls.c |
565 | fhlink | Make a hard file link | kern/vfs_syscalls.c |
566 | fhlinkat | Make a hard file link | kern/vfs_syscalls.c |
567 | fhreadlink | Read value of a symbolic link | kern/vfs_syscalls.c |
568 | funlinkat | Remove directory entry | kern/vfs_syscalls.c |
569 | copy_file_range | Kernel copy of a byte range from one file to another or within one file | kern/vfs_syscalls.c |
570 | sysctlbyname | Get or set system state | kern/kern_sysctl.c |
571 | shm_open2 | (no manual) | kern/uipc_shm.c |
572 | shm_rename | Shared memory object operations | kern/uipc_shm.c |
573 | sigfastblock | Controls signals blocking with a simple memory write | kern/kern_sig.c |
574 | __realpathat | (no manual) | kern/vfs_cache.c |
575 | close_range | Delete open file descriptors | kern/kern_descrip.c |
576 | rpctls_syscall | (no manual) | rpc/rpcsec_tls/rpctls_impl.c |
577 | __specialfd | (no manual) | kern/sys_generic.c |
578 | aio_writev | Asynchronous write to a file (REALTIME) | kern/vfs_aio.c |
579 | aio_readv | Asynchronous read from a file (REALTIME) | kern/vfs_aio.c |
580 | fspacectl | Space management in a file | kern/sys_generic.c |
581 | sched_getcpu | (no manual) | kern/kern_synch.c |
582 | swapoff | Control devices for interleaved paging/swapping | vm/swap_pager.c |
583 | kqueuex | Kernel event notification mechanism | kern/kern_event.c |
584 | membarrier | (no manual) | kern/kern_membarrier.c |
585 | timerfd_create | Timers with file descriptor semantics | kern/sys_timerfd.c |
586 | timerfd_gettime | Timers with file descriptor semantics | kern/sys_timerfd.c |
587 | timerfd_settime | Timers with file descriptor semantics | kern/sys_timerfd.c |
syscall and __syscall have not a sys_syscall() or sys___syscall
entry points, instead the arch-dependent implementation manages SYS_syscall
and SYS___syscall, includes
kern/subr_syscall.c
and syscallenter() dispatches the handler of the indirect system call.
Architecture | Implementation |
---|---|
amd64 | amd64/amd64/trap.c |
arm | arm/arm/syscall.c |
arm64 | arm64/arm64/trap.c |
i386 | i386/i386/trap.c |
powerpc | powerpc/powerpc/trap.c |
riscv | riscv/riscv/trap.c |
To know more
The FreeBSD Operating System provides the Ports Collection to give users and administrators a simple way to install applications. It is possible to configure a port before the building and installation. PortOptsCLI (Port Options CLI) is an utility to customize ports options via a command line interface.
This is the manual, please refer to the README for Getting Started, Demo, and extra info.
PORTOPTSCLI(1) FreeBSD General Commands Manual PORTOPTSCLI(1)
NAME
portoptscli - port options CLI
SYNOPSIS
portoptscli [-h | -v]
DESCRIPTION
The portoptscli utility provides a command line interface to customize
interactively the options to build a port. The configuration consists of
a set of lists, checklist to enable or disable an option, radiolist to
select at the most one option. Some list is mandatory, at least one
option has to be active.
The following arguments are available:
-h Display options, a short description and exit.
-v Show version and exit.
The following keys are available at runtime:
a, ESC Quit without saving.
c Print short commands list.
d, PAGEDOWN
Fast next element, that is next list.
e, END Go to end.
h Specific port help, if pkg-help exists.
i Print port info: name, list number, total options number, if a
help file exists.
m Print all list titles.
n, DOWN
Next element.
p, UP Previous element.
q Save and quit.
r Reprint the current element.
s, SPACE
Enable or disable a checklist option. Select a radiolist option
possibly deselecting the previous active option.
t, HOME
Go to the top of the configuration and port info is reprinted.
u, PAGEUP
Fast previous element. That is previous list or restart the
current list if the current element is an option.
v Toggle verbose mode. Printed in verbose mode: option index, some
command at top and end configuration.
ENVIRONMENT
The following environment variable takes effect only on startup, other
options can override its setting.
PORTOPTSCLI_VERBOSE
Enable verbose mode if its value is "Y" or "YES".
EXIT STATUS
The portoptscli utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
ports(7)
AUTHORS
The portoptscli utility was written by Alfonso Sabato Siciliano
<asiciliano@FreeBSD.org>.
FreeBSD 14.0-CURRENT August 18, 2023 FreeBSD 14.0-CURRENT
The bsddialog project provides bsddialog and libbsddialog, an utility and a library to build TUI dialogs and widgets. The version 1.0 is out!
% git clone https://gitlab.com/alfix/bsddialog.git
% cd bsddialog
% make % ./bsddialog --msgbox "`./bsddialog --version`" 0 0
Version 1.0 Highlights
New features: dynamic exit codes, new environments variables, generic buttons, startup theme file, –datebox-format d/m/y | m/d/y | y/m/d, other escapes for –text-escape, comments in –save-theme output file.
Important changes: –generic-button1 -> –right1-button, –generic-button2 -> –right2-button, –no-names and –no-descriptions mutually exclusive.
The library has some API change (see CHANGELOG), feel free to contact me for any explanation.
CHANGELOG:
2023-08-01 Version 1.0
Utility:* add: comments to --save-theme output file.
* add: blink, halfbright, highlight to --save-theme and --load-theme.
* add: theme.menu.[f_]prefixcolor to --save-theme and --load-theme.
* add: --datebox-format <d/m/y|m/d/y|y/m/d> to set --datebox UI.
* add: --help-print-items (--help-status becomes alias).
* add: --text-escape (--colors becomes alias).
* add: new escapes \Zd, \Zk, \Zs, \ZD, \ZK, \ZS, for --text-escape.
* add: env NO_COLOR, to set blackwhite theme.
* add: $HOME/.bsddialog.conf startup theme file.
* add: env BSDDIALOG_THEMEFILE startup theme file.
* add: --left1-button <label>.
* add: --left2-button <label>.
* add: --left3-button <label>.
* add: --right1-button <label>.
* add: --right2-button <label>.
* add: --right3-button <label>.
* add: dynamic exit codes.
- add: --error-exit-code.
- add: --ok-exit-code.
- add: --cancel-exit-code.
- add: --help-exit-code.
- add: --extra-exit-code.
- add: --timeout-exit-code.
- add: --esc-exit-code.
- add: --left1-exit-code.
- add: --left2-exit-code.
- add: --left3-exit-code.
- add: --right1-exit-code.
- add: --right2-exit-code.
- add: --right3-exit-code.
- add: env BSDDIALOG_ERROR.
- add: env BSDDIALOG_OK.
- add: env BSDDIALOG_CANCEL.
- add: env BSDDIALOG_HELP.
- add: env BSDDIALOG_EXTRA.
- add: env BSDDIALOG_TIMEOUT.
- add: env BSDDIALOG_ESC.
- add: env BSDDIALOG_LEFT1.
- add: env BSDDIALOG_LEFT2.
- add: env BSDDIALOG_LEFT3.
- add: env BSDDIALOG_RIGHT1.
- add: env BSDDIALOG_RIGHT2.
- add: env BSDDIALOG_RIGHT3.* add: undocumented envs for bsdconfig(8) compatibility.
- env BSDDIALOG_COMPATRC for use_shadow setting.
- env BSDDIALOG_ITEM_HELP to add/set exit code.* change: rename themes --theme <3d|blackwhite|flat>.
* change: --no-names and --no-descriptions mutually exclusive (via lia).
* change: quote only checklist output items if necessary. Previously
also radiolist item.* change: dialogs with user input print always values except with ERROR,
ESC, Cancel. Previously the situation was quite heterogeneous.* improve: DIAGNOSTIC messages adding fmt string errors.
* improve: disable theme setting (opt and env) with no-color terminals.
* improve: menus on|off status (strcasecmp, diagnostic, real off check).
* improve: --bikeshed with button delimiter and --date-format.
* improve: --textbox accepts button options.
* improve: Forms with Help button.
- print "HELP" (like menus).
- accept --help-list-items.
- accept --help-print-name.* fix: --load-theme attributes.
* fix: --clear-screen with --and-dialog.
* delete: --theme <bsddialog> (partially implemented).
* delete: --esc-return-cancel (replaced by new env and option).
* delete: --generic-button1 (replaced by --right1-button).
* delete: --generic-button2 (replaced by --right2-button).
* refactor: modularize in more files (main, cli, builders, theme).
Library:* add: bsddialog_inmode().
* add: bsddialog_clear(y) for utility --clear-screen.
* add: bsddialog_refresh() for utility terminal mode options.
* add: conf.date.format="d/m/y"|"m/d/y"|"y/m/d" to customize
bsddialog_datebox() UI (boxes) with a date format.* add: 'const char *end' to bsddialog_gauge().
* add: draw focus on the shortcut-key-selected button at exit.
* add: escapes for conf.text.highlight \Zd, \Zk, \Zs, \ZD, \ZK, \ZS.
* add: other theme flags.
- BSDDIALOG_BLINK.
- BSDDIALOG_HALFBRIGHT.
- BSDDIALOG_HIGHLIGHT.* add: generic buttons.
- conf.button.left1_label, BSDDIALOG_LEFT1 return value.
- conf.button.left2_label, BSDDIALOG_LEFT2 return value.
- conf.button.left3_label, BSDDIALOG_LEFT3 return value.
- conf.button.right1.label, BSDDIALOG_RIGHT1 return value.
- conf.button.right2.label, BSDDIALOG_RIGHT2 return value.
- conf.button.right3.label, BSDDIALOG_RIGHT3 return value.* add: unused bsddialog_menugroup.min_on for future features.
* add: theme.menu.f_prefixcolor and theme.menu.prefixcolor.
* improve: check (when possible) API pointers.
* improve: circolar buttons with left and right keys for msgbox, yesno,
menus, rangebox and pause.* improve: bsddialog_textbox() handles conf.buttons.
* improve: bsddialog_datebox() a box change affects the others as well.
* improve: bsddialog_geterror() with fmt strings.
* change: API NULL strings handled like "", except gauge *sep and *end.
* change: menus and form less restrictive with text, hide text with
little screens (same behavior as other dialogs).* change: mixedgauge BSDDIALOG_MG_BLANK does not draw minibar but prints
minilabel. The change allows mixedgauge to add sections. To restore
the previous behavior setting minilabel to "".* change: check/set bsddialog_gauge() perc max 100.
* change: check/set bsddialog_mixedgauge() mainperc max 100.
* change: conf.menu.no_name and conf.menu.no_desc mutually exclusive.
* change: bsddialog_pause() sec -> *sec to know remaining time at exit.
* change: add *focusitem to bsddialog_form() like menus.
* change: "pointer" values are always set except when BSDDIALOG_ERROR
occurs. Examples *yy/*mm/*ss, rangebox *value.
- delete conf.menu.on_without_ok.
- delete conf.form.value_without_ok.* rename: conf.text.highlight -> conf.text.escape.
* rename: theme.menu.namesepcolor -> theme.menu.sepnamecolor.
* rename: theme.menu.descsepcolor -> theme.menu.sepdesccolor.
* fix: bsddialog_pause() elevation bar after resize.
* fix: bsddialog_textbox() key '0'.
* fix: timebox.c checksize (boxes width).
* fix: extend menurows after shrink and enlarge.
* fix: menu pad and form pad "re-expansion" after shrink and enlarge.
* fix: shadow top-left corner (trick wresize() before wmove()).
* fix: increment bsddialog_total_progview size for more general use.
* delete: BSDDIALOG_THEME_BSDDIALOG (partially implemented).
* delete: conf.button.generic1_label (for new conf.button.right1_label).
* delete: BSDDIALOG_GENERIC1 return value (new BSDDIALOG_RIGHT1).
* delete: conf.button.generic2_label (for new conf.button.right2_label).
* delete: BSDDIALOG_GENERIC2 return value (new BSDDIALOG_RIGHT2).
* delete: bsddialog_clearterminal(), replaced by bsddialog_clear(y).
* refactor: internal implementation.
- add: internal structures to represent components.
- merge: (when possible) dialogs autosize.
- merge: (when possible) dialogs checksize.
- merge: for each dialog "build" with "update" -> <dialog>_redraw().
- merge: new_dialog() with update_dialog() -> draw_dialog().
- merge: infobox.c with messagebox.c (delete infobox.c)
- merge: bsddialog_datebox() + bsddialog_calendar() -> datebox.c
- change: flat and blackwhite real themes, 3d adapted from flat.
- improve: replace wrefresh() -> wnoutrefresh()/doupdate().
- improve: replace prefresh() -> pnoutrefresh()/doupdate().
- improve: menu split code to build private items.
- improve: form split code to build private items. - delete: -Wno-implicit-fallthrough.
Extra Info
I’m back! The long medical treatment is over.
[End September 2022]
I was not able to hear in my right ear.
[October 2022]
After 3 days the situation worsened: acute vertigo and sensorineural
deafness (profound hearing loss) in one ear
(https://en.wikipedia.org/wiki/Sensorineural_hearing_loss#Sudden_sensorineural_hearing_loss),
without an identifiable cause, probably:
[October 2022 - January 2023]
I spent months with doctors (ENT, cardiologist,
neurologist, radiologist), in hospitals, clinics, emergency,
magnetic resonance imaging centre, hyperbaric chamber,
bed with nausea and vomit.
The therapy was: hyperbaric chamber [Monday - Friday], a lot of cortisone and more than 10 pills per day. The therapy finished in January with the end of the improvements, “fortunately” from ~90 db to ~50 db. I don’t hear voices (the problems remain https://www.hearingbest.com/hearing-loss-articles/the-special-problems-of-single-sided-deafness/) but I can try a hearing aid insead of a cochlear implant (https://en.wikipedia.org/wiki/Cochlear_implant).
[December 2022 - January 2023]
Obviously I was inactive: no code, no new project, no improvement, no commit,
no email.
A little something during the last time of medical treatment:
[February 2023 - June 2023]
New problem: sudden and severe tinnitus
(https://en.wikipedia.org/wiki/Tinnitus) in the “bad” ear.
It was a whistle and disturbed the understanding of voices even in the good ear.
Again the theray for several months. Fortunately tinnitus has become
“acceptable”, I always hear a noise like a fan or air conditioner,
not a whistle.
[Now]
A solution for tinnitus and sensorineural hearing loss does not exist.
I am looking for a good hearing care professional. 🦻🙂👂
Anyway I’m back in front of a computer! I have over 50,000 unread emails! I’ll probably never read them, sorry. You could resend your emails if they are important.
Finally I am restarting to code! Some new/update project is coming soon, stay tuned!
We have two ears, so we hear the world in stereo. Two ears give us a sense of distance and direction. Therefore, the FreeBSD Operating System provides and enables multichannel audio by default, popularly referred to as “surround sound”. Properly, by default only 2 channels are enabled: “s16le:2.0, Stereo, 2 channels (left, right)”.
Unfortunately, stereo audio is quite useless and annoying for a person with single sided deafness or unilateral hearing loss. Some utility allows to select mono, for example, vlc (port/package multimedia/vlc):
Not all utilities are so advanced. Fortunately, the FreeBSD Audio Subsystem is very powerful. It is possible to select mono for each device via:
# sysctl dev.pcm.%d.play.vchanformat="s16le:1.0"
where %d is a device number listed by:
$ sysctl dev.pcm
To automatically set the mode each time the machine boots (let’s say for the device number 3), add to /etc/sysctl.conf.
# Mono for device 3
dev.pcm.3.play.vchanformat=s16le:1.0
Laptops typically have two speakers (left and right). The speaker to “bad” ear can be annoying for people with unilateral hearing loss. Fortunately (again), the FreeBSD Audio Subsystem is very powerful. It is possible to set the volume for each speaker, for example, via mixertui (port/package audio/mixertui):
To save pressing ‘p’ key and to load/set after a reboot (without starting the TUI):
$ mixertui -p audio-profile.conf
Important. Refer to the sound(4) manual and the Sound Wiki Page to know more about FreeBSD audio features and customizations.
The bsddialog project provides bsddialog and libbsddialog, an utility and a library to build TUI dialogs and widgets. The version 0.4 is out!
This release provides mainly new features and changes to integrate bsddialog (utility) with scripts in FreeBSD BASE system. Finally, it is possible to install FreeBSD using BSD-Like licensed tools/code only (at least like a proof of concept).
CHANGELOG:
2022-09-24 Version 0.4
Utility:* add: --normal-screen to set normal mode.
* add: --alternate-screen to set alternate mode.
* add: --keep-tite as --alternate-screen alias.
* add: --and-dialog to build other dialogs.
* add: --and-widget as --and-dialog alias.
* add: --no-names (--no-tags becames its alias).
* add: --no-descriptions (--no-items becames its alias).
* add: --help-print-name (--help-tags becames its alias).
* add: --item-bottom-desc (--item-help becames its alias).
* add: --cr-wrap (was partially implemented) to keep '\n' with "\n".
* add: --text-unchanged to avoid default modification.
* add: --tab-escape enables "\t" in text.
* add: --clear-screen to clear the screen.
* add: --clear-dialog to clear the dialog (was --clear).
* add: --calendar dialog to select a date.
* add: DIAGNOSTICS messages for bad arguments number.
* add: DIAGNOSTICS messages for missing and unexpected options.
* change: --clear becames alias for --clear-screen.
* change: --print-maxsize format output.
* change: --menu, --radiolist, --checklist and --treeview output.
- no printed items with Cancel or ESC.
- --separator prints <sepstr> before each item except HELP.
- --separator and --separate-output print <sepstr> after each item.
- quoted item name/desc only when needed.
- --menu avoids to print selected item after focused HELP item.* change: text default modification.
- without a "\n": '\t' -> space, '\n' -> '\n', trim spaces.
- with a "\n": '\t' -> space, '\n' -> space, "\n" -> '\n', no trim.
- delete '\n' after "\n" (also with --cr-wrap).* change: --datebox input and output format yy/mm/dd -> dd/mm/yy.
* delete: --no-collapse (partially implemented).
* delete: --no-nl-expand (partially implemented).
* delete: --trim (partially implemented).
Library:* add: bsddialog_msgbox() HOME, END, PPAGE and NPAGE keys.
* add: bsddialog_yesno() HOME, END, PPAGE and NPAGE keys.
* add: bsddialog_menu() SPACE key (equivalent to ENTER).
* add: bsddialog_calendar() to select a date.
* change: rename enum bsddialog_grouptype -> enum bsddialog_menutype.
* change: fixed-menurows becames at most menurows (depending on text).
* change: fixed-rows becames at most rows, min(rows, screenH - shadow).
* change: fixed-cols becames at most cols, min(cols, screenW - shadow).
* delete: undocumented internal bsddialog_menuitem.depth factor (was 2).
Actually, version 0.4 is the completion of the integration process started with by the version 0.3 mainly in the library: cols/rows ratio, dynamic buttons margin, multi-column characters, form refactoring, etc.
2022-08-29 Version 0.3
Utility:* add: --textbox accepts options for the first button.
* add: --columns-per-row for text autosizing.
* add: --load-theme to read and set a custom theme at runtime.
* add: --save-theme to save current theme.
* add: --bikeshed for random settings.
* add: --switch-buttons to enable buttons/input widgets focus switching.
Available for: --form, --inputbox, --mixedform, --passwordform,
--passwordbox, --timebox and --datebox.* change: rename --esc-cancelvalue to --esc-return-cancel.
* change: form field value is printed like multibyte charachter string,
previously widechar string.* change: --timebox output with zero padding.
* change: --datebox output mm and dd with zero padding.
* fix: --hline with empty string.
* fix: avoid to overlay the backtitle by setting a top margin.
* fix: avoid to overlay down shadow with menus and forms bottomdesc
by setting a down margin.* fix: --form read-only flag with multiple fields.
Library:* add: conf.auto_topmargin and conf.auto_downmargin.
* add: bsddialog_textbox() accepts conf.button.* for the first button.
* add: bsddialog_textbox() arrows and percentage.
* add: conf.text.cols_per_row to set a ratio for text autosizing.
* add: timebox and datebox arrows and focus background for boxes.
* add: timebox and datebox UP key to switch focus.
* add: bsddialog_init_notheme() in bsddialog.h.
* add: bsddialog_hascolors() in bsddialog_theme.h.
* add: theme.form.bottomdesccolor and theme.menu.bottomdesccolor.
* add: conf.button.always_active to disable buttons/input-boxes switch.
* add: dynamic buttons margin.
- add: theme.button.minmargin and theme.button.maxmargin.
- delete: theme.button.hmargin.* add: Unicode.
- UI handles multicolumn charachters: backtitle, title,
text (word wrapping, autosizing), menus (shortcuts, name, desc),
forms (label, field), textbox, mixedgauge (minilabel),
buttons (label, shortcuts), bottomtitle.
- API handles char* arguments like multibyte charachter string,
depending on the current locale.
- Internally wide charachters are used to get input from keyboard
and to adapt word wrapping and dynamic text autosizing to
muticolumn charachters.* refactoring: (rewrite) form.c.
- delete: libformw dep implementing its features from scratch.
- delete: maxvaluelen >= valuelen constraint.
- delete: conf.form.enable_wchar, get always unicode (wchar) input.
- add: KEY_HOME, KEY_END, KEY_PPAGE, KEY_NPAGE keys in field.
- add: KEY_UP can move focus from buttons to fields.
- add: KEY_DOWN can move focus from item to buttons, if nitem is 1.
- add: conf.form.securembch secure multibyte charachter.
- add: BSDDIALOG_FIELDNOCOLOR for formitem.flags.
- add: BSDDIALOG_FIELDCURSOREND for formitem.flags.
- add: BSDDIALOG_FIELDEXTEND for formitem.flags.
- add: BSDDIALOG_FIELDSINGLEBYTE for formitem.flags.
- add: resizing and refresh after KEY_RESIZE (SIGWINCH).
- add: items scrolling.
- add: conf.form.value_wchar, value is wchar_t* instead of MB-char*.
- add: formheight autosizing.
- add: dynamic item position.* fix: bsddialog_gauge() with fd < 0.
* fix: bsddialog_gauge() refresh new text.
* fix: internal segmentation fault with disabled shadow.
* fix: center position without shadow.
* fix: bsddialog_infobox() with zero text length.
* fix: text wrapping with more than 1024 words.
* fix: rename theme.shadow.h to theme.shadow.y.
* fix: rename theme.shadow.w to theme.shadow.x.
* fix: menurows autosize with fixed rows improving text_size().
* fix: messagebox.c scrolling and checksize without text.
The version 0.4 is already in FreeBSD, it changed the utility heavily. The version 0.3 modified some well tested structural code in the library (mainly word wrapping and text auto-sizing). So I need a while to test and to change the OS to use the new features. Actually the changes are small and very simple but they are used by tens of thousands of lines of code, so again I need a while to test.
However, I changed the last CURRENT iso FreeBSD-14.0-CURRENT-amd64-20220930-42dc8696df5-258315-bootonly.iso to test bsddialog and bsdinstall with bhyve on my laptop. The result is: It is possible to install FreeBSD using BSD-Like licensed code only!
Some screenshot:
Partitioning:
Extract BASE items:
Select Date:
Complete installation!
To know more:
The FreeBSD 1q2022 status report is online!
My contribution is PortConfig, a new TUI utility to select port options: https://www.freebsd.org/status/report-2022-01-2022-03/#_portconfig.
To know more:
Happy Hacking!
The BSDDialog utility builds TUI dialogs and widgets. This is the manual page, for an introduction and examples https://gitlab.com/alfix/bsddialog.
BSDDIALOG(1) FreeBSD General Commands Manual BSDDIALOG(1)
NAME
bsddialog - TUI dialogs
SYNOPSIS
bsddialog --help | --version
bsddialog [--option] --dialog text rows cols [dialog-argument] [--option]
bsddialog ... --dialog1 ... [--and-dialog --dialog2 ...] ...
DESCRIPTION
The bsddialog utility builds Text User Interface dialogs and widgets.
The option --help prints a brief list of features and exits. The option
--version prints the version and exits. The option --and-dialog builds
another dialog unless the previous one returns Error, ESC or Cancel.
Each dialog accepts text to print a message inside, rows and cols to set
height and width, 0 for autosize and -1 for fullscreen.
The possible input from the user interface is printed to standard error
at exit.
Options
The following options can change the default behavior of the utility and
are common to some dialog.
--alternate-screen
If available set alternate screen mode, see terminfo(5).
--ascii-lines
Ascii characters to draw lines.
--backtitle backtitle
Screen title.
--begin-x x
Set dialog horizontal position, -1 center, 0 left screen.
--begin-y y
Set dialog vertical position, -1 center, 0 top screen.
--bikeshed
Random settings. Colors, title delimiter, button delimiter; see
theme features. Title margin. Buttons always active or TAB to
switch focus with other components, see --switch-buttons. Zero
padding with time output; see --time-format. Zero padding with
date output; see --date-format. User Interface date format for
--datebox; see --datebox-format.
--cancel-exit-code retval
Set an exit code value for the "Cancel" button.
--cancel-label label
Label for the "Cancel" button.
--clear-dialog
Hide the dialog at exit.
--clear-screen
Clear the screen, wait a dialog if built.
--columns-per-row columns
Try to set the number of columns for a row of text with
autosizing; default 10.
--cr-wrap
Keep new line in text also if it constains a "\n", see
--text-unchanged.
--datebox-format format
String to customize --datebox interface, possible values:
"d/m/y", "m/y/d", "y/m/d".
--date-format format
String accepted by strftime(3) to customize the output of
--datebox and --calendar.
--default-button label
Focus on the button with label on startup.
--default-item name
Focus on the item with name, for Checklist, Menu, Radiolist and
Treeview.
--default-no
Focus on "Cancel" or "No" button on startup.
--disable-esc
Disable ESC key to quit.
--error-exit-code retval
Set an exit code value for the bsddialog errors.
--esc-exit-code retval
Set an exit code value for the ESC key.
--extra-button
Add a button with "Extra" label.
--extra-exit-code retval
Set an exit code value for the "Extra" button.
--extra-label label
Set label for the "Extra" button.
--left1-button label
Add a button with label.
--left1-exit-code retval
Set an exit code for --left1-button.
--left2-button label
Add a button with label.
--left2-exit-code retval
Set an exit code for --left2-button.
--left3-button label
Add a button with label.
--left3-exit-code retval
Set an exit code for --left3-button.
--help-button
Add a button with "Help" label.
--help-exit-code retval
Set an exit code value for the "Help" button.
--help-label label
Set label for "Help" button.
--help-print-items
Print also the selected items or form values if the "Help" button
is pressed.
--help-print-name
Print the name of the focused item if the "Help" button is
pressed also with --item-bottom-desc.
--hfile filename
Open filename in a Textbox if F1 key is pressed.
--hline string
Dialog subtitle.
--hmsg string
Open a Msgbox with string if the F1 key is pressed.
--ignore
Do not exit with unknown options.
--insecure
Print `*' to hide passwords while typing, white space otherwise.
--item-bottom-desc
Set a help string for each item of a Checklist, Form, Menu,
Mixedform, Passwordform, Radiolist and Treeview to display at the
bottom screen side.
--item-depth
Specify a margin for items, available for Checklist, Menu and
Radiolist.
--item-prefix
Set a string to prefix each item of a Checklist, Menu, Radiolist
or Treeview.
--load-theme file
Load theme from file.
--max-input size
Maximum length of the input for --inputbox and --passwordbox,
default 2048.
--no-cancel
Do not show "Cancel" button.
--no-descriptions
Do not display items desciption, for Checklist, Menu, Radiolist
or Treeview; mutually exclusive with --no-names.
--no-lines
Do not draw borders and lines.
--no-names
Do not display items name, for Checklist, Menu and Radiolist;
mutually exclusive with --no-descriptions.
--no-ok
Do not draw "OK" button.
--no-shadow
No not draw the shadow of the dialog.
--ok-label label
Set label for "OK" button.
--ok-exit-code retval
Set an exit code value for the "Ok" button.
--normal-screen
If available set normal screen mode, see terminfo(5).
--output-fd fd
Print input from user interface to the specified file descriptor.
--output-separator sep
Set a sepator for the items in output, default white space.
--print-maxsize
Screen size. This option can be used without a dialog.
--print-size
Print dialog height and width at exit.
--print-version
Print version. This option can be used without a dialog.
--quoted
Quote items in output, default only when necessary.
--right1-button label
Add a button with label.
--right1-exit-code retval
Set an exit code for --right1-button.
--right2-button label
Add a button with label.
--right2-exit-code retval
Set an exit code for --right2-button.
--right3-button label
Add a button with label.
--right3-exit-code retval
Set an exit code for --right3-button.
--save-theme file
Save the current theme. This option can be used without a
dialog.
--separate-output
Print selected items separated by a new line and avoid to quote.
--shadow
Show a shadow for the dialog, enabled by default.
--single-quoted
Use single quote for items in output.
--sleep secs
Wait secs seconds to close the dialog.
--stderr
Print input from user interface to standand error, default.
--stdout
Print input from user interface to standard output.
--switch-buttons
Enable focus switching between buttons and input components
pressing TAB, otherwise buttons are always active and ENTER key
closes the dialog. Suitable for: --form, --inputbox,
--mixedform, --passwordbox, --passwordform, --timebox, --calendar
and --datebox.
--tab-escape
Replace "\t" with a tab in text.
--tab-len spaces
Number of spaces to print a TAB in text.
--text-escape
Enable escapes in text:
"\Z0" black.
"\Z1" red.
"\Z2" green.
"\Z3" yellow.
"\Z4" blue.
"\Z5" magenta.
"\Z6" cyan.
"\Z7" white.
"\Zb" bold.
"\ZB" disable bold.
"\Zd" Half bright.
"\ZD" disable half bright.
"\Zk" Blink.
"\ZK" disable blinking.
"\Zr" reverse foreground and background.
"\ZR" disable reverse.
"\Zs" Highlight.
"\ZS" disable highlighting.
"\Zu" underline.
"\ZU" disable underline.
"\Zn" disable each customization.
--text-unchanged
Disable text modification. By default text is changed before to
be printed in the dialog. If it contains at least a "\n" each
new line and TAB is converted to a space, subsequent spaces are
merged. Otherwise new line characters are preserved and a TAB
becomes a space.
--theme theme
Set theme, possible values: "3d", "blackwhite", "flat".
--time-format format
String accepted by strftime(3) to customize the output of
--timebox.
--timeout-exit-code retval
Set an exit code value for the --pause timeout.
--title title
Dialog title.
Dialogs
The following dialogs are available:
--calendar text rows cols [day month year]
Dialog to select a date.
--checklist text rows cols menurows [name desc status] ...
Checklist to select some item from a list via the SPACE key. An
item has a name, desc and a default status specified by "on" or
"off". The names of the selected items are printed to standard
error. menurows is the graphical height of the list, 0 for
autosize.
--datebox text rows cols [day month year]
Dialog to select a date.
--form text rows cols formrows [label ylabel xlabel init yfield xfield
fieldlen maxletters] ...
Dialog to get a list of strings via forms. A form has a label at
the position ylabel and xlabel, a field to get the input at the
position yfield and xfield with graphical length fieldlen,
maxletters is the maximum input length. The field can be
customized, if fieldlen is negative the field is read only and
its absolute value is the field length. If maxletters is 0 it is
the absolute value of fieldlen. init is a default value.
formrows is the graphical height of the list, 0 for autosize.
--gauge text rows cols [percentage]
Dialog with a bar to shows percentage, then it waits to read
"XXX" from the standard input, then the first string replaces
percentage and the following strings replace text until the next
"XXX", the loop ends reading "EOF".
--infobox text rows cols
Dialog without buttons to display a message and to exit
immediately.
--inputbox text rows cols [init]
Dialog to get a string in input, init is the default value.
--menu text rows cols menurows [name desc] ...
Builds a menu to select an item from a list, Space key is
equivalent to Enter. An item has a name and a desc. The name of
the selected item is printed to standard error. menurows is the
graphical height of the list, 0 for autosize.
--mixedform text rows cols formrows [label ylabel xlabel init yfield
xfield fieldlen maxletters flag] ...
Dialog to get a list of strings via forms. A form has a label at
the position ylabel and xlabel, a field to get the input with
graphical length fieldlen at the position yfield and xfield,
maxletters is the maximum input length, init is a default value,
flag can be 0 for normal field, 1 to hide the typed characters
and 2 to set the field read only. formrows is the graphical
height of the list, 0 for autosize.
--mixedgauge text rows cols mainperc [minilabel miniperc] ...
Dialog to show a main bar to represent mainperc from 0 to 100.
Some mini bar with a minilabel string and a miniperc with a value
from 0 and 100 or negative to print a descriptive string: -1
"Succeeded", -2 "Failed", -3 "Passed", -4 "Completed", -5
"Checked", -6 "Done", -7 "Skipped", -8 "In Progress", -9 to hide
miniperc, -10 "N/A", -11 "Pending", otherwise "UNKNOWN".
--msgbox text rows cols
Dialog to diplay a message without the "Cancel" button. UP,
DOWN, HOME, END, PAGEUP and PAGEDOWN keys are availble to scroll
the text.
--passwordbox text rows cols [init]
Dialog to get a password, init is the default value.
--passwordform text rows cols formrows [label ylabel xlabel init yfield
xfield fieldlen maxletters] ...
Dialog to get a list of passwords, equivalent to --form except
typed characters are hidden.
--pause text rows cols seconds
Dialog runs until seconds timeout expires or a button is pressed.
--radiolist text rows cols menurows [name desc status] ...
Radiolist to select at most an item from a list via the SPACE
key. An item has a name, desc and a default status specified by
"on" or "off". The name of the selected item is printed to
standard error. menurows is the graphical height of the list, 0
for autosize.
--rangebox text rows cols min max [init]
Dialog to select a value between min and max, init is the default
value, the keys UP, DOWN, HOME, END, PAGEUP and PAGEDOWN can
change it.
--textbox file rows cols
Opens and prints file. UP, DOWN, LEFT, RIGHT, HOME, END, PAGEUP
and PAGEDOWN keys are available to navigate the file, TAB changes
button. "OK" button is renamed "EXIT".
--timebox text rows cols [hour min sec]
Dialog to select a time.
--treeview text rows cols menurows [depth name desc status] ...
Equivalent to Radiolist with --item-depth and --no-name.
--yesno text rows cols
"Yes-No Question", "OK" and "Cancel" buttons are renamed "Yes"
and "No". UP, DOWN, HOME, END, PAGEUP and PAGEDOWN keys are
availble to scroll the text.
ENVIRONMENT
The following environment variables take effect only on startup, other
options can override their setting.
NO_COLOR
If present and not an empty string (regardless of its value)
equivalent to --theme blackwhite.
BSDDIALOG_ERROR, BSDDIALOG_OK, BSDDIALOG_CANCEL, BSDDIALOG_HELP,
BSDDIALOG_EXTRA, BSDDIALOG_TIMEOUT, BSDDIALOG_ESC,
BSDDIALOG_LEFT1, BSDDIALOG_LEFT2, BSDDIALOG_LEFT3,
BSDDIALOG_RIGHT1, BSDDIALOG_RIGHT2, BSDDIALOG_RIGHT3
Set exit codes.
BSDDIALOG_THEMEFILE file
Equivalent to --load-theme file.
FILES
The theme file $HOME/.bsddialog.conf is read on startup if exists.
EXIT STATUS
The bsddialog utility exits 255 on unsuccessful, otherwise depending on
the button or key pressed the following values can be returned:
0 "OK", "Yes" or "Exit" button.
1 "Cancel" or "No" button.
2 "Help" button.
3 "Extra" button.
4 Timeout.
5 ESC key.
6 Left1 generic button.
7 Left2 generic button.
8 Left3 generic button.
9 Right1 generic button.
10 Right2 generic button.
11 Right2 generic button.
EXAMPLES
Backtitle, title and message:
bsddialog --backtitle MESSAGE --title Msgbox --msgbox Message 0 0
Yes-No Question and theme:
bsddialog --theme blackwhite --yesno Question 10 30
Save a custom theme:
bsddialog --save-theme mytheme.txt --infobox "Saving theme..." 0 0
Load a custom theme:
bsddialog --load-theme mytheme.txt --infobox "Custom theme" 0 0
Checklist:
bsddialog --checklist Checklist 0 0 3 N1 D1 off N2 D2 on N3 D3 off
Form:
bsddialog --form Form 0 0 0 L1: 0 0 X 0 4 20 25 L2: 1 0 Y 1 4 20 25
Multi-dialog:
bsddialog --normal-screen --begin-y 1 --yesno Continue? 0 0 \
--and-dialog --begin-y 10 --infobox Yes 0 0
Bikeshed:
bsddialog --bikeshed --inputbox Example 0 0
bsddialog --bikeshed --datebox Example 0 0
Mixedgauge:
bsddialog --sleep 3 --mixedgauge Example 10 30 60 L1 " -1" L2 30
Mixedgauge script:
perc=0
while [ $perc -le 100 ]
do
bsddialog --sleep 1 --title Mixedgauge \
--mixedgauge "\nExample...\n" 0 0 $perc \
"Hidden" " -9" \
"Label 1" " -4" \
"Label 2" " -4" \
"Label 3" $perc
perc=`expr $perc + 20`
done
Gauge script:
i=1
for c in A B C D E F G H
do
sleep 1
echo XXX
echo "$(expr $(expr $i "*" 100) "/" 8)"
echo "[$i/8] Char: $c"
echo XXX
if [ $i -eq 8 ]
then
sleep 1
echo EOF
fi
i=`expr $i + 1`
done | bsddialog --title Gauge --gauge "Starting..." 10 70
COMPATIBILITY
Outdated options are retained for compatibility, properly equivalent
options are used:
Obsolete Equivalent
--and-widget --and-dialog
--calendar <text> 2 <cols> --calendar <text> 0 <cols>
--clear --clear-screen
--colors --text-escape
--defaultno --default-no
--exit-label --ok-label
--help-status --help-print-items
--help-tags --help-print-name
--item-help --item-bottom-desc
--keep-tite --alternate-screen
--no-items --no-descriptions
--no-label --cancel-label
--no-tags --no-names
--nocancel --no-cancel
--nook --no-ok
--separator --output-separator
--yes-label --ok-label
SEE ALSO
bsddialog(3), strftime(3), terminfo(5)
HISTORY
The bsddialog utility first appeared in FreeBSD 14.0.
AUTHORS
bsddialog was written by Alfonso Sabato Siciliano
<asiciliano@FreeBSD.org>.
bsddialog provides also a subset of the functionality described in the
dialog manual. The following features were reimplemented:
Options: --and-widget, --ascii-lines, --backtitle, --cancel-label,
--clear, --colors, --cr-wrap, --date-format, --defaultno,
--default-button, --default-no, --default-item, --exit-label,
--extra-button, --extra-label, --help, --help-button, --help-label,
--help-status, --help-tags, --hfile, --hline, --ignore, --insecure,
--item-help, --keep-tite, --max-input, --no-cancel, --nocancel,
--no-items, --no-label, --no-lines, --no-ok, --nook, --no-shadow,
--no-tags, --ok-label, --output-fd, --output-separator, --print-maxsize,
--print-size, --print-version, --quoted, --separate-output, --separator,
--shadow, --single-quoted, --sleep, --stderr, --stdout, --tab-len,
--time-format, --title, --version, --yes-label.
Dialogs: --calendar, --checklist, --form, --gauge, --infobox, --inputbox,
--menu, --mixedform, --mixedgauge, --msgbox, --passwordbox,
--passwordform, --pause, --radiolist, --rangebox, --textbox, --timebox,
--treeview, --yesno.
Some feature differs in input, output, or behavior. Compatibility is not
a priority for future development.
THANKS TO
Baptiste Daroussin <bapt@FreeBSD.org>,
Ed Maste <emaste@FreeBSD.org>,
Juraj Lutter <otis@FreeBSD.org> and
Trenton Schulz for suggestions, help, and testing.
FreeBSD 14.0-CURRENT July 25, 2023 FreeBSD 14.0-CURRENT
LibBSDDialog provides an API to build TUI dialogs and widgets to show messages, to get input and to inform about a computation status.
Example to build a msgbox with Hello World!:
#include <bsddialog.h>
int main()
{
struct bsddialog_conf conf;
();
bsddialog_init(&conf);
bsddialog_initconf(&conf, "Hello World!", 8, 20);
bsddialog_msgbox();
bsddialog_end
return (0);
}
Of course, it is possible to get user input and to change the UI, “Yes-No Question” example:
#include <bsddialog.h>
#include <bsddialog_theme.h>
#include <stdio.h>
int main()
{
int output;
struct bsddialog_conf conf;
();
bsddialog_init(BSDDIALOG_THEME_BSDDIALOG);
bsddialog_set_default_theme
(&conf);
bsddialog_initconf.title = " yesno ";
conf.text.highlight = true;
conf= bsddialog_yesno(&conf, "\nHello \\Z3World\\Zn!", 10, 30);
output
();
bsddialog_end
switch (output) {
case BSDDIALOG_YES:
("YES\n");
printfbreak;
case BSDDIALOG_NO:
("NO\n");
printfbreak;
}
return (0);
}
And to show computation status:
To compile the examples:
% git clone https://gitlab.com/alfix/bsddialog.git
% cd bsddialog
% make
% cc -I./lib example.c -o example -L./lib -lbsddialog -Wl,-rpath=./lib % ./example
Dialogs and widgets:
Documentation:
The library has a manual to describe the API
% man ./lib/bsddialog.3
and a collection of examples in the Public Domain to build new projects
% cd examples_library
% sh compile
% ./datebox
% ./form
% ./infobox
% ./menu
% ./mixedlist
% ./msgbox
% ./pause
% ./radiolist
% ./rangebox
% ./theme
% ./timebox % ./yesno
LibBSDDialog is an open source project released under the term of the BSD 2 Clause License, repository: https://gitlab.com/alfix/bsddialog.
Happy Coding!
The libBSDDialog library provides an API to build TUI dialogs and widgets. This is the manual page, for an introduction and examples https://gitlab.com/alfix/bsddialog.
BSDDIALOG(3) FreeBSD Library Functions Manual BSDDIALOG(3)
NAME
bsddialog_backtitle, bsddialog_calendar, bsddialog_clear,
bsddialog_color, bsddialog_color_attrs, bsddialog_checklist,
bsddialog_datebox, bsddialog_end, bsddialog_form, bsddialog_gauge,
bsddialog_geterror, bsddialog_get_theme, bsddialog_hascolors,
bsddialog_infobox, bsddialog_init, bsddialog_init_notheme,
bsddialog_initconf, bsddialog_inmode, bsddialog_menu,
bsddialog_mixedgauge, bsddialog_mixedlist, bsddialog_msgbox,
bsddialog_pause, bsddialog_radiolist, bsddialog_rangebox,
bsddialog_refresh, bsddialog_set_theme, bsddialog_set_default_theme,
bsddialog_textbox, bsddialog_timebox, bsddialog_yesno - TUI dialogs
LIBRARY
library "libbsddialog"
SYNOPSIS
#include <bsddialog.h>
int
bsddialog_backtitle(struct bsddialog_conf *conf, const char *backtitle);
int
bsddialog_calendar(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int *year, unsigned int *month,
unsigned int *day);
int
bsddialog_checklist(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int menurows, unsigned int nitems,
struct bsddialog_menuitem *items, int *focusitem);
void
bsddialog_clear(unsigned int y);
int
bsddialog_datebox(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int *year, unsigned int *month,
unsigned int *day);
int
bsddialog_end(void);
int
bsddialog_form(struct bsddialog_conf *conf, const char *text, int rows,
int cols, unsigned int formrows, unsigned int nitems,
struct bsddialog_formitem *items, int *focusitem);
int
bsddialog_gauge(struct bsddialog_conf *conf, const char *text, int rows,
int cols, unsigned int perc, int fd, const char *sep,
const char *end);
const char *
bsddialog_geterror(void);
int
bsddialog_infobox(struct bsddialog_conf *conf, const char *text,
int rows, int cols);
int
bsddialog_init(void);
int
bsddialog_init_notheme(void);
bool
bsddialog_inmode(void);
int
bsddialog_initconf(struct bsddialog_conf *conf);
int
bsddialog_menu(struct bsddialog_conf *conf, const char *text, int rows,
int cols, unsigned int menurows, unsigned int nitems,
struct bsddialog_menuitem *items, int *focusitem);
int
bsddialog_mixedgauge(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int mainperc, unsigned int nminibars,
char **minilabels, int *minipercs);
int
bsddialog_mixedlist(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int menurows, unsigned int ngroups,
struct bsddialog_menugroup *groups, int *focuslist, int *focusitem);
int
bsddialog_msgbox(struct bsddialog_conf *conf, const char *text, int rows,
int cols);
int
bsddialog_pause(struct bsddialog_conf *conf, const char *text, int rows,
int cols, unsigned int *seconds);
int
bsddialog_radiolist(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int menurows, unsigned int nitems,
struct bsddialog_menuitem *items, int *focusitem);
int
bsddialog_rangebox(struct bsddialog_conf *conf, const char *text,
int rows, int cols, int min, int max, int *value);
void
bsddialog_refresh(void);
int
bsddialog_textbox(struct bsddialog_conf *conf, const char *file,
int rows, int cols);
int
bsddialog_timebox(struct bsddialog_conf *conf, const char *text,
int rows, int cols, unsigned int *hh, unsigned int *mm,
unsigned int *ss);
int
bsddialog_yesno(struct bsddialog_conf *conf, const char *text, int rows,
int cols);
#include <bsddialog_theme.h>
int
bsddialog_color(enum bsddialog_color foreground,
enum bsddialog_color background, unsigned int flags);
int
bsddialog_color_attrs(int color, enum bsddialog_color *foreground,
enum bsddialog_color *background, unsigned int *flags);
int
bsddialog_get_theme(struct bsddialog_theme *theme);
bool
bsddialog_hascolors(void);
int
bsddialog_set_default_theme(enum bsddialog_default_theme theme);
int
bsddialog_set_theme(struct bsddialog_theme *theme);
DESCRIPTION
The bsddialog library provides an API to build Text User Interface
dialogs and widgets.
bsddialog_init() initializes the library, the only functions that can be
called before is bsddialog_initconf() described later. After the
initialization the input and output should be handled via the library
API.
bsddialog_init_notheme() is equivalent to bsddialog_init() except it does
not set the default graphical theme; see Theme subsection to set a theme
explicitly.
bsddialog_end() restores the screen like before bsddialog_init(). After
the call is not possible to use the library functions.
bsddialog_inmode() returns true after bsddialog_init() or
bsddialog_init_notheme() and before bsddialog_end(), false otherwise.
bsddialog_backtitle() prints backtitle on the top of the screen. The
function handles conf.ascii_lines and conf.no_lines described later.
bsddialog_error() returns a string to describe the last error. The
function should be called after a BSDDIALOG_ERROR returned value.
bsddialog_clear() clears the screen from y.
bsddialog_refresh() useful to refresh the screen after a terminal mode
change, see terminfo(5).
Dialogs
The dialogs have common arguments. text is a string printed inside the
dialog. Each char* parameter can be a multibyte character string
depending on current locale, see setlocale(3). rows and cols are height
and width, their value can be a fixed size, BSDDIALOG_AUTOSIZE or
BSDDIALOG_FULLSCREEN. conf is a struct to customize the current dialog,
it does not set global properties to the library.
struct bsddialog_conf {
bool ascii_lines;
unsigned int auto_minheight;
unsigned int auto_minwidth;
unsigned int auto_topmargin;
unsigned int auto_downmargin;
const char *bottomtitle;
bool clear;
int *get_height;
int *get_width;
bool no_lines;
bool shadow;
unsigned int sleep;
const char *title;
int y;
int x;
struct {
bool enable_esc;
const char *f1_file;
const char *f1_message;
} key;
struct {
unsigned int cols_per_row;
bool escape;
unsigned int tablen;
} text;
struct {
bool align_left;
bool no_desc;
bool no_name;
bool shortcut_buttons;
} menu;
struct {
char securech;
char *securembch;
bool value_wchar;
} form;
struct {
const char *format;
} date;
struct {
bool always_active;
const char *left1_label;
const char *left2_label;
const char *left3_label;
bool without_ok;
const char *ok_label;
bool with_extra;
const char *extra_label;
bool without_cancel;
const char *cancel_label;
bool default_cancel;
bool with_help;
const char *help_label;
const char *right1_label;
const char *right2_label;
const char *right3_label;
const char *default_label;
} button;
};
conf.ascii_lines ascii characters to draw lines, default wide characters.
conf.auto_minheight minimum height if rows is BSDDIALOG_AUTOSIZE.
conf.auto_minwidth minimum width if cols is BSDDIALOG_AUTOSIZE.
conf.auto_topmargin top margin if rows is BSDDIALOG_AUTOSIZE or
BSDDIALOG_FULLSCREEN, conf.y has to be BSDDIALOG_CENTER.
conf.auto_downmargin down margin if rows is BSDDIALOG_AUTOSIZE or
BSDDIALOG_FULLSCREEN.
conf.bottomtitle dialog subtitle.
conf.clear hide the dialog at exit.
conf.get_height if not NULL is set like the dialog height.
conf.get_width if not NULL is set like the dialog width.
conf.no_lines not draw lines.
conf.shadow draw shadow.
conf.sleep wait before to return, the value is in seconds.
conf.title dialog title.
conf.y dialog vertical position, 0 is top screen, can be
BSDDIALOG_CENTER.
conf.x dialog horizontal position, 0 is left screen, can be
BSDDIALOG_CENTER.
conf.key.enable_esc enable ESC key to close the dialog.
conf.key.f1_file open a file in a textbox if F1 is pressed.
conf.key.f1_message build a msgbox with message if F1 is pressed.
conf.text.cols_per_row Try to set the number of columns for a row of text
with autosizing, default 10.
conf.text.escape enable escapes in text:
"\Z0" black.
"\Z1" red.
"\Z2" green.
"\Z3" yellow.
"\Z4" blue.
"\Z5" magenta.
"\Z6" cyan.
"\Z7" white.
"\Zb" bold.
"\ZB" disable bold.
"\Zd" Half bright.
"\ZD" disable half bright.
"\Zk" Blink.
"\ZK" disable blinking.
"\Zr" reverse foreground and background.
"\ZR" disable reverse.
"\Zs" Highlight.
"\ZS" disable highlighting.
"\Zu" underline.
"\ZU" disable underline.
"\Zn" disable each customization.
conf.text.tablen tab length for text argument and bsddialog_textbox()
function.
conf.button.always_active buttons always active, avoiding focus switch
between buttons and input fields or input boxes in bsddialog_form(),
bsddialog_datebox(), bsddialog_calendar() and bsddialog_timebox().
conf.button.left1_label add a button with the specified label.
conf.button.left2_label add a button with the specified label.
conf.button.left3_label add a button with the specified label.
conf.button.without_ok disable OK button.
conf.button.ok_label set label for OK button.
conf.button.with_extra add Extra button.
conf.button.extra_label set a label for Extra button.
conf.button.without_cancel disable Cancel button.
conf.button.cancel_label sets a label for Cancel button.
conf.button.default_cancel on startup focus on the Cancel button.
conf.button.with_help add Help button.
conf.button.help_label set a label for Help button.
conf.button.right1_label add a button with the specified label.
conf.button.right2_label add a button with the specified label.
conf.button.right3_label add a button with the specified label.
conf.button.default_label focus on the button with the specified label.
bsddialog_initconf() initializes conf disabling each property, except
conf.shadow to true, conf.y and conf.x to BSDDIALOG_CENTER,
conf.text.cols_per_row to 10.
bsddialog_calendar() builds a dialog to select a date. year, month, and
day are default values on startup, selected date at exit.
bsddialog_checklist() builds dialogs to select some item from a list via
the SPACE key, can be customized by conf.menu.*. See bsddialog_menu().
bsddialog_datebox() builds a dialog to select a date. year, month, and
day are default values on startup, selected date at exit. The function
can be customized by:
conf.date.format date format user interface, possible values: "d/m/y",
"m/d/y", "y/m/d".
bsddialog_form() builds a dialog to display an array of items of nitems
elements to get input strings. formrows is the graphical height for the
items inside the dialog, 0 for autosizing. If not NULL focusitem is the
default item index on startup and the last focused item at exit, a
negative value if no item is focused. An item is defined like:
struct bsddialog_formitem {
const char *label;
unsigned int ylabel;
unsigned int xlabel;
const char *init;
unsigned int yfield;
unsigned int xfield;
unsigned int fieldlen;
unsigned int maxvaluelen;
char *value;
unsigned int flags;
const char *bottomdesc;
};
label is a string to describe the request at the position ylabel and
xlabel. The field for the input is at the position yfield and xfield,
fieldlen is its graphical width, while maxvalelen is the maximum number
of characters of the input string. init is the default field value. If
no error occurs value is the allocated memory with the current field
string at exit, its size depends on the current locale. flags is an OR
value to set the field: BSDDIALOG_FIELDHIDDEN, BSDDIALOG_FIELDREADONLY,
BSDDIALOG_FIELDNOCOLOR, BSDDIALOG_FIELDCURSOREND, BSDDIALOG_FIELDEXTEND,
BSDDIALOG_FIELDSINGLEBYTE. bottomdesc is printed at bottom screen if the
item is focused.
bsddialog_form() can be customized by:
conf.form.securech charachter to hide the input with
BSDDIALOG_FIELDHIDDEN.
conf.form.securembch multibyte charachter to hide the input with
BSDDIALOG_FIELDHIDDEN, conf.form.securech is ignored.
conf.form.value_wchar the allocated value is a wchar_t* string.
bsddialog_gauge() builds a dialog with a bar to show perc. If the file
descriptor fd is greater or equal to 0 the dialog waits to read sep from
it, then the first string replaces perc and the following strings replace
text until the next sep, the loop ends reading end.
bsddialog_infobox() builds a dialog without buttons and returns
instantly.
bsddialog_menu() builds a dialog to select an item from a list via SPACE
or ENTER. An item is defined like:
struct bsddialog_menuitem {
const char *prefix;
bool on;
unsigned int depth;
const char *name;
const char *desc;
const char *bottomdesc;
};
prefix, name and desc are printed at the item row. bottomdesc is printed
at bottom screen if the item is focused. depth is a margin between
prefix and name. At exit on is set to true if the item is selected,
false otherwise. items is an array of items of nitem elements. menurows
is the graphical height of the list inside the dialog, if cols is
BSDDIALOG_AUTOSIZE menurows specifies a maximum value. if not NULL
focusitem is the default item index on startup and the last focused item
at exit, a negative value if no item is focused.
bsddialog_checklist(), bsddialog_menu(), bsddialog_mixedlist() and
bsddialog_radiolist() can be customized by:
conf.menu.align_left align items to left, default center.
conf.menu.no_desc hide items description.
conf.menu.no_name hide items name, mutually exclusive with
conf.menu.no_desc.
conf.menu.shortcut_buttons enable shortcut keys on buttons, default on
items.
bsddialog_mixedgauge() builds a dialog with a main bar with the mainperc
percentage and nminibars each one with a minilabel and a miniperc.
miniperc can be: a positive value to print a bar with a percentace, a
negative constant BSDDIALOG_MG_SUCCEEDED, BSDDIALOG_MG_FAILED,
BSDDIALOG_MG_PASSED, BSDDIALOG_MG_COMPLETED, BSDDIALOG_MG_CHECKED,
BSDDIALOG_MG_DONE, BSDDIALOG_MG_SKIPPED, BSDDIALOG_MG_INPROGRESS,
BSDDIALOG_MG_BLANK to hide miniperc, BSDDIALOG_MG_NA,
BSDDIALOG_MG_PENDING to print a descriptive string, otherwise "UNKNOWN"
is printed.
bsddialog_mixedlist() builds a dialog with collections of checklists,
radiolists and separators. A collection is a set defined like:
enum bsddialog_menutype {
BSDDIALOG_CHECKLIST,
BSDDIALOG_RADIOLIST,
BSDDIALOG_SEPARATOR,
};
struct bsddialog_menugroup {
enum bsddialog_menutype type;
unsigned int nitems;
struct bsddialog_menuitem *items;
unsigned int min_on; /* unused for now */
};
groups is an array of sets of ngroups elements. menurows is the
graphical height size for the list. If not NULL, focuslist and focusitem
specify the default item on startup and the last focused item at exit,
could be a negative value if no item is focused. The dialog can be
customized by conf.menu.*, see bsddialog_menu().
bsddialog_msgbox() builds a dialog with OK button.
bsddialog_pause() builds a dialog waiting until the timeout in seconds
expires or a button is pressed. At exit seconds is set like remaining
time.
bsddialog_radiolist() builds dialogs to select at most an item from a
list via the SPACE key, can be customized by conf.menu.*. See
bsddialog_menu().
bsddialog_rangebox() to select a value between min and max. value is the
default value on startup and the selected value at exit. The current
value is printed inside a bar, the keys UP, DOWN, HOME, END, PAGEUP and
PAGEDOWN can change it.
bsddialog_textbox() opens and prints file. UP, DOWN, LEFT, RIGHT, HOME,
END, PAGEUP and PAGEDOWN keys are available to navigate the file, TAB
changes button. "OK" button is renamed "EXIT".
bsddialog_timebox() builds a dialog to choose a time. hh, mm, and ss are
default values on startup, selected time at exit.
bsddialog_yesno() provides a dialog for a "Yes-No Question", the labels
on buttons are Yes and No.
Theme
The graphical properties are global to the library. They are represented
by struct bsddialog_theme and can be customized at runtime via the
<bsddialog_theme.h> API.
struct bsddialog_theme {
struct {
int color;
} screen;
struct {
int color;
unsigned int y;
unsigned int x;
} shadow;
struct {
int color;
bool delimtitle;
int titlecolor;
int lineraisecolor;
int linelowercolor;
int bottomtitlecolor;
int arrowcolor;
} dialog;
struct {
int f_prefixcolor;
int prefixcolor;
int f_selectorcolor;
int selectorcolor;
int f_namecolor;
int namecolor;
int f_desccolor;
int desccolor;
int f_shortcutcolor;
int shortcutcolor;
int bottomdesccolor;
int sepnamecolor;
int sepdesccolor;
} menu;
struct {
int f_fieldcolor;
int fieldcolor;
int readonlycolor;
int bottomdesccolor;
} form;
struct {
int f_color;
int color;
} bar;
struct {
unsigned int minmargin;
unsigned int maxmargin;
char leftdelim;
char rightdelim;
int f_delimcolor;
int delimcolor;
int f_color;
int color;
int f_shortcutcolor;
int shortcutcolor;
} button;
};
A member with the "f_" refers to focus when an element can be in selected
or not selected state.
bsddialog_color() generates and returns a color to set a struct
bsddialog_theme color member. An enum bsddialog_color can be:
BSDDIALOG_BLACK, BSDDIALOG_RED, BSDDIALOG_GREEN, BSDDIALOG_YELLOW,
BSDDIALOG_BLUE, BSDDIALOG_MAGENTA, BSDDIALOG_CYAN, BSDDIALOG_WHITE.
flags is an OR value: BSDDIALOG_BLINK, BSDDIALOG_BOLD,
BSDDIALOG_HALFBRIGHT, BSDDIALOG_HIGHLIGHT, BSDDIALOG_REVERSE,
BSDDIALOG_UNDERLINE.
bsddialog_color_attrs() sets, if not NULL, foreground, background, flags,
like the properties of color, see bsddialog_color().
bsddialog_get_theme() sets theme like the current runtime theme.
bsddialog_hascolors() returns true if the terminal provides colors, false
otherwise.
bsddialog_set_theme() sets theme like current runtime theme. Changes
take effect only for dialogs built after the call.
bsddialog_set_default_theme() sets a library default theme like current
theme, possible values: BSDDIALOG_THEME_BLACKWHITE, BSDDIALOG_THEME_FLAT,
BSDDIALOG_THEME_3D. Changes take effect only for dialogs built after the
call.
RETURN VALUES
The functions return the value BSDDIALOG_ERROR if unsuccessful;
otherwise, depending on the pressed button, the following values can be
returned: BSDDIALOG_OK, BSDDIALOG_CANCEL, BSDDIALOG_HELP,
BSDDIALOG_EXTRA, BSDDIALOG_LEFT1, BSDDIALOG_LEFT2, BSDDIALOG_LEFT3,
BSDDIALOG_RIGHT1, BSDDIALOG_RIGHT2, BSDDIALOG_RIGHT3. BSDDIALOG_YES and
BSDDIALOG_NO are aliases for BSDDIALOG_OK and BSDDIALOG_CANCEL,
respectively.
The functions return BSDDIALOG_ESC if conf.key.enable_esc is enabled and
the ESC key is pressed.
bsddialog_pause() returns BSDDIALOG_TIMEOUT if the timeout expires.
EXAMPLES
"Yes-No Question" Example:
int output;
struct bsddialog_conf conf;
if (bsddialog_init() == BSDDIALOG_ERROR)
return (1);
bsddialog_initconf(&conf);
conf.title = "yesno";
output = bsddialog_yesno(&conf, "Example", 7, 25);
bsddialog_end();
switch (output) {
case BSDDIALOG_YES:
printf("Yes\n");
break;
case BSDDIALOG_NO
printf("NO\n");
break;
case BSDDIALOG_ERROR:
printf("Error: %s\n", bsddialog_geterror());
break;
}
Theme Example:
struct bsddialog_conf conf;
struct bsddialog_theme theme;
bsddialog_init();
bsddialog_initconf(&conf);
bsddialog_msgbox(&conf, "Default theme", 7, 25);
bsddialog_get_theme(&theme);
theme.screen.color = bsddialog_color(BSDDIALOG_RED, BSDDIALOG_GREEN,
BSDDIALOG_BOLD);
bsddialog_set_theme(&theme);
bsddialog_backtitle(&conf, "Red foreground and Green background");
bsddialog_msgbox(&conf, "Change screen color", 7, 25);
bsddialog_set_default_theme(BSDDIALOG_THEME_BLACKWHITE);
bsddialog_msgbox(&conf, "Black and White theme", 7, 25);
bsddialog_end();
Mixedlist Example:
unsigned int i, j;
struct bsddialog_conf conf;
struct bsddialog_menuitem item;
struct bsddialog_menuitem check[2] = {
{ "1", true, 0, "Name 1", "Desc 1", "Check Bottom Desc 1" },
{ "2", false, 0, "Name 2", "Desc 2", "Check Bottom Desc 2" }
};
struct bsddialog_menuitem sep[1] = {
{ "3", true, 0, "Radiolist", "(desc)", "" }
};
struct bsddialog_menuitem radio[2] = {
{ "4", true, 0, "Name 1", "Desc 1", "Radio Bottom Desc 1" },
{ "5", false, 0, "Name 2", "Desc 2", "Radio Bottom Desc 2" }
};
struct bsddialog_menugroup group[3] = {
{ BSDDIALOG_CHECKLIST, 2, check },
{ BSDDIALOG_SEPARATOR, 1, sep },
{ BSDDIALOG_RADIOLIST, 2, radio }
};
bsddialog_init();
bsddialog_initconf(&conf);
bsddialog_mixedlist(&conf, "Example", 20, 30, 11, 3, group, NULL,
NULL);
bsddialog_end();
for (i = 0; i < 3; i++) {
for (j = 0; j < group[i].nitems; j++) {
item = group[i].items[j];
switch (item.type) {
case BSDDIALOG_SEPARATOR:
printf("---- %s ----\n", item.name);
break;
case BSDDIALOG_RADIOLIST:
printf(" (%c) %s\n",
item.on ? '*' : ' ', item.name);
break;
case BSDDIALOG_CHECKLIST:
printf(" [%c] %s\n",
item.on ? 'X' : ' ', item.name);
break;
}
}
}
SEE ALSO
bsddialog(1), curses(3)
HISTORY
The bsddialog library first appeared in FreeBSD 14.0.
AUTHORS
bsddialog was written by Alfonso Sabato Siciliano
<asiciliano@FreeBSD.org>.
FreeBSD 14.0-CURRENT July 28, 2023 FreeBSD 14.0-CURRENT
portconfig is an utility for the FreeBSD Operating System to customize a port building. A short description is available, this post is for the manual, refer to the project README for a technical description.
PORTCONFIG(1) FreeBSD General Commands Manual PORTCONFIG(1)
NAME
portconfig - port options
SYNOPSIS
portconfig [-h | -v]
DESCRIPTION
The portconfig utility provides a TUI to customize the options to build a
port. The following options are available:
-h Display options, a short description and exit.
-v Show version and exit.
The following user interface features are available:
F1 key General PORTS usage.
Help button
Specific port help, if pkg-help exists.
Space key
Select/deselect an option.
ENVIRONMENT
The following environment variables can customize portconfig:
NO_COLOR
Disable colors if present and not an empty string (regardless of
its value).
PORTCONFIG_ALIGNCENTER
Align options to center, "YES" to enable, default left.
PORTCONFIG_ASCIILINES
Ascii characters to draw lines, "YES" to enable.
PORTCONFIG_FULLSCREEN
Fullscreen mode, "YES" to enable.
PORTCONFIG_HEIGHT
Fixed height, default autosize.
PORTCONFIG_MINHEIGHT
Minimum height, takes effect only with autosize.
PORTCONFIG_MINWIDTH
Minimum width, takes effect only with autosize.
PORTCONFIG_NOLINES
Do not draw lines, "YES" to enable.
PORTCONFIG_NOSHADOW
"YES" to disable dialog shadow.
PORTCONFIG_WIDTH
Fixed width, default autosize.
Compatibility
The following environment variables are available for compatibility:
D4PALIGNCENTER PORTCONFIG_ALIGNCENTER
D4PASCIILINES PORTCONFIG_ASCIILINES
D4PFULLSCREEN PORTCONFIG_FULLSCREEN
D4PHEIGHT PORTCONFIG_HEIGHT
D4PMINHEIGHT PORTCONFIG_MINHEIGHT
D4PWIDTH PORTCONFIG_WIDTH
EXIT STATUS
The portconfig utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
ports(7)
AUTHORS
The portconfig utility was written by Alfonso Sabato Siciliano
<asiciliano@FreeBSD.org>.
THANKS TO
Baptiste Daroussin <bapt@FreeBSD.org> for suggestions, help, and testing.
FreeBSD 14.0-CURRENT August 4, 2023 FreeBSD 14.0-CURRENT
BSDDialog is an utility to write a script with a Text User Interface. It can build widgets/dialogs: to show messages, to get input and to inform about a computation status.
Example to build a msgbox with Hello World!:
% bsddialog --msgbox "Hello World!" 8 20
Of course, it is possible to use bsddialog in a shell script, “Yes-No Question” example:
#!/bin/sh
${BSDDIALOG_YES=0}
${BSDDIALOG_NO=1}
bsddialog --theme bsddialog --color --title " yesno " \
--yesno "\nHello \Z3World\Zn!" 10 30
case $? in
$BSDDIALOG_YES )
echo "YES!"
;;
$BSDDIALOG_NO )
echo "NO!"
;;
esac
The utility is designed and developed mainly for FreeBSD, the first version 0.0.1 is out, please consider this a testing version, let me know any problem.
To install the port devel/bsddialog:
# cd /usr/ports/devel/bsddialog/ && make install clean
To add the package:
# pkg install bsddialog
To build from sources:
$ git clone https://gitlab.com/alfix/bsddialog.git
$ cd bsddialog $ make
Features:
% bsddialog --version
bsddialog 0.0.1 (libbsddialog 0.1-devel). % bsddialog --help
The project has a list of examples, some screenshot, preview:
BSDDialog is an open source project released under the term of the BSD 2 Clause License, repository: https://gitlab.com/alfix/bsddialog.
Happy Hacking!