Hi,

here is yet another (trivial, I hope) patch.

It makes pretty_id behave as (I expect) it was supposed to.

It involves: Incrementing ``i'' in only one place, skipping over
``groups='' only once, counting ")" (twice), fixing 2 printf-formats and
setting ``n'' to 1 if it is 0.


ChangeLog-entry:

2004-10-14  Bas van Gompel  <[EMAIL PROTECTED]>

        * cygcheck.cc (pretty_id): Correct layout.


--- src/winsup/utils/cygcheck.cc        10 Oct 2004 17:07:23 -0000      1.48
+++ src/winsup/utils/cygcheck.cc        14 Oct 2004 12:44:21 -0000
@@ -820,14 +820,16 @@ pretty_id (const char *s, char *cygwin, 
     }
 
   printf ("\nOutput from %s (%s)\n", id, s);
-  size_t szmaybe = strlen ("UID: ") + strlen (uid);
+  size_t szmaybe = strlen ("UID: )") + strlen (uid);
   if (sz < szmaybe)
     sz = szmaybe;
   sz += 1;
   int n = 80 / (int) sz;
+  if (!n)
+    n = 1;
   sz = -sz;
-  ng[0] += strlen ("groups=");
-  printf ("UID: %.*s) GID: %s)\n", sz + (sizeof ("UID: ") - 1), uid, gid);
+  printf ("UID: %s)%*sGID: %s)\n", uid, sz + strlen ("UID: )") + strlen (uid),
+      "", gid);
   int i = 0;
   for (char **g = groups; g < ng; g++)
     {
@@ -838,8 +840,8 @@ pretty_id (const char *s, char *cygwin, 
          i = 0;
          puts ("");
        }
-      if (++i <= n && g != (ng - 1))
-       printf ("%*s ", sz, *g);
+      if (i < n && g != (ng - 1))
+       printf ("%*s", sz, *g);
       else
        {
          printf ("%s\n", *g);


L8r,

Buzz.
-- 
  ) |  | ---/ ---/  Yes, this | This message consists of true | I do not
--  |  |   /    /   really is |   and false bits entirely.    | mail for
  ) |  |  /    /    a 72 by 4 +-------------------------------+ any1 but
--  \--| /--- /---  .sigfile. |   |perl -pe "s.u(z)\1.as."    | me. 4^re

Reply via email to