noice

small file browser
git clone git://git.2f30.org/noice
Log | Files | Refs | README | LICENSE

util.h (913B)


      1 /* See LICENSE file for copyright and license details. */
      2 #undef MIN
      3 #define MIN(x, y) ((x) < (y) ? (x) : (y))
      4 #define LEN(x) (sizeof(x) / sizeof(*(x)))
      5 #define NR_ARGS	32
      6 
      7 #undef dprintf
      8 int dprintf(int, const char *, ...);
      9 #undef strlcat
     10 size_t strlcat(char *, const char *, size_t);
     11 #undef strlcpy
     12 size_t strlcpy(char *, const char *, size_t);
     13 int strverscmp(const char *, const char *);
     14 int spawnvp(char *, char *, char *[]);
     15 int spawnlp(char *, char *, char *, ...);
     16 
     17 #ifdef DEBUG
     18 #define DEBUG_FD 8
     19 #define DPRINTF_D(x) dprintf(DEBUG_FD, #x "=%d\n", x)
     20 #define DPRINTF_U(x) dprintf(DEBUG_FD, #x "=%u\n", x)
     21 #define DPRINTF_S(x) dprintf(DEBUG_FD, #x "=%s\n", x)
     22 #define DPRINTF_P(x) dprintf(DEBUG_FD, #x "=0x%p\n", x)
     23 #define DPRINTF_LLU(x) dprintf(DEBUG_FD, #x "=%llu\n", x)
     24 #else
     25 #define DPRINTF_D(x)
     26 #define DPRINTF_U(x)
     27 #define DPRINTF_S(x)
     28 #define DPRINTF_P(x)
     29 #define DPRINTF_LLU(x)
     30 #endif /* DEBUG */