projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
493cf35
)
add \n to error messages only when output goes to stderr
author
Felix Fietkau
<nbd@openwrt.org>
Wed, 27 Aug 2008 20:07:52 +0000
(22:07 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Wed, 27 Aug 2008 20:07:52 +0000
(22:07 +0200)
libuci.c
patch
|
blob
|
history
diff --git
a/libuci.c
b/libuci.c
index
29dab12
..
bc68462
100644
(file)
--- a/
libuci.c
+++ b/
libuci.c
@@
-145,7
+145,7
@@
uci_get_errorstr(struct uci_context *ctx, char **dest, const char *prefix)
"%s%s" /* prefix */
"%s%s" /* function */
"%s" /* error */
"%s%s" /* prefix */
"%s%s" /* function */
"%s" /* error */
- "%s
\n
"; /* details */
+ "%s"; /* details */
error_info[0] = 0;
error_info[0] = 0;
@@
-160,7
+160,7
@@
uci_get_errorstr(struct uci_context *ctx, char **dest, const char *prefix)
switch (err) {
case UCI_ERR_PARSE:
if (ctx->pctx) {
switch (err) {
case UCI_ERR_PARSE:
if (ctx->pctx) {
- snprintf(error_info, sizeof(error_info), " (%s) at line %d, byte %d", (ctx->pctx->reason ? ctx->pctx->reason : "unknown"), ctx->pctx->line, ctx->pctx->byte);
+ snprintf(error_info, sizeof(error_info)
- 1
, " (%s) at line %d, byte %d", (ctx->pctx->reason ? ctx->pctx->reason : "unknown"), ctx->pctx->line, ctx->pctx->byte);
break;
}
break;
break;
}
break;
@@
-173,12
+173,14
@@
uci_get_errorstr(struct uci_context *ctx, char **dest, const char *prefix)
(ctx->func ? ctx->func : ""), (ctx->func ? ": " : ""),
uci_errstr[err],
error_info);
(ctx->func ? ctx->func : ""), (ctx->func ? ": " : ""),
uci_errstr[err],
error_info);
- else
+ else {
+ strcat(error_info, "\n");
fprintf(stderr, format,
(prefix ? prefix : ""), (prefix ? ": " : ""),
(ctx->func ? ctx->func : ""), (ctx->func ? ": " : ""),
uci_errstr[err],
error_info);
fprintf(stderr, format,
(prefix ? prefix : ""), (prefix ? ": " : ""),
(ctx->func ? ctx->func : ""), (ctx->func ? ": " : ""),
uci_errstr[err],
error_info);
+ }
}
int uci_list_configs(struct uci_context *ctx, char ***list)
}
int uci_list_configs(struct uci_context *ctx, char ***list)