File:  [Apple XNU] / GNUtools / libg++ / libio / dbz / byteflip.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:45:53 2018 UTC (8 years, 2 months ago) by root
Branches: MAIN, Apple
CVS tags: HEAD, GNUtools33
GNU tools for NeXTSTEP 3.3

#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);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.