Skip to content

Commit

Permalink
Merge pull request #21 from hollie/master
Browse files Browse the repository at this point in the history
Master merge
  • Loading branch information
Wayne Gatlin authored Jul 5, 2020
2 parents 754ddc7 + ec395d3 commit f334b1c
Show file tree
Hide file tree
Showing 917 changed files with 5,389 additions and 675 deletions.
2 changes: 1 addition & 1 deletion bin/alpha_page
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.+)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
$Pgm_Root = "$Pgm_Path/..";
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # Use BEGIN eval to keep perl2exe happy
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # Use BEGIN eval to keep perl2exe happy
}

use Getopt::Long;
Expand Down
2 changes: 1 addition & 1 deletion bin/get_earthquakes
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ eof
}

BEGIN {
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'";
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'";
} # Use BEGIN eval to keep perl2exe happy
require 'handy_utilities.pl'; # For read_mh_opts funcion

Expand Down
2 changes: 1 addition & 1 deletion bin/get_email
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.+)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
$Pgm_Root = "$Pgm_Path/..";
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # Use BEGIN eval to keep perl2exe happy
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # Use BEGIN eval to keep perl2exe happy
}

use Getopt::Long;
Expand Down
124 changes: 124 additions & 0 deletions bin/get_tcp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/usr/bin/env perl
# -*- Perl -*-

use strict;
use IO::Socket;

# Similar to get_url, open a socket and then get the data. Useful to spawn off as a process_item to avoid pauses

my ( $Pgm_Path, $Pgm_Name );

BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

my ( %config_parms, %parms );

use Getopt::Long;

if (
!&GetOptions( \%parms, 'h', 'help', 'quiet', 'timeout=s', 'rn')
or !@ARGV
or $parms{h}
or $parms{help}
)
{

print <<eof;
$Pgm_Name similar to get_url, opens a socket to host and echos response to STDOUT or a local file.
Usage:
$Pgm_Name [-quiet] host:post data [local_file]
-quiet: no output on stdout
-timeout: in seconds. Defaults is 3 seconds
-rn: send \r\n to the data
If local_file is specified, data is stored there.
If local_file = /dev/null, data is not returned.
Otherwise, data is echoed to STDOUT.
eof
exit;
}

my $timeout = 3;
$timeout = $parms{timeout} if ($parms{timeout});

my $location = shift;

my ($host, $port) = $location =~ /^(\S+)(:\d+)/;

$port =~ s/://g;

my $data = shift;

$data .= "\r\n" if ($parms{rn});

unless ($host and $port and $data) {
print "get_tcp_error: missing parameters: ";
print "host " unless ($host);
print "port " unless ($port);
print "data " unless ($data);
print "\n";
exit;
}


# Get parms from mh.ini
require 'handy_utilities.pl';
&main::read_mh_opts( \%config_parms, $Pgm_Path );

my $file = shift;
my $response = "";
my $error = 1;

my $tcp = new IO::Socket::INET(
PeerHost => $host,
PeerPort => $port,
Timeout => $timeout,
Proto => "tcp") or $response = "get_tcp_error: opening socket: $!.\n";
#print "error $host:$port\n" if ($tcp->connected());

unless ($response) {
$error = 0;
print "Sending data to $location " unless $parms{quiet};
print "into $file" unless ($parms{quiet} or !$file);
print "..." unless $parms{quiet};

$tcp->send($data) or $response = "get_tcp_error: Couldn't send: $!";

unless ($response) {
$tcp->recv($response, 1024);
print " data retrieved\n" unless $parms{quiet};
} else {
$error = 1;
}
}
if ($file) {
# print $data;
unless ( $file eq '/dev/null' ) {
if ($response) {
open( OUT, ">$file" )
or die "get_tcp_error: could not open file '$file' for output: $!\n";
binmode OUT;
print OUT $response;
close OUT;
}
else {
print " empty data response\n";
}
}
} else {
print $response;
}


$tcp->close() unless ($error);


