Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1186 | savelij | 1 | /* console.c */ |
2 | /*****************************************************************************/ |
||
3 | /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only */ |
||
4 | /* */ |
||
5 | /* AS Port */ |
||
6 | /* */ |
||
7 | /* Console Output Handling */ |
||
8 | /* */ |
||
9 | /*****************************************************************************/ |
||
10 | |||
11 | #include "stdinc.h" |
||
12 | #include <string.h> |
||
13 | |||
14 | #include "console.h" |
||
15 | |||
16 | /*!------------------------------------------------------------------------ |
||
17 | * \fn WrConsoleLine(const char *pLine, Boolean NewLine) |
||
18 | * \brief print a line to console, possibly erasing previous output |
||
19 | * \param pLine line to print |
||
20 | * \param NewLine start new line or jump back to current line? |
||
21 | * ------------------------------------------------------------------------ */ |
||
22 | |||
23 | void WrConsoleLine(const char *pLine, Boolean NewLine) |
||
24 | { |
||
25 | static size_t LastLength; |
||
26 | size_t ThisLength = strlen(pLine); |
||
27 | |||
28 | printf("%s", pLine); |
||
29 | if (LastLength && (LastLength > ThisLength)) |
||
30 | printf("%*s", (int)(LastLength - ThisLength), ""); |
||
31 | if (NewLine) |
||
32 | { |
||
33 | printf("\n"); |
||
34 | LastLength = 0; |
||
35 | } |
||
36 | else |
||
37 | { |
||
38 | printf("\r"); |
||
39 | LastLength = ThisLength; |
||
40 | } |
||
41 | } |
||
42 |