Various system utility functions.
Get the default editor (program) for this user. This functions checks the EDITOR and VISUAL environment variables and then looks into a hard coded list of editors.
Analogous to get_editor, defaulting to a list including less and more.
page_contents ?pager ?tmp_name str will show str in a pager. The optional
tmp_name parameter gives the temporary file prefix. The temporary file is removed
after running.
with_tmp pre suf f creates a temp file, calls f with the file name, and removes the
file afterwards.
diff s1 s2 returns diff (1) output of the two strings. Identical files returns the
empty string. The default value of options is "-d -u", to provide shorter, unified
diffs.
ip_of_name hostname looks up the hostname and prints the IP in dotted-quad
format.
getbyname_ip () returns the IP of the current host by resolving the hostname.
ifconfig_ips () returns IPs of all active interfaces on the host by parsing ifconfig
output. Note that this will include 127.0.0.1, assuming lo is up.
checked_edit ~check file
Edit a file in safe way, like vipw(8). Launches your default editor on
file and uses check to check its content.
true
`Ok or `Abort. If `Abort is returned the files was not modified
(or created).