Hello,

I dont know whether this is the right way to submit a patch
representing an idea for improving the id command, but I will
have a try.

The id command doesnt support the passing of a userid instead
of the username. Since I needed this feature I wrote a five
line patch to support this feature. A username may not
start with a digit, so there is no chance of confusion.

Since I never did something like that I send you a patch file
generated by 'diff -Nur id_uid.c id.c > id.patch' against the
most recent sh-utils package at ftp.gnu.org which is version
2.0.

If you are interested in this but not happy with to form
of submission please tell me where to learn the standard
way of submitting a patch.

Yours,
        Florian Wisser
--- id.c        Wed Mar 31 07:28:44 1999
+++ id_uid.c    Sun Dec  2 20:51:45 2001
@@ -167,7 +167,11 @@
 
   if (argc - optind == 1)
     {
-      struct passwd *pwd = getpwnam (argv[optind]);
+      struct passwd *pwd;
+      if (isdigit(argv[optind][0]))
+        pwd = getpwuid ((uid_t) strtol (argv[optind], (char **) NULL, 10));
+      else
+        pwd = getpwnam (argv[optind]);
       if (pwd == NULL)
        error (1, 0, _("%s: No such user"), argv[optind]);
       ruid = euid = pwd->pw_uid;

Reply via email to