-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid unused filetype, fix formatting of -p headers
- Loading branch information
Bernd Eckenfels
committed
Oct 3, 2008
1 parent
57b70fa
commit 5737940
Showing
1 changed file
with
14 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* NET-3 Networking Distribution for the LINUX operating | ||
* system. | ||
* | ||
* Version: $Id: netstat.c,v 1.58 2008/10/03 01:06:33 ecki Exp $ | ||
* Version: $Id: netstat.c,v 1.59 2008/10/03 01:39:06 ecki Exp $ | ||
* | ||
* Authors: Fred Baumgarten, <[email protected]> | ||
* Fred N. van Kempen, <[email protected]> | ||
|
@@ -229,7 +229,7 @@ static char prg_cache_loaded = 0; | |
|
||
#define PROGNAME_BANNER "PID/Program name" | ||
|
||
#define print_progname_banner() do { if (flag_prg) printf("%-" PROGNAME_WIDTHs "s"," " PROGNAME_BANNER); } while (0) | ||
#define print_progname_banner() do { if (flag_prg) printf(" %-" PROGNAME_WIDTHs "s",PROGNAME_BANNER); } while (0) | ||
|
||
#define PRG_LOCAL_ADDRESS "local_address" | ||
#define PRG_INODE "inode" | ||
|
@@ -249,8 +249,6 @@ static char prg_cache_loaded = 0; | |
#define PATH_PROC_X_FD PATH_PROC "/%s/" PATH_FD_SUFF | ||
#define PATH_CMDLINE "cmdline" | ||
#define PATH_CMDLINEl strlen(PATH_CMDLINE) | ||
/* NOT working as of glibc-2.0.7: */ | ||
#undef DIRENT_HAVE_D_TYPE_WORKS | ||
|
||
static void prg_cache_add(unsigned long inode, char *name) | ||
{ | ||
|
@@ -362,9 +360,6 @@ static void prg_cache_load(void) | |
cmdlbuf[sizeof(cmdlbuf)-1]='\0'; | ||
if (!(dirproc=opendir(PATH_PROC))) goto fail; | ||
while (errno=0,direproc=readdir(dirproc)) { | ||
#ifdef DIRENT_HAVE_D_TYPE_WORKS | ||
if (direproc->d_type!=DT_DIR) continue; | ||
#endif | ||
for (cs=direproc->d_name;*cs;cs++) | ||
if (!isdigit(*cs)) | ||
break; | ||
|
@@ -383,10 +378,9 @@ static void prg_cache_load(void) | |
line[procfdlen] = '/'; | ||
cmdlp = NULL; | ||
while ((direfd = readdir(dirfd))) { | ||
#ifdef DIRENT_HAVE_D_TYPE_WORKS | ||
if (direfd->d_type!=DT_LNK) | ||
continue; | ||
#endif | ||
/* Skip . and .. */ | ||
if (!isdigit(direfd->d_name[0])) | ||
continue; | ||
if (procfdlen+1+strlen(direfd->d_name)+1>sizeof(line)) | ||
continue; | ||
memcpy(line + procfdlen - PATH_FD_SUFFl, PATH_FD_SUFF "/", | ||
|
@@ -537,12 +531,12 @@ static void finish_this_one(int uid, unsigned long inode, const char *timers) | |
printf(" %-10s ", pw->pw_name); | ||
else | ||
printf(" %-10d ", uid); | ||
printf("%-10lu ",inode); | ||
printf("%-10lu",inode); | ||
} | ||
if (flag_prg) | ||
printf("%-" PROGNAME_WIDTHs "s",prg_cache_get(inode)); | ||
printf(" %-" PROGNAME_WIDTHs "s",prg_cache_get(inode)); | ||
if (flag_opt) | ||
printf("%s", timers); | ||
printf(" %s", timers); | ||
putchar('\n'); | ||
} | ||
|
||
|
@@ -1218,12 +1212,13 @@ static void unix_do_one(int nr, const char *line) | |
printf("%-5s %-6ld %-11s %-10s %-13s ", | ||
ss_proto, refcnt, ss_flags, ss_type, ss_state); | ||
if (has & HAS_INODE) | ||
printf("%-8lu ",inode); | ||
printf("%-8lu",inode); | ||
else | ||
printf("- "); | ||
printf("- "); | ||
if (flag_prg) | ||
printf("%-" PROGNAME_WIDTHs "s",(has & HAS_INODE?prg_cache_get(inode):"-")); | ||
puts(path); | ||
printf(" %-" PROGNAME_WIDTHs "s",(has & HAS_INODE?prg_cache_get(inode):"-")); | ||
|
||
printf(" %s\n", path); | ||
} | ||
|
||
static int unix_info(void) | ||
|
@@ -1239,7 +1234,7 @@ static int unix_info(void) | |
printf(_("(w/o servers)")); | ||
} | ||
|
||
printf(_("\nProto RefCnt Flags Type State I-Node")); | ||
printf(_("\nProto RefCnt Flags Type State I-Node ")); | ||
print_progname_banner(); | ||
printf(_(" Path\n")); /* xxx */ | ||
|
||
|