mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-08-04 01:36:10 -04:00
Add support for boolean printing
This commit is contained in:
parent
1a801ce93f
commit
b511091728
@ -165,6 +165,16 @@ std::string vsprintf(const std::string& format, va_list va){
|
|||||||
s += "B";
|
s += "B";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Boolean
|
||||||
|
else if(ch == 'b'){
|
||||||
|
bool value= va_arg(va, int);
|
||||||
|
|
||||||
|
if(value){
|
||||||
|
s += "true";
|
||||||
|
} else {
|
||||||
|
s += "false";
|
||||||
|
}
|
||||||
|
}
|
||||||
//String
|
//String
|
||||||
else if(ch == 's'){
|
else if(ch == 's'){
|
||||||
const char* arg = va_arg(va, const char*);
|
const char* arg = va_arg(va, const char*);
|
||||||
@ -376,6 +386,16 @@ void vsprintf_raw(char* out_buffer, size_t /*n*/, const char* format, va_list va
|
|||||||
out_i += str_cat(out_buffer + out_i, "B");
|
out_i += str_cat(out_buffer + out_i, "B");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Boolean
|
||||||
|
else if(ch == 'b'){
|
||||||
|
bool value= va_arg(va, int);
|
||||||
|
|
||||||
|
if(value){
|
||||||
|
out_i += str_cat(out_buffer + out_i, "true");
|
||||||
|
} else {
|
||||||
|
out_i += str_cat(out_buffer + out_i, "false");
|
||||||
|
}
|
||||||
|
}
|
||||||
//String
|
//String
|
||||||
else if(ch == 's'){
|
else if(ch == 's'){
|
||||||
const char* arg = va_arg(va, const char*);
|
const char* arg = va_arg(va, const char*);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user