|
11 | 11 |
|
12 | 12 | typedef struct parameter{
|
13 | 13 |
|
14 |
| - bool showAll; //--all shows all available ascii codes |
15 |
| - bool showAllDigits; //--digits shows all digits ascii codes |
16 |
| - bool showAllAlphas; //--alphas shows all alphabets ascii codes |
17 |
| - |
18 |
| - bool onlyOct; //--octa shows only octa in output table |
19 |
| - bool onlyDec; //--dec shows only dec in output table |
20 |
| - bool onlyHex; //--hex shows only hex in output table |
21 |
| - bool onlyChar; // |
22 |
| - bool _onlyAll; // if all only* 4 are false this will be set to true |
| 14 | + bool showAll; //--all shows all available ascii codes |
| 15 | + bool showAllDigits; //--digits shows all digits ascii codes |
| 16 | + bool showAllAlphas; //--alphas shows all alphabets ascii codes |
| 17 | + |
| 18 | + bool onlyOct; //--octa shows only octa in output table |
| 19 | + bool onlyDec; //--dec shows only dec in output table |
| 20 | + bool onlyHex; //--hex shows only hex in output table |
| 21 | + |
| 22 | + bool onlyChar; // hardcoded and set to true(1) always shows `chr` column |
| 23 | + bool _onlyAll; // if all only* 3 are false this will be set to true |
23 | 24 |
|
24 |
| - char* content; // " " content / data |
| 25 | + char* content; // " " content / data (user input) |
25 | 26 |
|
26 |
| - uint8_t order; //0 - default , 1 - ascending, 3 - desending ordered output table |
| 27 | + uint8_t order; //0 - default , (--asc)1 - ascending, (--des)2 - desending ordered output table |
| 28 | + bool color; //--vt100 register ansi vt100 escape sequence color to the terminal |
27 | 29 |
|
28 | 30 | }asciiParams;
|
29 | 31 |
|
@@ -92,6 +94,8 @@ asciiParams parseParameter(int argv, char** args){
|
92 | 94 | else if(strcmp(args[i],"--asc")==0) params.order = 1;
|
93 | 95 | else if(strcmp(args[i],"--des")==0) params.order = 2;
|
94 | 96 |
|
| 97 | + else if(strcmp(args[i],"--vt100")==0) params.color = true; |
| 98 | + |
95 | 99 | }
|
96 | 100 |
|
97 | 101 | params.onlyChar = 1; //hardcoded;
|
@@ -129,7 +133,7 @@ void manipulateData(asciiParams *params){
|
129 | 133 | }
|
130 | 134 |
|
131 | 135 | void printData(asciiParams params){
|
132 |
| - |
| 136 | + |
133 | 137 | size_t s = 0;char se_line[20] = "";
|
134 | 138 | if(params._onlyAll) printf("Oct Dec Hex "YEL"Chr"RESET"\n------------------\n");
|
135 | 139 | else{
|
@@ -166,6 +170,11 @@ int main(int argv, char** args){
|
166 | 170 |
|
167 | 171 | asciiParams params = parseParameter(argv, args);
|
168 | 172 |
|
| 173 | + if(params.color){ |
| 174 | + system("REG ADD HKCU\\CONSOLE /f /v VirtualTerminalLevel /t REG_DWORD /d 1"); |
| 175 | + return 0; |
| 176 | + } |
| 177 | + |
169 | 178 | if(params.showAll){
|
170 | 179 | splashScreen();
|
171 | 180 | return 0;
|
|
0 commit comments