home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 7
/
FreshFishVol7.bin
/
bbs
/
gnu
/
libg++-2.6-fsf.lha
/
libg++-2.6
/
libio
/
dbz
/
byteflip.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-25
|
652b
|
38 lines
#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);
}
#ifdef DBZ_FINISH
DBZ_FINISH;
#endif
exit(0);
}