2 changes: 1 addition & 1 deletion bin/get_tv_grid
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BEGIN {
($Version) = q$Revision$ =~ /: (\S+)/; # Note: revision number is auto-updated by cvs
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

require "RedirAgent.pm";
Expand Down
2 changes: 1 addition & 1 deletion bin/get_tv_grid_ge
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BEGIN {
($Version) = q$Revision$ =~ /: (\S+)/; # Note: revision number is auto-updated by cvs
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}
my %parms;
use Getopt::Long;
Expand Down
2 changes: 1 addition & 1 deletion bin/get_tv_grid_xmltv
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BEGIN {
($Version) = q$Revision$ =~ /: (\S+)/; # Note: revision number is auto-updated by cvs
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

use XMLTV::Version '$Id$ ';
Expand Down
2 changes: 1 addition & 1 deletion bin/get_tv_info
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BEGIN {

( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

my %parms;
Expand Down
2 changes: 1 addition & 1 deletion bin/get_tv_info_ge
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BEGIN {

( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

my %parms;
Expand Down
9 changes: 6 additions & 3 deletions bin/get_url
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ my ( $Pgm_Path, $Pgm_Name );
BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback' "; # So perl2exe works
}

my ( %config_parms, %parms );
Expand All @@ -19,7 +19,7 @@ use Getopt::Long;
#print "get_url: @ARGV\n";
if (
!&GetOptions( \%parms, 'h', 'help', 'quiet', 'cookies=s', 'cookie_file_in=s', 'cookie_file_out=s', 'post=s', 'header=s', 'userid=s', 'password=s', 'ua',
'put=s', 'json', 'response_code' )
'put=s', 'timeout=s', 'json', 'response_code' )
or !@ARGV
or $parms{h}
or $parms{help}
Expand All @@ -32,7 +32,7 @@ if (
Usage:
$Pgm_Name [-quiet] [-cookies 'cookiestr'] [-post 'poststr'] [-header header_file] url [local_file]
$Pgm_Name [-quiet] [-cookies 'cookiestr'] [-post 'poststr'] [-header header_file] [-timeout X] url [local_file]
-quiet: no output on stdout
Expand All @@ -59,6 +59,7 @@ Usage:
-response_code: STDOUT only: Prepend output with RESPONSECODE: <response code>\n
-timeout: XX : number of seconds to wait for command to complete
If local_file is specified, data is stored there.
If local_file = /dev/null, data is not returned.
Expand Down Expand Up @@ -113,6 +114,8 @@ sub use_ua {
if $config_parms{proxy};

$ua->timeout(30); # Time out after 30 seconds
$ua->timeout($parms{timeout} ) if $parms{timeout};

$ua->env_proxy();
$ua->agent( $config_parms{get_url_ua} ) if $config_parms{get_url_ua};

Expand Down
4 changes: 2 additions & 2 deletions bin/get_weather
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ $opt_v++ if $parms{v}; # Geo::Weather looks at this
my $caller = caller;
my $return_flag = ( $caller and $caller ne 'main' ) ? 1 : 0;

#use my_lib "$Pgm_Path/../lib/site"; # See note in lib/mh_perl2exe.pl for lib -> my_lib explaination
#use my_lib "$Pgm_Path/../lib/site", "$Pgm_Path/../lib/fallback"; # See note in lib/mh_perl2exe.pl for lib -> my_lib explaination
BEGIN {
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'";
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'";
} # Use BEGIN eval to keep perl2exe happy

require 'handy_utilities.pl'; # For read_mh_opts funcion
Expand Down
4 changes: 2 additions & 2 deletions bin/get_weather_ca
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ use vars qw(%Weather @Weather_Forecast);
my $caller = caller;
my $return_flag = ( $caller and $caller ne 'main' ) ? 1 : 0;

#use my_lib "$Pgm_Path/../lib/site"; # See note in lib/mh_perl2exe.pl for lib -> my_lib explaination
#use my_lib "$Pgm_Path/../lib/site", "$Pgm_Path/../lib/fallback"; # See note in lib/mh_perl2exe.pl for lib -> my_lib explaination
BEGIN {
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'";
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'";
} # Use BEGIN eval to keep perl2exe happy

require 'handy_utilities.pl'; # For read_mh_opts funcion
Expand Down
2 changes: 1 addition & 1 deletion bin/ical2vsdb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use strict;
## Sometimes icals are unchanged, but the order is different when downloading. Add option to sort the ical to ensure
## Data hasn't changed even if the order did. Added option sort_before_md5 = 1 to enable globally or to the specific ical

use lib '../lib', '../lib/site';
use lib '../lib', '../lib/site', '../lib/fallback';
use iCal::Parser;
use DateTime;
use Digest::MD5 qw(md5 md5_hex);
Expand Down
2 changes: 1 addition & 1 deletion bin/ical_load
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ BEGIN {
($Version) = q$Revision$ =~ /: (\S+)/; # Note: revision number is auto-updated by cvs
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

use Getopt::Long;
Expand Down
18 changes: 16 additions & 2 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ BEGIN {
# Pick local mh modules first, over any site install ones
unshift( @INC, "${Pgm_Path}/../lib", "${Pgm_Path}/../lib/site", '.' );

# Keep fallback versions of CPAN modules, in case they're not present on the system. Place them last
# so the sysadmin can install more current versions in the normal Perl places if they wish.
push @INC,"${Pgm_Path}/../lib/fallback";

# my $pwd=cwd(); print "pwd=$pwd inc=@INC\n";
# push (@INC, './../lib', './../lib/site', '.');
# push (@INC, './../lib');
Expand Down Expand Up @@ -797,6 +801,10 @@ sub setup {
}
else {
require 'json_server.pl';

# Actions on Google HTTP helper
require 'http_server_aog.pl';
http_server_aog_startup();
}

if ($OS_win) {
Expand Down Expand Up @@ -2685,8 +2693,14 @@ sub check_for_socket_data {
$data = <$sock>;
}
else {
# 1500 is ethernet packet size
my $from_saddr = recv( $sock, $data, 1500, 0 );
# We used to read 1500 bytes here because that is the default
# MTU for Ethernet. However, larger MTUs can be in use. In fact,
# the MTU of the loopback interface is set in a modern Linux
# distribution at 65535 bytes. Reading only 1500 can break
# things when the traffic comes to the MisterHouse HTTP server
# via the loopback interface and in packets larger than 1500
# bytes.
my $from_saddr = recv( $sock, $data, 65535, 0 );

# Store udp from_* data
if ( $Socket_Ports{$port_name}{protocol}
Expand Down
2 changes: 1 addition & 1 deletion bin/net_ftp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ my ( $Pgm_Path, $Pgm_Name );
BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.+)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # Use BEGIN eval to keep perl2exe happy
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # Use BEGIN eval to keep perl2exe happy
}

my %parms;
Expand Down
2 changes: 1 addition & 1 deletion bin/outlook_read
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BEGIN {
($Version) = q$Revision$ =~ /: (\S+)/; # Note: revision number is auto-updated by cvs
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

use Getopt::Long;
Expand Down
2 changes: 1 addition & 1 deletion bin/pocketsphinx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ BEGIN {
($Version) = q$Revision: 1084 $ =~ /: (\S+)/; # Note: revision number is auto-updated by cvs
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # So perl2exe works
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # So perl2exe works
}

use Getopt::Long;
Expand Down
1 change: 1 addition & 0 deletions bin/print_socket_fork_memmap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ BEGIN
}
push @INC, './../lib/site';
push @INC, './../lib';
push @INC, './../lib/fallback';
}

require "$Pgm_Path/../lib/handy_utilities.pl";
Expand Down
2 changes: 1 addition & 1 deletion bin/read_email
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ my ( $Pgm_Path, $Pgm_Name );
BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.+)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # Use BEGIN eval to keep perl2exe happy
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # Use BEGIN eval to keep perl2exe happy
}

my %parms;
Expand Down
2 changes: 1 addition & 1 deletion bin/report_weblog
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ my ( $Pgm_Path, $Pgm_Name );
BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.*)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib/site'";
eval "use lib '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'";
}

my %parms;
Expand Down
2 changes: 1 addition & 1 deletion bin/send_email
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ my ( $Pgm_Path, $Pgm_Name );
BEGIN {
( $Pgm_Path, $Pgm_Name ) = $0 =~ /(.*)[\\\/](.+)\.?/;
($Pgm_Name) = $0 =~ /([^.]+)/, $Pgm_Path = '.' unless $Pgm_Name;
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'"; # Use BEGIN eval to keep perl2exe happy
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'"; # Use BEGIN eval to keep perl2exe happy
}

my %parms;
Expand Down
2 changes: 1 addition & 1 deletion bin/set_clock
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ print "Requesting the time from $parms{server} using $parms{method} method\n";
#use my_lib "$Pgm_Path/../lib"; # See note in lib/mh_perl2exe.pl for lib -> my_lib explaination
#use my_lib "$Pgm_Path/../lib/site"; # See note in lib/mh_perl2exe.pl for lib -> my_lib explaination
BEGIN {
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site'";
eval "use lib '$Pgm_Path/../lib', '$Pgm_Path/../lib/site', '$Pgm_Path/../lib/fallback'";
} # Use BEGIN eval to keep perl2exe happy

my $time_record;
Expand Down
Loading

0 comments on commit f334b1c

Please sign in to comment.