From cbf4f1af7ca1c08dc6ac58d7bb4d42bf442c375e Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 29 Oct 2001 00:47:16 +0000 Subject: [PATCH] Added pt language --- ChangeLog | 27 ++++++++++++----------- configure | 4 ++-- configure.in | 4 ++-- src/fuser.c | 61 ++++++++++++++++++++++++++++++++++++---------------- 4 files changed, 60 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 495ad94..ebd4bab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ -Changes in 20.3 +Changes in 21 ============== - signames.h is cleaned - More translatable strings + - Added Portuguese Language (thanks to Edesio Costa e Silva) Changes in 20.2 (18-OCT-2001) @@ -32,7 +33,7 @@ Changes from 19 to 20 (14-DEC-2000) - Better selection of process name (thanks to David desJardins) Changes from version 18 to 19 (25-OCT-1999) -============================= +=========================================== - pstree: "static int" was only "static" (fix by Jeremy Buhler) - now uses cc -E instead of /lib/cpp (suggested by Kristofer Karas) @@ -43,7 +44,7 @@ Changes from version 18 to 19 (25-OCT-1999) Changes from version 17 to 18 (1-NOV-1998) -============================= +========================================== - fuser: usage summary listed -s (silent) as -q - fuser: fuser x/y yielded confusing error message if x/y doesn't exist @@ -60,7 +61,7 @@ Changes from version 17 to 18 (1-NOV-1998) Changes from version 16 to 17 (17-FEB-1998) -============================= +=========================================== - fuser: now also handles /proc of recent 2.1 kernels (fix by Andreas Schwab; other fixed also proposed by Chris Wedgwood and Luca Berra) @@ -74,7 +75,7 @@ Changes from version 16 to 17 (17-FEB-1998) Changes from version 15 to 16 (28-JUL-1997) -============================= +=========================================== - killall: now gets the list of all PIDs before killing processes, thereby avoiding race between readdir and /proc (found by Boris Zentner) @@ -83,7 +84,7 @@ Changes from version 15 to 16 (28-JUL-1997) Changes from version 14 to 15 (16-JUN-1997) -============================= +=========================================== - killall: killall -v didn't print the command name (fixed by Marty Leisner) - fuser: fuser -a could crash (reported by Helmut Geyer) @@ -95,7 +96,7 @@ Changes from version 14 to 15 (16-JUN-1997) Changes from version 13 to 14 (19-APR-1997) -============================= +=========================================== - killall: command-line parser didn't accept -signal (fixed by Chris Wedgwood) - pidof: minor man page correction @@ -104,7 +105,7 @@ Changes from version 13 to 14 (19-APR-1997) Changes from version 12 to 13 (16-APR-1997) -============================= +=========================================== - fuser: didn't check for out of memory condition after malloc (oops !) - fuser: INET domain sockets can now be specified as @@ -121,7 +122,7 @@ Changes from version 12 to 13 (16-APR-1997) Changes from version 11 to 12 (7-APR-1996) -============================= +========================================== - fuser is now able to look up INET and UNIX domain sockets - pstree: new option -n to sort its output by PID @@ -129,7 +130,7 @@ Changes from version 11 to 12 (7-APR-1996) Changes from version 10 to 11 (20-SEP-1995) -============================= +=========================================== - added VERSION file - size of command name is now defined in comm.h - the old approach of @@ -143,7 +144,7 @@ Changes from version 10 to 11 (20-SEP-1995) Changes from version 9 to 10 (28-MAR-1995) -============================ +========================================== - fuser: now prints header before first path (used to be on same line) - fuser: fixed line wrapping for long paths (used to wrap too early) @@ -153,7 +154,7 @@ Changes from version 9 to 10 (28-MAR-1995) - updated e-mail address in README Changes from version 8 to 9 (22-JAN-1995) -=========================== +========================================= - fuser: now works with Plan 9 semantics (i.e. what recent kernels use; reported by Harald Koenig, Nick Simicich, and others) @@ -171,7 +172,7 @@ Changes from version 8 to 9 (22-JAN-1995) - updated e-mail address Changes from version 7 to 8 (11-OCT-1994) -=========================== +========================================= - pstree: added -a to display command line arguments - pstree, fuser and killall: display an error message if /proc has diff --git a/configure b/configure index c10e4d3..f9ba1af 100755 --- a/configure +++ b/configure @@ -698,7 +698,7 @@ fi PACKAGE=psmisc -VERSION=20.3 +VERSION=21 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -1648,7 +1648,7 @@ EOF fi -ALL_LINGUAS="en" +ALL_LINGUAS="en pt" # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : diff --git a/configure.in b/configure.in index 382d041..b136257 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/comm.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(psmisc,20.3) +AM_INIT_AUTOMAKE(psmisc,21) dnl Checks for programs. @@ -27,7 +27,7 @@ AC_STRUCT_ST_RDEV AC_TYPE_UID_T dnl Check for language stuff -ALL_LINGUAS="en" +ALL_LINGUAS="en pt" AM_GNU_GETTEXT dnl Checks for library functions. diff --git a/src/fuser.c b/src/fuser.c index 285083c..0703c6d 100644 --- a/src/fuser.c +++ b/src/fuser.c @@ -148,6 +148,10 @@ parse_net_file (SPACE_DSC * dsc,char *filename, NET_CACHE **lastptr,int version FILE *file; NET_CACHE *new, *last; char line[MAX_LINE + 1]; + char rmt_addr[128]; + char addr6[128]; + struct in6_addr in6; + if (!(file = fopen (filename, "r"))) { perror (filename); @@ -163,13 +167,26 @@ parse_net_file (SPACE_DSC * dsc,char *filename, NET_CACHE **lastptr,int version perror ("malloc"); exit (1); } - if (sscanf (line, "%*d: %*x:%x %lx:%x %*x %*x:%*x %*x:%*x %*x %*d %*d " - "%ld", &new->lcl_port, &new->rmt_addr, &new->rmt_port, + if (sscanf (line, "%*d: %*x:%x %64[0-9A-Fa-f]:%x %*x %*x:%*x %*x:%*x %*x %*d %*d " + "%ld", &new->lcl_port, rmt_addr, &new->rmt_port, &new->ino) != 4) { free (new); continue; } + if (strlen(rmt_addr) > 8) { + sscanf(rmt_addr, "%08X%08X%08X%08X", + &((struct sockaddr_in6 *)&new->rmt_addr)->sin6_addr.s6_addr32[0], + &((struct sockaddr_in6 *)&new->rmt_addr)->sin6_addr.s6_addr32[1], + &((struct sockaddr_in6 *)&new->rmt_addr)->sin6_addr.s6_addr32[2], + &((struct sockaddr_in6 *)&new->rmt_addr)->sin6_addr.s6_addr32[3]); + inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&new->rmt_addr)->sin6_addr, addr6, sizeof(addr6)); + printf("address %s\n", addr6); + } else { + sscanf(rmt_addr, "%X", + &((struct sockaddr_in *) &new->rmt_addr)->sin_addr.s_addr); + ((struct sockaddr *) &new->rmt_addr)->sa_family = AF_INET; + } if (!new->ino) { free (new); @@ -794,10 +811,10 @@ enter_item (const char *name, int flags, int sig_number, dev_t dev, static int parse_inet (const char *spec, const char *name_space, int *lcl_port, - unsigned long *rmt_addr, int *rmt_port) + struct sockaddr_storage *rmt_addr, int *rmt_port) { char *s, *here, *next, *end; - int port, field; + int port, field, address_match; if (!(s = strdup (spec))) { @@ -805,8 +822,9 @@ parse_inet (const char *spec, const char *name_space, int *lcl_port, exit (1); } *lcl_port = *rmt_port = -1; - *rmt_addr = 0; + memset(rmt_addr, 0, sizeof(struct sockaddr_storage)); field = 0; + address_match = 0; for (here = s; here; here = next ? next + 1 : NULL) { next = strchr (here, ','); @@ -836,16 +854,20 @@ parse_inet (const char *spec, const char *name_space, int *lcl_port, case 1: if (!*here) break; - if ((long) (*rmt_addr = inet_addr (here)) == -1) - { - struct hostent *hostent; - - if (!(hostent = gethostbyname (here))) - return 0; - if (hostent->h_addrtype != AF_INET) - return 0; - memcpy (rmt_addr, hostent->h_addr, hostent->h_length); - } + if (!ipv4only) { + + if (inet_pton(AF_INET6, here, &((struct sockaddr_in6*)rmt_addr)->sin6_addr) > 0) { + address_match = 1; + rmt_addr->ss_family = AF_INET6; + } + } + if (!ipv6only && !address_match) { + if (inet_pton(AF_INET, here, &((struct sockaddr_in*)rmt_addr)->sin_addr) > 0) { + address_match = 1; + rmt_addr->ss_family = AF_INET6; + } + } + break; default: return 0; @@ -1076,7 +1098,7 @@ main (int argc, char **argv) else { NET_CACHE *walk; - unsigned long rmt_addr; + struct sockaddr_storage rmt_addr; int lcl_port, rmt_port; if (flags & FLAG_DEV) @@ -1093,14 +1115,15 @@ main (int argc, char **argv) this_name_space->name); continue; } - /* XXX fixme for (walk = this_name_space->cache; walk; walk = walk->next) if ((lcl_port == -1 || walk->lcl_port == lcl_port) && - (!rmt_addr || walk->rmt_addr == rmt_addr) && + (rmt_addr.ss_family = 0|| ( memcmp( + &((struct sockaddr_in6*)&walk->rmt_addr)->sin6_addr, + &((struct sockaddr_in6*)&rmt_addr)->sin6_addr, + sizeof(struct in6_addr)) == 0) ) && (rmt_port == -1 || walk->rmt_port == rmt_port)) enter_item (*argv, flags, sig_number, net_dev, walk->ino, this_name_space); - */ } } } -- 2.40.0