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.
 
 
 
 
 
 

35 lines
596 B

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