From 3a9c3f3fb757dd04b8ac44c575c65dda6bae054b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 29 May 2012 10:08:25 +0200 Subject: [PATCH] include/c: move fallback for MAXHOSTNAMELEN to c.h Reported-by: Thomas Schwinge Signed-off-by: Karel Zak --- include/c.h | 11 +++++++++++ term-utils/agetty.c | 8 -------- term-utils/wall.c | 8 -------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/c.h b/include/c.h index 8c8db73324..40d289bf7b 100644 --- a/include/c.h +++ b/include/c.h @@ -222,6 +222,17 @@ static inline int dirfd(DIR *d) #define IUTF8 0040000 #endif +/* + * Fallback for MAXHOSTNAMELEN + */ +#ifndef MAXHOSTNAMELEN +# ifdef HOST_NAME_MAX +# define MAXHOSTNAMELEN HOST_NAME_MAX +# else +# define MAXHOSTNAMELEN 64 +# endif +#endif + /* * Constant strings for usage() functions. For more info see * Documentation/howto-usage-function.txt and sys-utils/arch.c diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 36e00eb44f..9101e7fd38 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -119,14 +119,6 @@ #define DEF_EOL 0 #define DEF_SWITCH 0 /* default switch char */ -#ifndef MAXHOSTNAMELEN -# ifdef HOST_NAME_MAX -# define MAXHOSTNAMELEN HOST_NAME_MAX -# else -# define MAXHOSTNAMELEN 64 -# endif /* HOST_NAME_MAX */ -#endif /* MAXHOSTNAMELEN */ - /* * When multiple baud rates are specified on the command line, the first one * we will try is the first one specified. diff --git a/term-utils/wall.c b/term-utils/wall.c index ec9e93236d..0291a5b609 100644 --- a/term-utils/wall.c +++ b/term-utils/wall.c @@ -72,14 +72,6 @@ #define IGNOREUSER "sleeper" #define WRITE_TIME_OUT 300 /* in seconds */ -#ifndef MAXHOSTNAMELEN -# ifdef HOST_NAME_MAX -# define MAXHOSTNAMELEN HOST_NAME_MAX -# else -# define MAXHOSTNAMELEN 64 -# endif -#endif - /* Function prototypes */ char *makemsg(char *fname, size_t *mbufsize, int print_banner); static void usage(FILE *out); -- 2.47.3