gestion des hostnames avec --host

darcs-hash:20020130191329-a279a-1a8a7ef83b928f7d63b982344fbb2eb6fef59d8e.gz
This commit is contained in:
stransky 2002-01-30 20:13:29 +01:00
parent 142e6b159d
commit 30eb7d149c

View file

@ -5,7 +5,7 @@
## Made by Tab <rv@crans.org> ## Made by Tab <rv@crans.org>
## ##
## Started on Tue 09 Oct 2001 01:28:25 AM CEST tab ## Started on Tue 09 Oct 2001 01:28:25 AM CEST tab
## Last Update Tue Nov 25 19:00:00 2001 Nico ## Last Update mer 30 jan 2002 19:56:00 CET Nicolas STRANSKY
## ##
## ##
## This program is free software; you can redistribute it and/or modify ## This program is free software; you can redistribute it and/or modify
@ -36,6 +36,7 @@
## ##
use strict; use strict;
use IO::Socket;
my $inputfile = "/var/log/net-acct/net-acct.log.0"; my $inputfile = "/var/log/net-acct/net-acct.log.0";
my $host = ""; my $host = "";
@ -327,7 +328,8 @@ for (my $ct = 0; $ct < @ARGV; $ct++)
} elsif ($ARGV[$ct] eq '-h' || $ARGV[$ct] eq '--host') { } elsif ($ARGV[$ct] eq '-h' || $ARGV[$ct] eq '--host') {
if ($ARGV[$ct+1] =~ /[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}/) if ($ARGV[$ct+1] =~ /[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}/)
{ $host = $ARGV[$ct+1]; $ct++; } { $host = $ARGV[$ct+1]; $ct++; }
else { usage(); } else { $host = inet_ntoa((gethostbyname($ARGV[$ct+1]))[4]); $ct++; }
#else { usage(); } # C'est quand meme chiant de pas pouvoir utiliser les hostnames ! Allez, on implémente :) -- Nico
} elsif ($ARGV[$ct] =~ '-n' || $ARGV[$ct] eq '--nombre') { } elsif ($ARGV[$ct] =~ '-n' || $ARGV[$ct] eq '--nombre') {
if ($ARGV[$ct+1]) if ($ARGV[$ct+1])
{ $nombre_line_affiche = $ARGV[$ct+1]; $ct++; } { $nombre_line_affiche = $ARGV[$ct+1]; $ct++; }