From: Arne Fitzenreiter Date: Mon, 15 Jul 2013 18:49:23 +0000 (+0200) Subject: Merge remote-tracking branch 'stevee/proxy-squidclamav' into next X-Git-Tag: v2.13-core71~9 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=3e862ce4f99059002b60994addc87a013d298b38 Merge remote-tracking branch 'stevee/proxy-squidclamav' into next Conflicts: config/cfgroot/general-functions.pl --- 3e862ce4f99059002b60994addc87a013d298b38 diff --cc config/cfgroot/general-functions.pl index 3cdb36fbd4,fbca601e4a..41643d8d74 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@@ -1008,26 -1008,27 +1008,49 @@@ sub MakeUserAgent() return $user_agent; } +sub RedIsWireless() { + # This function checks if a network device is a wireless device. + + my %settings = (); + &readhash("${General::swroot}/ethernet/settings", \%settings); + + # Find the name of the network device. + my $device = $settings{'RED_DEV'}; + + # Exit, if no device is configured. + return 0 if ($device eq ""); + + # Return 1 if the device is a wireless one. + my $path = "/sys/class/net/$device/wireless"; + if (-d $path) { + return 1; + } + + # Otherwise return zero. + return 0; +} + + # Function to read a file with UTF-8 charset. + sub read_file_utf8 ($) { + my ($file) = @_; + + open my $in, '<:encoding(UTF-8)', $file or die "Could not open '$file' for reading $!"; + local $/ = undef; + my $all = <$in>; + close $in; + - return $all; ++ return $all; + } + + # Function to write a file with UTF-8 charset. + sub write_file_utf8 ($) { + my ($file, $content) = @_; + + open my $out, '>:encoding(UTF-8)', $file or die "Could not open '$file' for writing $!";; + print $out $content; + close $out; + + return; + } + 1;