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.
 
 
 
 

33 line
464 B

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