File: obsolete

package info (click to toggle)
lsof 4.91%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,984 kB
  • sloc: ansic: 68,893; sh: 6,862; makefile: 1,682; perl: 1,099; awk: 214
file content (81 lines) | stat: -rw-r--r-- 2,013 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Author: Nicholas Bamber <nicholas@periapt.co.uk>
Subject: trying to modernize Perl so that dependency can be dropped
Forwarded: not-needed
Last-Update: 2012-05-05
--- a/scripts/identd.perl5
+++ b/scripts/identd.perl5
@@ -18,13 +18,14 @@
 #
 # Kapil Chowksey <kchowksey@hss.hns.com>
 ###################################################################
-
+use strict;
 use Socket;
-require 'getopts.pl';
+use Getopt::Long;
 
 # Set path to lsof.
 
-if (($LSOF = &isexec("../lsof")) eq "") {	# Try .. first
+my $LSOF;
+if (($LSOF = &isexec("/usr/bin/lsof")) eq "") {	# Try .. first
     if (($LSOF = &isexec("lsof")) eq "") {	# Then try . and $PATH
 	print "can't execute $LSOF\n"; exit 1
     }
@@ -34,18 +35,16 @@
 close(STDERR);
 open(STDERR, ">/dev/null");
 
-$Timeout = "120";
+my $Timeout = "120";
 
-&Getopts('t:');
-if ($opt_t) {
-    $Timeout = $opt_t;
-}
+GetOptions('timeout=i'=>\$Timeout);
 
-($port, $iaddr) = sockaddr_in(getpeername(STDIN));
-$peer_addr = inet_ntoa($iaddr);
+my ($port, $iaddr) = sockaddr_in(getpeername(STDIN));
+my $peer_addr = inet_ntoa($iaddr);
+my $query;
 
 # read ident-query from socket (STDIN) with a timeout.
-$timeout = int($Timeout);
+my $timeout = int($Timeout);
 eval {
     local $SIG{ALRM} = sub { die "alarm\n" };
     alarm $timeout;
@@ -61,8 +60,8 @@
 # remove all white-spaces from query
 $query =~ s/\s//g;
 
-$serv_port = "";
-$cli_port = "";
+my $serv_port = "";
+my $cli_port = "";
 ($serv_port,$cli_port) = split(/,/,$query);
 
 if ($serv_port =~ /^[0-9]+$/) {
@@ -87,8 +86,8 @@
 
 open(LSOFP,"$LSOF -nPDi -T -FLn -iTCP@".$peer_addr.":".$cli_port."|");
 
-$user = "UNKNOWN";
-while ($a_line = <LSOFP>) {
+my $user = "UNKNOWN";
+while (my $a_line = <LSOFP>) {
     # extract user name.
     if ($a_line =~ /^L.*/) {
         ($user) = ($a_line =~ /^L(.*)/);
--- a/scripts/sort_res.perl5
+++ b/scripts/sort_res.perl5
@@ -33,7 +33,6 @@
 #	-removing unuseful line number arg.
 #	-display global size
 
-require 'getopts.pl';
 my @args = @_;
 
 # Set path to lsof.