Browse Source

Changes to stripcom():

- Align comments with /etc/rc version
- Use localized variables
- Use safer "print -r --" instead of plain echo
Changes to ifstart():
- Tweak comment
- Add usage
OK krw@
OPENBSD_5_9
rpe 9 years ago
parent
commit
3832404083
1 changed files with 13 additions and 9 deletions
  1. +13
    -9
      src/etc/netstart

+ 13
- 9
src/etc/netstart View File

@ -1,21 +1,25 @@
#!/bin/sh - #!/bin/sh -
# #
# $OpenBSD: netstart,v 1.159 2015/11/01 15:37:18 rpe Exp $
# $OpenBSD: netstart,v 1.160 2015/11/12 22:50:46 rpe Exp $
# Turn off Strict Bourne shell mode. # Turn off Strict Bourne shell mode.
set +o sh set +o sh
# Strip comments (and leading/trailing whitespace if IFS is set) from a file
# and spew to stdout.
# Strip comment lines from a file.
# Strip leading and trailing whitespace if IFS is set.
# Usage: stripcom /path/to/file
stripcom() { stripcom() {
local _l
[[ -f $1 ]] || return
while read _l; do
[[ -n ${_l%%#*} ]] && echo $_l
done<$1
local _file=$1 _line
[[ -f $_file ]] || return
while read _line; do
[[ -n ${_line%%#*} ]] && print -r -- "$_line"
done <$_file
} }
# Start the $1 interface.
# Start a single interface.
# Usage: ifstart if1
ifstart() { ifstart() {
if=$1 if=$1
# Interface names must be alphanumeric only. We check to avoid # Interface names must be alphanumeric only. We check to avoid


Loading…
Cancel
Save