summaryrefslogtreecommitdiff
path: root/usr/src/common/util
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/common/util')
-rw-r--r--usr/src/common/util/string.c7
-rw-r--r--usr/src/common/util/string.h1
-rw-r--r--usr/src/common/util/strtolctype.h4
3 files changed, 9 insertions, 3 deletions
diff --git a/usr/src/common/util/string.c b/usr/src/common/util/string.c
index d54b58d59c..80a076c436 100644
--- a/usr/src/common/util/string.c
+++ b/usr/src/common/util/string.c
@@ -21,6 +21,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2014 Joyent, Inc. All rights reserved.
*/
/*
@@ -264,7 +265,7 @@ next_fmt:
if (sign && pad == '0')
ADDCHAR('-');
- while (width-- > sign)
+ while ((!left_align) && (width-- > sign))
ADDCHAR(pad);
if (sign && pad == ' ')
ADDCHAR('-');
@@ -280,6 +281,10 @@ next_fmt:
ADDCHAR(*sp);
}
+ /* add left-alignment padding */
+ while (width-- > sign)
+ ADDCHAR(' ');
+
if (c == 'b' && ul != 0) {
int any = 0;
c = *bs++;
diff --git a/usr/src/common/util/string.h b/usr/src/common/util/string.h
index 052eeab4a4..f7acd734bd 100644
--- a/usr/src/common/util/string.h
+++ b/usr/src/common/util/string.h
@@ -61,6 +61,7 @@ extern char *strncpy(char *, const char *, size_t);
extern char *strrchr(const char *, int c);
extern char *strstr(const char *, const char *);
extern char *strpbrk(const char *, const char *);
+extern char *strsep(char **, const char *);
extern char *strncat(char *, const char *, size_t);
extern size_t strlcat(char *, const char *, size_t);
extern size_t strlcpy(char *, const char *, size_t);
diff --git a/usr/src/common/util/strtolctype.h b/usr/src/common/util/strtolctype.h
index 5675e42be7..535c014d1f 100644
--- a/usr/src/common/util/strtolctype.h
+++ b/usr/src/common/util/strtolctype.h
@@ -44,7 +44,7 @@ extern "C" {
* safe in probe context.
*/
-#if defined(_KERNEL) && !defined(_BOOT)
+#if defined(_KERNEL) || defined(_BOOT)
#define isalnum(ch) (isalpha(ch) || isdigit(ch))
#define isalpha(ch) (isupper(ch) || islower(ch))
@@ -56,7 +56,7 @@ extern "C" {
#define isxdigit(ch) (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \
((ch) >= 'A' && (ch) <= 'F'))
-#endif /* _KERNEL && !_BOOT */
+#endif /* _KERNEL || _BOOT */
#define DIGIT(x) \
(isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')