diff options
author | June McEnroe <curtis.mcenroe@adgear.com> | 2016-09-12 14:40:54 -0400 |
---|---|---|
committer | June McEnroe <curtis.mcenroe@adgear.com> | 2016-09-12 14:40:54 -0400 |
commit | c22925bf96fb269d71b031898c2602a350b6fbe7 (patch) | |
tree | 05573a903bc450e82decf59bc3e1cf09caed5ff9 | |
parent | Rename colorscheme to lame (diff) | |
download | src-c22925bf96fb269d71b031898c2602a350b6fbe7.tar.gz src-c22925bf96fb269d71b031898c2602a350b6fbe7.zip |
Add .bin/xx.c
-rwxr-xr-x | .bin/xx.c | 36 | ||||
-rwxr-xr-x | install.sh | 1 |
2 files changed, 37 insertions, 0 deletions
diff --git a/.bin/xx.c b/.bin/xx.c new file mode 100755 index 00000000..d2d86574 --- /dev/null +++ b/.bin/xx.c @@ -0,0 +1,36 @@ +#if 0 +exec cc -Weverything -o ~/.bin/xx $0 +#endif + +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char **argv) +{ + char *path = NULL; + + if (argc > 1) + path = argv[1]; + + FILE *file = path ? fopen(path, "r") : stdin; + if (!file) { + perror(path); + return EXIT_FAILURE; + } + + uint8_t buf[16]; + for (;;) { + size_t n = fread(buf, 1, sizeof(buf), file); + for (size_t i = 0; i < n; ++i) + printf("%02x ", buf[i]); + printf("\n"); + if (n < sizeof(buf)) break; + } + if (ferror(file)) { + perror(path); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/install.sh b/install.sh index ada9acc0..fe547ae9 100755 --- a/install.sh +++ b/install.sh @@ -21,6 +21,7 @@ link() { echo "$1" } +link .bin/xx.c link .config/git/config link .config/git/ignore link .config/htop/htoprc |