/* ----------------------------------------------------------------------- *
*
* Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static void print_timeout_message(int tol, int row, const char *msg)
{
+ static int last_msg_len = 0;
char buf[256];
- int nc = 0, nnc;
+ int nc = 0, nnc, padc;
const char *tp = msg;
char tc;
char *tq = buf;
}
*tq = '\0';
- /* Let's hope 4 spaces on each side is enough... */
- printf("\033[%d;%dH\2#14 %s ", row,
- HSHIFT + 1 + ((WIDTH - nc - 8) >> 1), buf);
+ if (nc >= last_msg_len) {
+ padc = 0;
+ } else {
+ padc = (last_msg_len - nc + 1) >> 1;
+ }
+
+ printf("\033[%d;%dH\2#14%*s%s%*s", row,
+ HSHIFT + 1 + ((WIDTH - nc) >> 1) - padc,
+ padc, "", buf, padc, "");
+
+ last_msg_len = nc;
}
/* Set the background screen, etc. */
}
}
+ /* Clear the message from the screen */
+ print_timeout_message(0, HIDDEN_ROW, "");
+
if (cm->ontimeout)
return cm->ontimeout;
else