Commit Graph

16656 Commits

Author SHA1 Message Date
dteske
63213c08fe Sort the domains 2016-12-13 01:36:46 +00:00
dteske
49fdf75f47 The --no-items and --stdout options are non-standard and should be avoided
From the dialog(1) manual:
using [--stdout] in portable scripts is not recommended
2016-12-13 01:35:26 +00:00
dteske
b80642d373 More efficiently make use of the exit status 2016-12-13 00:27:56 +00:00
dteske
8a66e75e41 Stop repeating strings (centralize prompt string)
NB: Changes to strings now only affect a single line
2016-12-13 00:22:01 +00:00
dteske
eb83f20492 Add missing backslash (no real effect; it's pedantic and correct for
the interpolation level)
2016-12-13 00:18:51 +00:00
dteske
7d793e70e3 Use the oft-neglected awk syntax "startcondition, stopcondition { ... }" to
process the range of country labels which appear as columnar list from the
"ifconfig DEV list countries" command. Not only improving maintainability,
but also properly encapsulating arguments in single-quotes instead of
trying to escape whitespace. It is also completely unnecessary to collapse
newlines into whitespace (shell will do this for you automatically upon
expansion of the contents where necessary).

NB: This also changes the sorting algorithm to sort on the country code,
not the country name. The type-ahead feature of dialog is destroyed if the
tags are not sorted properly.
2016-12-13 00:02:59 +00:00
dteske
8544084830 Quote WLAN_IFACE (pedantic) 2016-12-12 22:57:07 +00:00
dteske
6e5a839b01 In awk, casting a variable as a boolean condition is the same as testing if
the length of the variable contents is greater than zero

This allows us to also move the secondary condition into the action clause
2016-12-12 21:29:48 +00:00
dteske
70f01cabaf Remove an unnecessary call to f_dialog_title_restore() 2016-12-12 21:27:29 +00:00
dteske
d2d70042b1 Whitespace 2016-12-12 21:26:36 +00:00
dteske
7b0075c12b Utilize provided i18n strings 2016-12-12 21:23:47 +00:00
dteske
b3ba09ad44 Remove incomplete and unnecessary creation of fd3
The provided API already provides a passthru descriptor and even
gives you a varaible for referring to it.
2016-12-12 21:20:56 +00:00
dteske
1f72b9ecd2 Remove unnecessary semi-colons 2016-12-12 21:18:24 +00:00
dteske
81a43c15a2 Use awk the following (more succinct) awk syntax:
condition1 { action1 }
	condition2 { action2 }

instead of the following syntax:

	{
		if (condition1) { action1 }
		else if (condition2) { action2 }
	}
2016-12-12 21:16:37 +00:00
dteske
a2137139d3 1 is the default descriptor for redirects without an fd prefix 2016-12-12 21:11:55 +00:00
dteske
9474c4bc00 Fix invalid parameter expansion (change $@ to "$@")
Without quotes, $@ loses its special meanining (see below)

% sh -c 'echo $@' /bin/sh "   1   " "   2   "
1 2
% sh -c 'echo "$@"' /bin/sh "   1   " "   2   "
   1       2

The quotes are required to get ARGV to be unperterped
2016-12-12 21:04:11 +00:00
dteske
d5fa50b840 Allow the script path to contain whitespace and special characters 2016-12-12 21:01:20 +00:00
dteske
132073e3d3 Use provided API to centralize dialog title strings 2016-12-12 21:00:09 +00:00
dteske
aec8b5b0d1 Reorder dialog parameters based on commonality for readability 2016-12-12 20:54:20 +00:00
dteske
4cbb470510 Fix incorrect use of provided API
The result of which was incorrectly sized menu dialogs
2016-12-12 20:49:49 +00:00
dteske
73a6483723 Use provided API (change "dialog" to "$DIALOG") 2016-12-12 20:43:09 +00:00
dteske
f36072e86a Whitespace (dialog options separated to minimize diffs) 2016-12-12 20:41:27 +00:00
dteske
7a906cbddf Consolidate redirects into here documents, with proper code indentation 2016-12-12 19:46:49 +00:00
hrs
fc29dcf63c - Refactor listening socket list. All of the listening sockets are
now maintained in a single linked-list in a transport-independent manner.
- Use queue.h for linked-list structure.
- Use linked-list for AllowedPeers.
- Use getaddrinfo(8) even for Unix Domain sockets.
- Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
- Define fu_* macro for union f_un to shorten the member names.
- Remove an extra #include <sys/type.h>.
- Add "static" to non-exported symbols.
- !INET support is still incomplete but will be fixed later.

