My slstatus configuration
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.
 
 
 
 

32 lines
403 B

  1. #include <err.h>
  2. #include <pwd.h>
  3. #include <sys/types.h>
  4. #include <unistd.h>
  5. #include "util.h"
  6. const char *
  7. gid(void)
  8. {
  9. return bprintf("%d", getgid());
  10. }
  11. const char *
  12. username(void)
  13. {
  14. struct passwd *pw = getpwuid(geteuid());
  15. if (pw == NULL) {
  16. warn("Failed to get username");
  17. return NULL;
  18. }
  19. return bprintf("%s", pw->pw_name);
  20. }
  21. const char *
  22. uid(void)
  23. {
  24. return bprintf("%d", geteuid());
  25. }