Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

27 lines
660 B

  1. /* dwm will keep pid's of processes from autostart array and kill them at quit */
  2. static pid_t *autostart_pids;
  3. static size_t autostart_len;
  4. /* execute command from autostart array */
  5. static void
  6. autostart_exec()
  7. {
  8. const char *const *p;
  9. size_t i = 0;
  10. /* count entries */
  11. for (p = autostart; *p; autostart_len++, p++)
  12. while (*++p);
  13. autostart_pids = malloc(autostart_len * sizeof(pid_t));
  14. for (p = autostart; *p; i++, p++) {
  15. if ((autostart_pids[i] = fork()) == 0) {
  16. setsid();
  17. execvp(*p, (char *const *)p);
  18. fprintf(stderr, "dwm: execvp %s\n", *p);
  19. perror(" failed");
  20. _exit(EXIT_FAILURE);
  21. }
  22. /* skip arguments */
  23. while (*++p);
  24. }
  25. }