Mercurial > utils
view smspdu/smspdu-unpack.c @ 663:136298c89fdd default tip
Enabling of "Developer mode" to allow symlinks without elevation.
author | Oleksandr Gavenko <gavenkoa@gmail.com> |
---|---|
date | Sun, 15 Nov 2020 15:24:16 +0200 |
parents | c0ac856d2e4b |
children |
line wrap: on
line source
#include <stdlib.h> #include <stdio.h> #include <assert.h> int main() { unsigned num; int buf = 0; int off = 0; while (fscanf(stdin, "%2x", &num) != EOF) { int remain = 7 - off; assert(off < 7); buf |= (num & ((1<<remain) - 1)) << off; putchar(buf); buf = num >> remain; off = 8 - remain; if (off == 7) { putchar(buf); buf = 0; off = 0; } } if ((off > 0) && (num > 0)) { putchar(buf); } return EXIT_SUCCESS; }