X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Fterm.priv.h;fp=ncurses%2Fterm.priv.h;h=7b2579c854f783cc486357e13a55ee49c9926e7f;hb=bd2d9c5734d2c66abe0b2ddd766695b200c154fe;hp=37547180a02bec5744edd38e6763715c0cf4b7f3;hpb=a1c9e77bebcdf278d9c290a97c82961e159cd896;p=ncurses.git diff --git a/ncurses/term.priv.h b/ncurses/term.priv.h index 37547180..7b2579c8 100644 --- a/ncurses/term.priv.h +++ b/ncurses/term.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2021,2023 Thomas E. Dickey * + * Copyright 2021-2023,2024 Thomas E. Dickey * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /* - * $Id: term.priv.h,v 1.8 2023/09/16 15:16:38 tom Exp $ + * $Id: term.priv.h,v 1.12 2024/02/24 18:11:38 tom Exp $ * * term.priv.h * @@ -53,7 +53,12 @@ extern "C" { #define NCURSES_INTERNALS 1 #define NCURSES_OPAQUE 0 -#include /* PATH_MAX */ +#if HAVE_LIMITS_H +# include /* PATH_MAX, MB_LEN_MAX, etc */ +#elif HAVE_SYS_PARAM_H +# include +#endif + #include /* sig_atomic_t */ #include /* time_t */ #include /* time_t */ @@ -64,6 +69,28 @@ extern "C" { #endif #endif +/* + * If not properly configured to use the system's limits.h, we get gcc's + * fallback for limits.h which sets MB_LEN_MAX to 1, which is never correct. + */ +#if defined(MB_LEN_MAX) && (MB_LEN_MAX < 6) +#undef MB_LEN_MAX +#endif + +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 16 /* should be >= MB_CUR_MAX, but that may be a function */ +#endif + +#ifndef PATH_MAX +# if defined(_POSIX_PATH_MAX) +# define PATH_MAX _POSIX_PATH_MAX +# elif defined(MAXPATHLEN) +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 255 /* the Posix minimum path-size */ +# endif +#endif + /* * State of tparm(). */ @@ -241,7 +268,6 @@ typedef struct { #ifdef TRACE bool trace_opened; - char trace_fname[PATH_MAX]; int trace_level; FILE * trace_fp; int trace_fd;