/*
 poke a byte into a file. Wrapper for lseek/write.
Copyright 2000 Rick Hohensee
This file is released for redistribution only as part of an 
intact entire cLIeNUX Core.

uses libc.
*/


void usage ()
{ write(2,"\nUSAGE: poke  filename offset_int byte_value\n\n", 51);
}

main(int argc, char * argv[])
{
int fd, offset, value;
char buf[4];


if ( argc - 4  )
	{ usage();
	exit(1);
	}

fd =  open(argv[1],2);
if ( fd < 0 )
	{ exit(fd);			/* error */
	}
offset = atoi(argv[2]);
buf[0]  =(char) atoi(argv[3]);

lseek(fd,offset, 0);
write(fd,buf,1);


}


/*
gcc -o poke poke.c
strip -R .comment -R .note poke
wc poke
cp poke /.bi		# install
cp poke.c /help/see/poke.1.html 
*/