Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4067077a authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Add -n option to ps to print numeric uid"

parents e2f32d05 377cb2ab
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ static char *nexttok(char **strp)
#define SHOW_POLICY 4
#define SHOW_CPU  8
#define SHOW_MACLABEL 16
#define SHOW_NUMERIC_UID 32

static int display_flags = 0;

@@ -138,7 +139,7 @@ static int ps_line(int pid, int tid, char *namefilter)
    }

    pw = getpwuid(stats.st_uid);
    if(pw == 0) {
    if(pw == 0 || (display_flags & SHOW_NUMERIC_UID)) {
        sprintf(user,"%d",(int)stats.st_uid);
    } else {
        strcpy(user,pw->pw_name);
@@ -214,6 +215,8 @@ int ps_main(int argc, char **argv)
    while(argc > 1){
        if(!strcmp(argv[1],"-t")) {
            threads = 1;
        } else if(!strcmp(argv[1],"-n")) {
            display_flags |= SHOW_NUMERIC_UID;
        } else if(!strcmp(argv[1],"-x")) {
            display_flags |= SHOW_TIME;
        } else if(!strcmp(argv[1], "-Z")) {