My dmenu build
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
694 B

  1. /* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
  2. * See LICENSE file for license details.
  3. */
  4. #include "dmenu.h"
  5. #include <stdarg.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <sys/wait.h>
  10. #include <unistd.h>
  11. void *
  12. emalloc(unsigned int size) {
  13. void *res = malloc(size);
  14. if(!res)
  15. eprint("fatal: could not malloc() %u bytes\n", size);
  16. return res;
  17. }
  18. void
  19. eprint(const char *errstr, ...) {
  20. va_list ap;
  21. va_start(ap, errstr);
  22. vfprintf(stderr, errstr, ap);
  23. va_end(ap);
  24. exit(EXIT_FAILURE);
  25. }
  26. char *
  27. estrdup(const char *str) {
  28. void *res = strdup(str);
  29. if(!res)
  30. eprint("fatal: could not malloc() %u bytes\n", strlen(str));
  31. return res;
  32. }