|
@@ -1,12 +1,18 @@
|
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
|
|
|
+#include <string.h>
|
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
|
#include "mnemonic.h"
|
|
#include "mnemonic.h"
|
|
|
|
|
|
|
|
-int main(void) {
|
|
|
|
|
|
|
+int main(int argc, char **argv) {
|
|
|
char buf[0x90000];
|
|
char buf[0x90000];
|
|
|
mn_byte outbuf[0x10000];
|
|
mn_byte outbuf[0x10000];
|
|
|
int buflen;
|
|
int buflen;
|
|
|
- int n;
|
|
|
|
|
|
|
+ int n, i;
|
|
|
|
|
+ int hex_encoded_output = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if(argc > 1 && strcmp(argv[1],"-x") == 0) {
|
|
|
|
|
+ hex_encoded_output = 1;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
buflen = fread(buf, 1, sizeof buf - 1, stdin);
|
|
buflen = fread(buf, 1, sizeof buf - 1, stdin);
|
|
|
buf[buflen] = 0;
|
|
buf[buflen] = 0;
|
|
@@ -17,7 +23,13 @@ int main(void) {
|
|
|
return EXIT_FAILURE;
|
|
return EXIT_FAILURE;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- fwrite(outbuf, 1, n, stdout);
|
|
|
|
|
|
|
+ if(hex_encoded_output) {
|
|
|
|
|
+ for(i = 0; i < n; i++) {
|
|
|
|
|
+ printf("%X", outbuf[i]);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fwrite(outbuf, 1, n, stdout);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
return EXIT_SUCCESS;
|
|
|
}
|
|
}
|