dmenu for lunch applications in dwm
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.

38 lines
688 B

18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. /* (C)opyright MMVI 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. char *
  19. estrdup(const char *str) {
  20. void *res = strdup(str);
  21. if(!res)
  22. eprint("fatal: could not malloc() %u bytes\n", strlen(str));
  23. return res;
  24. }
  25. void
  26. eprint(const char *errstr, ...) {
  27. va_list ap;
  28. va_start(ap, errstr);
  29. vfprintf(stderr, errstr, ap);
  30. va_end(ap);
  31. exit(EXIT_FAILURE);
  32. }