There is no functional change except for some minor debug messages.
2016-12-12 19:33:40 +00:00
dteske
8deaf769ad Remove an unnecessary "return $?" at end of function 2016-12-12 19:26:55 +00:00
hrs
a92b987411 Temporarily backout the previous commit because it was totally broken due to
unresolved merge conflicts.

Pointy hat to:	hrs
2016-12-12 19:24:52 +00:00
dteske
66586c3cda Use ternary operator 2016-12-12 19:24:32 +00:00
dteske
0d3fb22f07 If you're not going to make use of the products of a match() in awk
(e.g., RSTART and RLENGTH variables) then use ~ instead of match()
2016-12-12 19:12:31 +00:00
dteske
5b403b7aab Now that these variables do not contain the --default-item flag itself,
change the name of the variable from $def_item_... to $default_...
2016-12-12 19:10:39 +00:00
hrs
72a9e76712 - Refactor listening socket list. All of the listening sockets are
now maintained in a single linked-list in a transport-independent manner.
- Use queue.h for linked-list structure.
- Use linked-list for AllowedPeers.
- Use getaddrinfo(8) even for Unix Domain sockets.
- Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
- Define fu_* macro for union f_un to shorten the member names.
- Remove an extra #include <sys/type.h>.
- Add "static" to non-exported symbols.
- !INET support is still incomplete but will be fixed later.

There is no functional change except for some minor debug messages.
2016-12-12 19:10:14 +00:00
dteske
7186d17fc0 Always pass --default-item parameter to dialog 2016-12-12 19:09:17 +00:00
dteske
6ac73bdcd8 There is zero harm in always passing --default-item to dialog 2016-12-12 19:07:42 +00:00
dteske
6895a533a9 Centralize backtitle string 2016-12-12 19:01:04 +00:00
dteske
85088f1091 Use provided API instead of hard-coded status integers 2016-12-12 18:55:41 +00:00
dteske
65dd648795 Whitespace 2016-12-12 18:52:22 +00:00
dteske
eb2a4fb667 Remove unnecessary `-n' parameter to head/tail 2016-12-12 18:48:00 +00:00
dteske
c523ed6ee1 awk(1) match() takes a regex, use /.../ to remind ourselves of this
NB: The difference between "..." and /.../ for a regex in awk is that
quoted strings go through escape expansion first (e.g., \\ becomes \)
2016-12-12 18:45:52 +00:00
dteske
827f6676dc Be internally consistent (": > ..." is used elsewhere in this file) 2016-12-12 18:43:42 +00:00
dteske
a86c55d3d1 "echo | sed | sed | awk" is silly (changed to "echo | awk") 2016-12-12 18:42:55 +00:00
dteske
74e48b359f Add missing `-e' parameter to sed invocations 2016-12-12 18:39:26 +00:00
dteske
2abc445326 Allow $BSDINSTALL_TMPETC to contain whitespace or special chars 2016-12-12 18:38:18 +00:00
dteske
544da66b52 Group fallbacks together 2016-12-12 18:34:21 +00:00
dteske
fa756bc185 Remove unnecessary quotes around number in test 2016-12-12 18:33:40 +00:00
dteske
53f48a2373 Change "[ ! ... ] && ..." to "[ ... ] || ..." 2016-12-12 18:29:24 +00:00
dteske
5d63bb6317 Collapse tiny if statements 2016-12-12 18:28:20 +00:00
dteske
a848623c29 Replace funny block with something easy to digest 2016-12-12 18:24:41 +00:00
dteske
1390aaa722 Consolidate locals 2016-12-12 18:21:56 +00:00
dteske
0d737976f5 Remove unnecessary local initializers 2016-12-12 18:20:56 +00:00
dteske
ced2b90567 Change "[ ! -z ... ]" => "[ ... ]" and "[ -z ... ]" => "[ ! ... ]" 2016-12-12 18:17:30 +00:00
dteske
eaa4d342d8 Use $( ... ) instead of ... 2016-12-12 18:10:33 +00:00