aboutsummaryrefslogtreecommitdiff
path: root/asciihexer.c
diff options
context:
space:
mode:
authortoni <matzeton@googlemail.com>2017-01-11 01:29:06 +0100
committertoni <matzeton@googlemail.com>2017-01-11 01:29:06 +0100
commitca95d761f5d97e677931145e29dd09ab09d01b43 (patch)
treecb492d16fc7435e6b1f0451e059e07af642de976 /asciihexer.c
parentb7e4f6cb468a3d9f1bca1953cd44a52fcf392c1d (diff)
moved sources to https://github.com/lnslbrty/foo-scripts
Diffstat (limited to 'asciihexer.c')
-rw-r--r--asciihexer.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/asciihexer.c b/asciihexer.c
deleted file mode 100644
index afa1cd0..0000000
--- a/asciihexer.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define ASCII_HEXLEN 3
-
-
-static void defaultHexOut(char *text) {
- int i;
- size_t len;
-
- for (i = 0; i < (len = strlen(text)); i++) {
- printf("0x%X%c", text[i], (i == len-1 ? '\n' : ' '));
- }
-}
-
-static void dwordHexOut(char *text) {
- int i;
- size_t len;
-
- for (i = 0; i < (len = strlen(text)); i++) {
- printf("%s%X%s", (i % 4 == 0 ? (i == 0 ? "0x" : " 0x") : ""), text[i], (i == len-1 ? "\n" : ""));
- }
-}
-
-static void strHexOut(char *text) {
- int i;
- size_t len;
-
- for (i = 0; i < (len = strlen(text)); i++) {
- printf("%s%X%s", (i == 0 ? "0x" : ""), text[i], (i == len-1 ? "\n" : ""));
- }
-}
-
-int main(int argc, char **argv)
-{
- if (argc != 2) {
- fprintf(stderr, "usage: %s [TEXT]\n", argv[0]);
- return 1;
- }
-
- defaultHexOut(argv[1]);
- dwordHexOut(argv[1]);
- strHexOut(argv[1]);
- return 0;
-}