diff options
-rw-r--r-- | etc/network.subr | 26 | ||||
-rw-r--r-- | etc/rc.d/netoptions | 26 | ||||
-rw-r--r-- | etc/rc.d/network1 | 26 | ||||
-rw-r--r-- | etc/rc.d/network2 | 26 | ||||
-rw-r--r-- | etc/rc.d/network3 | 26 | ||||
-rw-r--r-- | etc/rc.d/routing | 26 | ||||
-rw-r--r-- | etc/rc.network | 26 |
7 files changed, 112 insertions, 70 deletions
diff --git a/etc/network.subr b/etc/network.subr index 1ca57d5..db56699 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions index 1ca57d5..db56699 100644 --- a/etc/rc.d/netoptions +++ b/etc/rc.d/netoptions @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } diff --git a/etc/rc.d/network1 b/etc/rc.d/network1 index 1ca57d5..db56699 100644 --- a/etc/rc.d/network1 +++ b/etc/rc.d/network1 @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } diff --git a/etc/rc.d/network2 b/etc/rc.d/network2 index 1ca57d5..db56699 100644 --- a/etc/rc.d/network2 +++ b/etc/rc.d/network2 @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } diff --git a/etc/rc.d/network3 b/etc/rc.d/network3 index 1ca57d5..db56699 100644 --- a/etc/rc.d/network3 +++ b/etc/rc.d/network3 @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } diff --git a/etc/rc.d/routing b/etc/rc.d/routing index 1ca57d5..db56699 100644 --- a/etc/rc.d/routing +++ b/etc/rc.d/routing @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } diff --git a/etc/rc.network b/etc/rc.network index 1ca57d5..db56699 100644 --- a/etc/rc.network +++ b/etc/rc.network @@ -41,8 +41,7 @@ network_pass1() { # Generate host.conf for compatibility # if [ -f "/etc/nsswitch.conf" ]; then - echo '' - echo 'Generating /etc/host.conf for compatibility' + echo -n ' host.conf' generate_host_conf /etc/nsswitch.conf /etc/host.conf fi @@ -880,16 +879,23 @@ BEGIN { xlat["files"] = "hosts"; xlat["dns"] = "bind"; xlat["nis"] = "nis"; + cont = 0; } -/^hosts:/ { - print "# Auto-generated, do not edit"; - for (n = 2; n <= NF; ++n) - if ($n in xlat) - print xlat[$n]; - quit; +sub(/^[\t ]*hosts:/, "") || cont { + if (!cont) + srcs = "" + sub(/#.*/, "") + gsub(/[][]/, " & ") + cont = sub(/\\$/, "") + srcs = srcs " " $0 } -// { - next; +END { + print "# Auto-generated from nsswitch.conf, do not edit" + ns = split(srcs, s) + for (n = 1; n <= ns; ++n) { + if (s[n] in xlat) + print xlat[s[n]] + } } ' <$nsswitch_conf >$host_conf } |