|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T b
Length: 604 (0x25c) Types: TextFile Names: »byteflip.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦eed978cbf⟧ »EurOpenD3/utils/dbz.tar.Z« └─⟦0be62e539⟧ └─⟦this⟧ »dbz/byteflip.c«
#include <stdio.h> #define MAXWORD 32 main(argc, argv) int argc; char *argv[]; { register int len; int inmap[MAXWORD]; int outmap[MAXWORD]; char in[MAXWORD]; char out[MAXWORD]; register int i; register int a; a = 1; len = atoi(argv[a++]); if (len > MAXWORD) abort(); /* kind of drastic... */ for (i = 0; i < len; i++) inmap[i] = atoi(argv[a++]); if (atoi(argv[a++]) != len) abort(); for (i = 0; i < len; i++) outmap[i] = atoi(argv[a++]); while (fread(in, 1, len, stdin) == len) { for (i = 0; i < len; i++) out[outmap[i]] = in[inmap[i]]; fwrite(out, 1, len, stdout); } }