mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Improve listing of long device names
This commit is contained in:
parent
5f70b75e90
commit
da04c2c444
3 changed files with 44 additions and 3 deletions
23
src/print.c
23
src/print.c
|
|
@ -87,3 +87,26 @@ void print(const char *format, ...)
|
|||
|
||||
print_tainted = true;
|
||||
}
|
||||
|
||||
void print_padded(char *string, size_t length, char pad_char)
|
||||
{
|
||||
size_t padding = 0;
|
||||
size_t string_length = 0;
|
||||
size_t i;
|
||||
|
||||
string_length = strlen(string);
|
||||
|
||||
if (string_length < length)
|
||||
{
|
||||
padding += length - string_length;
|
||||
printf("%s", string);
|
||||
for (i=0; i<padding; i++)
|
||||
{
|
||||
putchar(pad_char);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s", string);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue