Browse Source
Merge pull request #43 from SiIky/unknown_str
Print unknown_str in case of error
master
Aaron Marcher
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
slstatus.c
|
|
@ -87,8 +87,10 @@ main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
status[0] = '\0'; |
|
|
status[0] = '\0'; |
|
|
for (i = len = 0; i < LEN(args); i++) { |
|
|
for (i = len = 0; i < LEN(args); i++) { |
|
|
|
|
|
const char * res = args[i].func(args[i].args); |
|
|
|
|
|
res = (res == NULL) ? unknown_str : res; |
|
|
len += snprintf(status + len, sizeof(status) - len, |
|
|
len += snprintf(status + len, sizeof(status) - len, |
|
|
args[i].fmt, args[i].func(args[i].args)); |
|
|
args[i].fmt, res); |
|
|
|
|
|
|
|
|
if (len >= sizeof(status)) { |
|
|
if (len >= sizeof(status)) { |
|
|
status[sizeof(status) - 1] = '\0'; |
|
|
status[sizeof(status) - 1] = '\0'; |
|
|
|