Consistent stderr
This commit is contained in:
parent
c9f39be9d8
commit
f757f23d11
@ -233,7 +233,7 @@ static constexpr size_t strlen_pre_eq(const char* str){
|
||||
#define CHECK_VALID_LONG_ARG(opt, off, arg, type) \
|
||||
{ \
|
||||
if(arg[off] != '=' || !is_##type(arg+off+1)){ \
|
||||
fwprintf(stderr, L"'--%.*s' requires an argument of type " #type "\n", off, opt); \
|
||||
fprintf(stderr, L"'--%.*s' requires an argument of type " #type "\n", off, opt); \
|
||||
ret.error = 1; \
|
||||
break; \
|
||||
} \
|
||||
@ -244,7 +244,7 @@ static constexpr size_t strlen_pre_eq(const char* str){
|
||||
#define CHECK_VALID_SHORT_ARG(opt, arg, type) \
|
||||
{ \
|
||||
if(next_arg == argc || !is_##type(arg)){ \
|
||||
fwprintf(stderr, L"'-%s' requires an argument of type " #type "\n", opt); \
|
||||
fprintf(stderr, L"'-%s' requires an argument of type " #type "\n", opt); \
|
||||
ret.error = 1; \
|
||||
break; \
|
||||
} \
|
||||
@ -354,7 +354,7 @@ cmd_args process_cmd_args(int argc, char** argv){
|
||||
default:
|
||||
//keep parsing after error so we can still properly output requested color style
|
||||
ret.error = 1;
|
||||
fwprintf(stderr, L"Unrecognized option '-%c'\n", argv[i][j]);
|
||||
fprintf(stderr, L"Unrecognized option '-%c'\n", argv[i][j]);
|
||||
};
|
||||
}
|
||||
i = next_arg-1;
|
||||
@ -407,7 +407,7 @@ cmd_args process_cmd_args(int argc, char** argv){
|
||||
;
|
||||
}else{
|
||||
ret.error = 1;
|
||||
fwprintf(stderr, L"Unrecognized option '%s'\n", argv[i]);
|
||||
fprintf(stderr, L"Unrecognized option '%s'\n", argv[i]);
|
||||
}
|
||||
}else{
|
||||
ret.filenames.push_back(argv[i]);
|
||||
|
||||
@ -50,7 +50,7 @@ static constexpr size_t constexpr_strlen(const char* str){
|
||||
static int detect_term_colors(void){
|
||||
int term_colors = 16;
|
||||
if(setupterm(NULL, fileno(stdout), NULL) == ERR){
|
||||
fwprintf(stderr, L"could not set up term\n");
|
||||
fprintf(stderr, L"could not set up term\n");
|
||||
}else{
|
||||
term_colors = tigetnum("colors");
|
||||
if(term_colors < 0){
|
||||
@ -154,7 +154,7 @@ int print_normal_files(const cmd_args& args){
|
||||
FILE* fp = fopen(args.filenames[i], "r");
|
||||
if(!fp){
|
||||
fflush(stdout); //force color update before error
|
||||
fwprintf(stderr, L"Unable to open file %s\n", args.filenames[i]);
|
||||
fprintf(stderr, L"Unable to open file %s\n", args.filenames[i]);
|
||||
ret = 2;
|
||||
continue;
|
||||
}
|
||||
@ -242,7 +242,7 @@ int main(int argc, char** argv){
|
||||
int avail_colors = detect_term_colors();
|
||||
|
||||
if(args.error){
|
||||
fwprintf(stderr, L"Try '%s --help' for more information.\n", argv[0]);
|
||||
fprintf(stderr, L"Try '%s --help' for more information.\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user