util.h 652 B

12345678910111213141516171819202122232425262728
  1. #ifndef __UTIL_H__
  2. #define __UTIL_H__
  3. #include <cdefs.h>
  4. int argbits(char* key, char* arg);
  5. char* basename(char* path);
  6. char* getenv(char** envp, char* key);
  7. typedef int (*qcmp2)(void* a, void* b);
  8. typedef int (*qcmp3)(void* a, void* b, long opts);
  9. void qsortp(void* ptrs, size_t n, qcmp2 cmp);
  10. void qsortx(void* ptrs, size_t n, qcmp3 cmp, long opts);
  11. long writeall(int fd, const void* buf, long len);
  12. long execvpe(char* file, char** argv, char** envp);
  13. int getifindex(int fd, char* ifname);
  14. void warn(const char* msg, const char* obj, int err);
  15. void fail(const char* msg, const char* obj, int err) noreturn;
  16. void _exit(int) noreturn;
  17. #endif