diff options
author | Christopher Faylor <me@cgf.cx> | 2003-06-13 06:36:12 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-06-13 06:36:12 +0400 |
commit | 6806f4f6e28562271e14c503a945c1625337240e (patch) | |
tree | 5f4129221fc6aa436a0e6d37a27b18598615e8bd | |
parent | 8d60a6029c1b4cd28b7ede9263705a9c026e6d6f (diff) |
* cygcheck.cc (pretty_id): Rework slightly to not rely on spaces.
-rw-r--r-- | winsup/utils/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/utils/cygcheck.cc | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 63277c900..2aac863b2 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,5 +1,9 @@ 2003-06-12 Christopher Faylor <cgf@redhat.com> + * cygcheck.cc (pretty_id): Rework slightly to not rely on spaces. + +2003-06-12 Christopher Faylor <cgf@redhat.com> + * cygpath.cc: Throughout, always return error when GetShortPathName returns 0. 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++) { |