My slstatus configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

35 行
503 B

  1. /* See LICENSE file for copyright and license details. */
  2. #include <errno.h>
  3. #include <pwd.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <sys/types.h>
  7. #include <unistd.h>
  8. #include "../util.h"
  9. const char *
  10. gid(void)
  11. {
  12. return bprintf("%d", getgid());
  13. }
  14. const char *
  15. username(void)
  16. {
  17. struct passwd *pw;
  18. if (!(pw = getpwuid(geteuid()))) {
  19. warn("getpwuid '%d':", geteuid());
  20. return NULL;
  21. }
  22. return bprintf("%s", pw->pw_name);
  23. }
  24. const char *
  25. uid(void)
  26. {
  27. return bprintf("%d", geteuid());
  28. }