Changeset 445:98a28217dc32 in roaraudio


Ignore:
Timestamp:
08/12/08 01:16:32 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added resolv of user and group name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarctl.c

    r438 r445  
    22 
    33#include <roaraudio.h> 
     4#include <pwd.h> 
     5#include <grp.h> 
     6 
    47 
    58int display_mixer (struct roar_connection * con, int stream); 
     
    6669 int id[ROAR_CLIENTS_MAX]; 
    6770 struct roar_client c; 
     71 struct group  * grp = NULL; 
     72 struct passwd * pwd = NULL; 
    6873 
    6974 if ( (num = roar_list_clients(con, id, ROAR_CLIENTS_MAX)) == -1 ) { 
     
    8085  printf("Player name           : %s\n", c.name); 
    8186  printf("Player PID            : %i\n", c.pid); 
    82   if ( c.uid != -1 ) 
    83    printf("Player UID/GID        : %i/%i\n", c.uid, c.gid); 
     87  if ( c.uid != -1 ) { 
     88   pwd = getpwuid(c.uid); 
     89   grp = getgrgid(c.gid); 
     90   printf("Player UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?"); 
     91  } 
    8492  if ( c.execed != -1 ) 
    8593   printf("Execed stream         : %i\n", c.execed); 
Note: See TracChangeset for help on using the changeset viewer.