mirror of
https://repo.or.cz/socat.git
synced 2024-12-23 07:52:32 +00:00
improved dev_t print format definition
This commit is contained in:
parent
2b1eabd058
commit
019cce7611
6 changed files with 31 additions and 28 deletions
2
CHANGES
2
CHANGES
|
@ -89,6 +89,8 @@ corrections:
|
||||||
fixed configure.in bug on net/if.h check that caused IF_NAMESIZE to be
|
fixed configure.in bug on net/if.h check that caused IF_NAMESIZE to be
|
||||||
undefined
|
undefined
|
||||||
|
|
||||||
|
improved dev_t print format definition
|
||||||
|
|
||||||
docu mentions option so-bindtodev but correct name is so-bindtodevice.
|
docu mentions option so-bindtodev but correct name is so-bindtodevice.
|
||||||
Thanks to Jim Zimmerman for reporting.
|
Thanks to Jim Zimmerman for reporting.
|
||||||
|
|
||||||
|
|
40
compat.h
40
compat.h
|
@ -304,27 +304,27 @@
|
||||||
|
|
||||||
|
|
||||||
/* all unsigned; default: unsigned long */
|
/* all unsigned; default: unsigned long */
|
||||||
#if !defined(HAVE_TYPEOF_ST_DEV) || !HAVE_TYPEOF_ST_DEV
|
#if !defined(HAVE_BASIC_DEV_T) || !HAVE_BASIC_DEV_T
|
||||||
# undef HAVE_TYPEOF_ST_DEV
|
# undef HAVE_BASIC_DEV_T
|
||||||
# define HAVE_TYPEOF_ST_DEV 6
|
# define HAVE_BASIC_DEV_T 6
|
||||||
#endif
|
#endif
|
||||||
#ifndef F_st_dev
|
#ifndef F_dev
|
||||||
# if HAVE_TYPEOF_ST_DEV==1
|
# if HAVE_BASIC_DEV_T==1
|
||||||
#define F_st_dev "%hd"
|
#define F_dev "%hd"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==2
|
# elif HAVE_BASIC_DEV_T==2
|
||||||
#define F_st_dev "%hu"
|
#define F_dev "%hu"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==3
|
# elif HAVE_BASIC_DEV_T==3
|
||||||
#define F_st_dev "%d"
|
#define F_dev "%d"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==4
|
# elif HAVE_BASIC_DEV_T==4
|
||||||
#define F_st_dev "%u"
|
#define F_dev "%u"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==5
|
# elif HAVE_BASIC_DEV_T==5
|
||||||
#define F_st_dev "%ld"
|
#define F_dev "%ld"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==6
|
# elif HAVE_BASIC_DEV_T==6
|
||||||
#define F_st_dev "%lu"
|
#define F_dev "%lu"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==7
|
# elif HAVE_BASIC_DEV_T==7
|
||||||
#define F_st_dev "%Ld"
|
#define F_dev "%Ld"
|
||||||
# elif HAVE_TYPEOF_ST_DEV==8
|
# elif HAVE_BASIC_DEV_T==8
|
||||||
#define F_st_dev "%Lu"
|
#define F_dev "%Lu"
|
||||||
# else
|
# else
|
||||||
#error "HAVE_TYPEOF_ST_DEV is out of range:" HAVE_TYPEOF_ST_DEV
|
#error "HAVE_TYPEOF_ST_DEV is out of range:" HAVE_TYPEOF_ST_DEV
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -456,10 +456,10 @@
|
||||||
#undef HAVE_BASIC_TIME_T
|
#undef HAVE_BASIC_TIME_T
|
||||||
#undef HAVE_BASIC_OFF_T
|
#undef HAVE_BASIC_OFF_T
|
||||||
#undef HAVE_BASIC_OFF64_T
|
#undef HAVE_BASIC_OFF64_T
|
||||||
|
#undef HAVE_BASIC_DEV_T
|
||||||
|
|
||||||
#undef HAVE_BASIC_SOCKLEN_T
|
#undef HAVE_BASIC_SOCKLEN_T
|
||||||
|
|
||||||
#undef HAVE_TYPEOF_ST_DEV
|
|
||||||
#undef HAVE_TYPEOF_ST_INO
|
#undef HAVE_TYPEOF_ST_INO
|
||||||
#undef HAVE_TYPEOF_ST_NLINK
|
#undef HAVE_TYPEOF_ST_NLINK
|
||||||
#undef HAVE_TYPEOF_ST_SIZE
|
#undef HAVE_TYPEOF_ST_SIZE
|
||||||
|
|
|
@ -1446,7 +1446,8 @@ AC_BASIC_TYPE([#include <sys/types.h>
|
||||||
#include <unistd.h>], off64_t, HAVE_BASIC_OFF64_T, sc_cv_type_off64_basic)
|
#include <unistd.h>], off64_t, HAVE_BASIC_OFF64_T, sc_cv_type_off64_basic)
|
||||||
|
|
||||||
# oh god, __dev_t in Linux 2.4 is struct{int[2];}, not handled here yet.
|
# oh god, __dev_t in Linux 2.4 is struct{int[2];}, not handled here yet.
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_dev, HAVE_TYPEOF_ST_DEV, sc_cv_type_stat_stdev_basic)
|
AC_BASIC_TYPE([#include <sys/stat.h>], dev_t, HAVE_BASIC_DEV_T, sc_cv_type_dev_basic)
|
||||||
|
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_ino, HAVE_TYPEOF_ST_INO, sc_cv_type_stat_stino_basic)
|
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_ino, HAVE_TYPEOF_ST_INO, sc_cv_type_stat_stino_basic)
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_nlink, HAVE_TYPEOF_ST_NLINK, sc_cv_type_stat_stnlink_basic)
|
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_nlink, HAVE_TYPEOF_ST_NLINK, sc_cv_type_stat_stnlink_basic)
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_size, HAVE_TYPEOF_ST_SIZE, sc_cv_type_stat_stsize_basic)
|
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_size, HAVE_TYPEOF_ST_SIZE, sc_cv_type_stat_stsize_basic)
|
||||||
|
|
2
filan.c
2
filan.c
|
@ -263,7 +263,7 @@ int filan_stat(
|
||||||
headprinted = 1;
|
headprinted = 1;
|
||||||
}
|
}
|
||||||
if (filan_rawoutput) {
|
if (filan_rawoutput) {
|
||||||
snprintf(stdevstr, 8, F_st_dev, buf->st_dev);
|
snprintf(stdevstr, 8, F_dev, buf->st_dev);
|
||||||
} else {
|
} else {
|
||||||
snprintf(stdevstr, 8, "%hu,%hu", (unsigned short)buf->st_dev>>8, (unsigned short)buf->st_dev&0xff);
|
snprintf(stdevstr, 8, "%hu,%hu", (unsigned short)buf->st_dev>>8, (unsigned short)buf->st_dev&0xff);
|
||||||
}
|
}
|
||||||
|
|
10
sycls.c
10
sycls.c
|
@ -333,7 +333,7 @@ int Gettimeofday(struct timeval *tv, struct timezone *tz) {
|
||||||
|
|
||||||
int Mknod(const char *pathname, mode_t mode, dev_t dev) {
|
int Mknod(const char *pathname, mode_t mode, dev_t dev) {
|
||||||
int result, _errno;
|
int result, _errno;
|
||||||
Debug3("mknod(\"%s\", 0%o, %d)", pathname, mode, dev);
|
Debug3("mknod(\"%s\", 0%o, "F_dev")", pathname, mode, dev);
|
||||||
result = mknod(pathname, mode, dev);
|
result = mknod(pathname, mode, dev);
|
||||||
_errno = errno;
|
_errno = errno;
|
||||||
Debug1("mknod() -> %d", result);
|
Debug1("mknod() -> %d", result);
|
||||||
|
@ -354,11 +354,11 @@ int Mkfifo(const char *pathname, mode_t mode) {
|
||||||
static void prtstat(const char *func, struct stat *buf, int result) {
|
static void prtstat(const char *func, struct stat *buf, int result) {
|
||||||
char txt[256], *t = txt;
|
char txt[256], *t = txt;
|
||||||
|
|
||||||
t += sprintf(t, "%s(, {"F_st_dev","F_st_ino","F_mode","F_st_nlink","F_uid","F_gid,
|
t += sprintf(t, "%s(, {"F_dev","F_st_ino","F_mode","F_st_nlink","F_uid","F_gid,
|
||||||
func, buf->st_dev, buf->st_ino,
|
func, buf->st_dev, buf->st_ino,
|
||||||
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
|
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
|
||||||
#if HAVE_ST_RDEV
|
#if HAVE_ST_RDEV
|
||||||
t += sprintf(t, ","F_st_dev, buf->st_rdev);
|
t += sprintf(t, ","F_dev, buf->st_rdev);
|
||||||
#endif
|
#endif
|
||||||
t += sprintf(t, ","F_st_size, buf->st_size);
|
t += sprintf(t, ","F_st_size, buf->st_size);
|
||||||
#if HAVE_ST_BLKSIZE
|
#if HAVE_ST_BLKSIZE
|
||||||
|
@ -378,11 +378,11 @@ static void prtstat64(const char *func, struct stat64 *buf, int result) {
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
sprintf(t, "%s(, {}) -> %d", func, result);
|
sprintf(t, "%s(, {}) -> %d", func, result);
|
||||||
} else {
|
} else {
|
||||||
t += sprintf(t, "%s(, {"F_st_dev","F_st64_ino","F_mode","F_st_nlink","F_uid","F_gid,
|
t += sprintf(t, "%s(, {"F_dev","F_st64_ino","F_mode","F_st_nlink","F_uid","F_gid,
|
||||||
func, buf->st_dev, buf->st_ino,
|
func, buf->st_dev, buf->st_ino,
|
||||||
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
|
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
|
||||||
#if HAVE_ST_RDEV
|
#if HAVE_ST_RDEV
|
||||||
t += sprintf(t, ","F_st_dev, buf->st_rdev);
|
t += sprintf(t, ","F_dev, buf->st_rdev);
|
||||||
#endif
|
#endif
|
||||||
t += sprintf(t, ","F_st64_size, buf->st_size);
|
t += sprintf(t, ","F_st64_size, buf->st_size);
|
||||||
#if HAVE_ST_BLKSIZE
|
#if HAVE_ST_BLKSIZE
|
||||||
|
|
Loading…
Reference in a new issue