mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix: fflush(stdout), should sort out the blocking pipe problem
add: line length (@merlokk)
This commit is contained in:
parent
4da4b33d8d
commit
d30454fc5a
3 changed files with 18 additions and 19 deletions
19
client/ui.c
19
client/ui.c
|
@ -25,23 +25,20 @@ void PrintAndLogOptions(char *str[][2], size_t size, size_t space) {
|
|||
char buff[2000] = "Options:\n";
|
||||
char format[2000] = "";
|
||||
size_t counts[2] = {0, 0};
|
||||
for(int i = 0; i < size; i++)
|
||||
for(int j = 0 ; j < 2 ; j++)
|
||||
if(counts[j] < strlen(str[i][j]))
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int j = 0 ; j < 2 ; j++)
|
||||
if (counts[j] < strlen(str[i][j])) {
|
||||
counts[j] = strlen(str[i][j]);
|
||||
}
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
for(int j = 0; j < 2; j++)
|
||||
{
|
||||
if(j == 0)
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
if (j == 0)
|
||||
snprintf(format, sizeof(format), "%%%zus%%%zus", space, counts[j]);
|
||||
else
|
||||
snprintf(format, sizeof(format), "%%%zus%%-%zus", space, counts[j]);
|
||||
snprintf(buff + strlen(buff), sizeof(buff) - strlen(buff), format, " ", str[i][j]);
|
||||
}
|
||||
if(i<size-1)
|
||||
if (i < size-1)
|
||||
strncat(buff, "\n", sizeof(buff)-strlen(buff) -1);
|
||||
}
|
||||
PrintAndLogEx(NORMAL, buff);
|
||||
|
@ -178,7 +175,7 @@ void PrintAndLog(char *fmt, ...) {
|
|||
va_end(argptr2);
|
||||
|
||||
if (flushAfterWrite)
|
||||
fflush(NULL);
|
||||
fflush(stdout);
|
||||
|
||||
//release lock
|
||||
pthread_mutex_unlock(&print_lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue