diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 63277c900..2aac863b2 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2003-06-12 Christopher Faylor + + * cygcheck.cc (pretty_id): Rework slightly to not rely on spaces. + 2003-06-12 Christopher Faylor * cygpath.cc: Throughout, always return error when GetShortPathName diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index 34522d50d..a6b0f4d1c 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -784,8 +784,8 @@ pretty_id (const char *s, char *cygwin, size_t cyglen) char buf[16384]; fgets (buf, sizeof (buf), f); - char *uid = strtok (buf, " ") + sizeof ("uid=") - 1; - char *gid = strtok (NULL, " ") + sizeof ("gid=") - 1; + char *uid = strtok (buf, ")") + strlen ("uid="); + char *gid = strtok (NULL, ")") + strlen ("gid=") + 1; char **ng; size_t sz = 0; for (ng = groups; (*ng = strtok (NULL, ",")); ng++) @@ -794,21 +794,21 @@ pretty_id (const char *s, char *cygwin, size_t cyglen) if (p) *p = '\0'; if (ng == groups) - *ng += sizeof ("groups=") - 1; + *ng += strlen (" groups="); size_t len = strlen (*ng); if (sz < len) sz = len; } - printf ("\n%s output (%s)\n", id, s); - int szmaybe = sizeof ("UID: ") + strlen (uid) - 1; + printf ("\nOutput from %s (%s)\n", id, s); + int szmaybe = strlen ("UID: ") + strlen (uid); if (sz < szmaybe) sz = szmaybe; sz += 1; int n = 80 / (int) sz; sz = -sz; - ng[0] += sizeof ("groups=") - 1; - printf ("UID: %*s GID: %s\n", sz + (sizeof ("UID: ") - 1), uid, gid); + ng[0] += strlen ("groups="); + printf ("UID: %.*s) GID: %s)\n", sz + (sizeof ("UID: ") - 1), uid, gid); int i = 0; for (char **g = groups; g < ng; g++) {