My slstatus configuration
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

32 Zeilen
510 B

  1. /* See LICENSE file for copyright and license details. */
  2. #include <dirent.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include "../util.h"
  6. const char *
  7. num_files(const char *path)
  8. {
  9. struct dirent *dp;
  10. DIR *fd;
  11. int num;
  12. if (!(fd = opendir(path))) {
  13. warn("opendir '%s':", path);
  14. return NULL;
  15. }
  16. num = 0;
  17. while ((dp = readdir(fd))) {
  18. if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) {
  19. continue; /* skip self and parent */
  20. }
  21. num++;
  22. }
  23. closedir(fd);
  24. return bprintf("%d", num);
  25. }