morpheus-base

morpheus base system
git clone git://git.2f30.org/morpheus-base
Log | Files | Refs

util.h (1346B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <sys/types.h>
      3 
      4 #include <regex.h>
      5 #include <stddef.h>
      6 
      7 #include "arg.h"
      8 #include "compat.h"
      9 
     10 #define UTF8_POINT(c) (((c) & 0xc0) != 0x80)
     11 
     12 #undef MIN
     13 #define MIN(x,y)  ((x) < (y) ? (x) : (y))
     14 #undef MAX
     15 #define MAX(x,y)  ((x) > (y) ? (x) : (y))
     16 
     17 #define LEN(x) (sizeof (x) / sizeof *(x))
     18 
     19 extern char *argv0;
     20 
     21 char *agetcwd(void);
     22 void apathmax(char **, long *);
     23 
     24 void *ecalloc(size_t, size_t);
     25 void *emalloc(size_t size);
     26 void *erealloc(void *, size_t);
     27 char *estrdup(const char *);
     28 
     29 void enprintf(int, const char *, ...);
     30 void eprintf(const char *, ...);
     31 void weprintf(const char *, ...);
     32 
     33 double estrtod(const char *);
     34 long estrtol(const char *, int);
     35 
     36 #undef strcasestr
     37 char *strcasestr(const char *, const char *);
     38 
     39 #undef strlcat
     40 size_t strlcat(char *, const char *, size_t);
     41 #undef strlcpy
     42 size_t strlcpy(char *, const char *, size_t);
     43 
     44 /* regex */
     45 int enregcomp(int, regex_t *, const char *, int);
     46 int eregcomp(regex_t *, const char *, int);
     47 
     48 /* misc */
     49 void enmasse(int, char **, int (*)(const char *, const char *));
     50 void fnck(const char *, const char *, int (*)(const char *, const char *));
     51 mode_t getumask(void);
     52 char *humansize(double);
     53 mode_t parsemode(const char *, mode_t, mode_t);
     54 void putword(const char *);
     55 void recurse(const char *, void (*)(const char *));