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.
 
 
 
 
 
 

37 lines
712 B

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