mirror of
https://repo.or.cz/socat.git
synced 2025-07-11 22:23:24 +00:00
filan -s prefixes output with FD number if more than one FD
This commit is contained in:
parent
d70b8963aa
commit
9809b977e2
4 changed files with 26 additions and 11 deletions
7
fdname.c
7
fdname.c
|
@ -1,5 +1,5 @@
|
|||
/* source: fdname.c */
|
||||
/* Copyright Gerhard Rieger 2003-2007 */
|
||||
/* Copyright Gerhard Rieger 2003-2008 */
|
||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||
|
||||
/* the subroutine sockname prints the basic info about the address of a socket
|
||||
|
@ -32,7 +32,7 @@ int unixame(int fd, FILE *outfile);
|
|||
int tcpname(int fd, FILE *outfile);
|
||||
|
||||
|
||||
int fdname(const char *file, int fd, FILE *outfile) {
|
||||
int fdname(const char *file, int fd, FILE *outfile, const char *numform) {
|
||||
struct stat buf = {0};
|
||||
int filetype;
|
||||
Debug1("checking file descriptor %u", fd);
|
||||
|
@ -46,6 +46,9 @@ int fdname(const char *file, int fd, FILE *outfile) {
|
|||
}
|
||||
}
|
||||
filetype = (buf.st_mode&S_IFMT)>>12;
|
||||
if (numform != NULL) {
|
||||
fprintf(outfile, numform, fd);
|
||||
}
|
||||
return statname(file, fd, filetype, outfile);
|
||||
} else {
|
||||
if (Stat(file, &buf) < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue