From 82368402af0cb7e92fa8ed37c5fa52d571252c53 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 18 Feb 2020 22:59:37 +0100 Subject: [PATCH] client: user_shell.c: fflush() after writes to stdout This is useful if we have external programs interfacing with stdin/stdout of osmo-remsim-client-shell. We don't want that output to hang in some buffer indefinitely, but rather have the lines flushed immediately. Change-Id: I6879f9f186ce87e0644b3d7868fc5ea031b82c62 --- src/client/user_shell.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/user_shell.c b/src/client/user_shell.c index d5cad7b..11601d6 100644 --- a/src/client/user_shell.c +++ b/src/client/user_shell.c @@ -23,6 +23,7 @@ static int bankd_handle_tpduCardToModem(struct bankd_client *bc, const RsproPDU_ const struct TpduCardToModem *card2modem = &pdu->msg.choice.tpduCardToModem; printf("R-APDU: %s\n", osmo_hexdump(card2modem->data.buf, card2modem->data.size)); + fflush(stdout); return 0; } @@ -36,6 +37,7 @@ static int bankd_handle_setAtrReq(struct bankd_client *bc, const RsproPDU_t *pdu printf("SET_ATR: %s\n", osmo_hexdump(pdu->msg.choice.setAtrReq.atr.buf, pdu->msg.choice.setAtrReq.atr.size)); + fflush(stdout); resp = rspro_gen_SetAtrRes(ResultCode_ok); if (!resp)