Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-9538 utils: Tool for syncing file LSOM xattr
[fs/lustre-release.git]
/
libcfs
/
libcfs
/
util
/
parser.c
diff --git
a/libcfs/libcfs/util/parser.c
b/libcfs/libcfs/util/parser.c
index
3fbb09e
..
861f97a
100644
(file)
--- a/
libcfs/libcfs/util/parser.c
+++ b/
libcfs/libcfs/util/parser.c
@@
-549,7
+549,6
@@
int Parser_list_commands(const command_t *cmdlist, char *buffer,
int col = col_start;
int char_max;
int len;
int col = col_start;
int char_max;
int len;
- char fmt[6];
int count = 0;
int rc;
int count = 0;
int rc;
@@
-572,9
+571,9
@@
int Parser_list_commands(const command_t *cmdlist, char *buffer,
/* Add trailing spaces to pad the entry to the column size */
if (len < char_max) {
/* Add trailing spaces to pad the entry to the column size */
if (len < char_max) {
- snprintf(fmt, 6, "%%-%2ds", char_max - len);
snprintf(&buffer[col * char_max] + len,
snprintf(&buffer[col * char_max] + len,
- char_max - len + 1, fmt, " ");
+ char_max - len + 1, "%*s", char_max - len,
+ " ");
} else {
buffer[(col + 1) * char_max - 1] = ' ';
}
} else {
buffer[(col + 1) * char_max - 1] = ' ';
}
@@
-769,40
+768,41
@@
int Parser_arg2int(const char *inp, long *result, int base)
}
/* Convert human readable size string to and int; "1k" -> 1000 */
}
/* Convert human readable size string to and int; "1k" -> 1000 */
-int Parser_size (int *sizep, char *str) {
- int size;
- char mod[32];
+int Parser_size(unsigned long *sizep, char *str)
+{
+ unsigned long size;
+ char mod[32];
-
switch (sscanf (str, "%d
%1[gGmMkK]", &size, mod)) {
-
default:
-
return (-1)
;
+
switch (sscanf(str, "%lu
%1[gGmMkK]", &size, mod)) {
+ default:
+
return -1
;
-
case 1:
-
*sizep = size;
-
return (0)
;
+ case 1:
+ *sizep = size;
+
return 0
;
-
case 2:
-
switch (*mod) {
-
case 'g':
-
case 'G':
-
*sizep = size << 30;
-
return (0)
;
-
-
case 'm':
-
case 'M':
-
*sizep = size << 20;
-
return (0)
;
-
-
case 'k':
-
case 'K':
-
*sizep = size << 10;
-
return (0)
;
-
-
default:
-
*sizep = size;
-
return (0)
;
-
}
-
}
+ case 2:
+ switch (*mod) {
+ case 'g':
+ case 'G':
+ *sizep = size << 30;
+
return 0
;
+
+ case 'm':
+ case 'M':
+ *sizep = size << 20;
+
return 0
;
+
+ case 'k':
+ case 'K':
+ *sizep = size << 10;
+
return 0
;
+
+ default:
+ *sizep = size;
+
return 0
;
+ }
+ }
}
/* Convert a string boolean to an int; "enable" -> 1 */
}
/* Convert a string boolean to an int; "enable" -> 1 */