diff options
author | Eric Andersen | 2001-01-30 18:03:11 +0000 |
---|---|---|
committer | Eric Andersen | 2001-01-30 18:03:11 +0000 |
commit | e57d54b456bf091aded43fc95bee9b05e7461dd0 (patch) | |
tree | ab02892c3929a64304d457f6857a68e01efea145 /utility.c | |
parent | 201dc0d5a99b8ef765f2b79e6a492a70772a0774 (diff) | |
download | busybox-e57d54b456bf091aded43fc95bee9b05e7461dd0.zip busybox-e57d54b456bf091aded43fc95bee9b05e7461dd0.tar.gz |
Fix ls behavior for broken or very narrow terminals. Fix my_*
functions so they comply with the original interface (i.e. don't
exit on error, stringify uids and gids when no amtching name found).
-Erik
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -871,7 +871,7 @@ long my_getpwnam(char *name) myuser = getpwnam(name); if (myuser==NULL) - error_msg_and_die( "unknown username: %s\n", name); + return(-1); return myuser->pw_uid; } @@ -883,7 +883,7 @@ long my_getgrnam(char *name) mygroup = getgrnam(name); if (mygroup==NULL) - error_msg_and_die( "unknown group: %s\n", name); + return(-1); return (mygroup->gr_gid); } @@ -895,9 +895,9 @@ void my_getpwuid(char *name, long uid) myuser = getpwuid(uid); if (myuser==NULL) - error_msg_and_die( "unknown uid %ld\n", (long)uid); - - strcpy(name, myuser->pw_name); + sprintf(name, "%-8ld ", (long)uid); + else + strcpy(name, myuser->pw_name); } /* gets a groupname given a gid */ @@ -907,9 +907,9 @@ void my_getgrgid(char *group, long gid) mygroup = getgrgid(gid); if (mygroup==NULL) - error_msg_and_die( "unknown gid %ld\n", (long)gid); - - strcpy(group, mygroup->gr_name); + sprintf(group, "%-8ld ", (long)gid); + else + strcpy(group, mygroup->gr_name); } #if defined BB_ID |