diff options
author | Slávek Banko <[email protected]> | 2024-09-21 02:05:23 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2024-09-21 10:19:43 +0200 |
commit | 1f9edc59fff2162b4468c131c15b0659e85969bd (patch) | |
tree | 56f36960860bb81b815d8e2d80d334940d7707a6 | |
parent | c1c5be1f83356e73bd36bfed5781f338d043747f (diff) | |
download | tdenetwork-1f9edc59fff2162b4468c131c15b0659e85969bd.tar.gz tdenetwork-1f9edc59fff2162b4468c131c15b0659e85969bd.zip |
ksirc: Use Getopt::Std instead of deprecated getopts.pl library.
Signed-off-by: Slávek Banko <[email protected]>
(cherry picked from commit f60724cc0c251a5662047cc9e77422d4dd8d66dd)
-rwxr-xr-x | ksirc/dsirc | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/ksirc/dsirc b/ksirc/dsirc index f358fcd7..d73b6a50 100755 --- a/ksirc/dsirc +++ b/ksirc/dsirc @@ -55,8 +55,8 @@ # of ksirc when it started, and found it very flattering that someone # would write 200k of C++ to interface with my 62k of perl :=) -$version='2.211'; -$date='10 Mar 1998'; +$version='2.212'; +$date='21 Sep 2024'; $add_ons=''; $libdir=$ENV{"SIRCLIB"} || "."; @@ -68,12 +68,7 @@ $|=1; $publicAway = 1; -if (!eval "require 'getopts.pl';") { - print "\n\n\ -Your perl interpreter is *really* screwed up: the getopts.pl library is not -even there! Have you even bothered to run 'install'?\n"; - exit; -} +use Getopt::Std; if ($] >= 5 && (eval "use Socket;", $@ eq '')) { $sock6 = eval ("require Socket6;") and eval("use Socket6;"); @@ -96,22 +91,22 @@ if($@) { } -&Getopts('n:s:p:u:i:l:L:H:rqQR78S'); +getopts('n:s:p:u:i:l:L:H:rqQR78S', \my %opts); %set=("LOGFILE", "", "LOG", "off", "PRINTUH", "none", "PRINTCHAN", "off", "LOCALHOST", "", "CTCP", "noflood", "SENDAHEAD", 4096, "USERINFO", "", "FINGER", "", "IRCNAME", "", "EIGHT_BIT", "on", "LOADPATH", join(":", @loadpath), "CTRL_T", "/next"); -$raw_mode=$opt_r || (!-t STDOUT); +$raw_mode=$opts{r} || (!-t STDOUT); $ansi=!$raw_mode && $ENV{"TERM"} =~ /^vt|^xterm|^ansi/i; -$server=$opt_s || $ARGV[1] || $ENV{"SIRCSERVER"} || $ENV{"IRCSERVER"} || +$server=$opts{s} || $ARGV[1] || $ENV{"SIRCSERVER"} || $ENV{"IRCSERVER"} || "irc.primenet.com"; -$port0=$opt_p || $ENV{"SIRCPORT"} || $ENV{"IRCPORT"} || 6667; -$username=$opt_u || $ENV{"SIRCUSER"} || $ENV{"IRCUSER"} || (getpwuid($<))[0] || +$port0=$opts{p} || $ENV{"SIRCPORT"} || $ENV{"IRCPORT"} || 6667; +$username=$opts{u} || $ENV{"SIRCUSER"} || $ENV{"IRCUSER"} || (getpwuid($<))[0] || $ENV{"USER"} || "blah"; -$set{"IRCNAME"}=$opt_i || $ENV{"SIRCNAME"} || $ENV{"IRCNAME"} || "sirc user"; -$nick=$opt_n || $ARGV[0] || $ENV{"SIRCNICK"} || $ENV{"IRCNICK"} || $username; +$set{"IRCNAME"}=$opts{i} || $ENV{"SIRCNAME"} || $ENV{"IRCNAME"} || "sirc user"; +$nick=$opts{n} || $ARGV[0] || $ENV{"SIRCNICK"} || $ENV{"IRCNICK"} || $username; $set{"FINGER"}=$ENV{"IRCFINGER"} || "keep your fingers to yourself"; $set{"USERINFO"}=$ENV{"USERINFO"} || "yep, I'm a user"; if ($server =~ /^\[([^\]]+)\]:([0-9]*):?(.*)$/ @@ -123,18 +118,18 @@ $port || ($port=$port0); $server0=$server1=$server; $port0=$port1=$port; $pass0=$pass1=$pass; -$initfile=$opt_l || $ENV{"SIRCRCPL"} || $ENV{'HOME'}."/.sircrc.pl" - if $opt_l || !$opt_q; -$sysinit=$libdir."/sircrc.pl" if $libdir ne '.' && !$opt_Q; -$rcfile=$opt_L || $ENV{"SIRCRC"} || $ENV{'HOME'}."/.sircrc" - if $opt_L || !$opt_q; -$sysrc=$libdir."/sircrc" if $libdir ne '.' && !$opt_Q; +$initfile=$opts{l} || $ENV{"SIRCRCPL"} || $ENV{'HOME'}."/.sircrc.pl" + if $opts{l} || !$opts{q}; +$sysinit=$libdir."/sircrc.pl" if $libdir ne '.' && !$opts{Q}; +$rcfile=$opts{L} || $ENV{"SIRCRC"} || $ENV{'HOME'}."/.sircrc" + if $opts{L} || !$opts{q}; +$sysrc=$libdir."/sircrc" if $libdir ne '.' && !$opts{Q}; $set{"LOGFILE"}=$logfile=$ENV{'HOME'}."/sirc.log"; -$opt_8 || ($set{"EIGHT_BIT"}="off"); -$restrict=$opt_R; -$set{"LOCALHOST"}=$opt_H || $ENV{"SIRCHOST"} || $ENV{"IRCHOST"} || +$opts{8} || ($set{"EIGHT_BIT"}="off"); +$restrict=$opts{R}; +$set{"LOCALHOST"}=$opts{H} || $ENV{"SIRCHOST"} || $ENV{"IRCHOST"} || $ENV{"LOCALHOST"} || ""; -$SSL=$opt_S; +$SSL=$opts{S}; @ARGV=(); # ignore any more arguments |