fetch

DOC DATE

20000610

NAME

fetch, segment - output from a file within a given byte offset range

USAGE


	synopsis
	fetch filename hex_start [ hex_end ] [ stdout_redirection ]
	
	examples
	fetch mailfolder 10000 100ff 
		outputs 256 bytes starting from decimal offset 65536 

	fetch mailfolder 0
		outputs first line of file mailfolder

	fetch mailfolder 1000
		outputs rest of line, or 72 bytes of a longer line, 
		starting at decimal byte offset 4096 in file mailfolder

	interface
	first, second and third arguments, standard output, stderr
	no signal handling
	informative return values 

DESCRIPTION

fetch is like get/cat with one or two offset arguments, and lies in functionality somewhere between split, dd, head, tail and cut. It was written for cLIeNUX PIRDE , Personal Integrated Relational Database Environment, which hopefully exists by the time you read this. fetch is a bit faster than get/cat, due to the simplicity of the program, which has less features than get/cat even, and due to it being implemented in what I call <C, `less-than C', which is a very assembly-like C style I developed for H3sm. fetch is static, is less than 3k in size, and was written and builds without libc. It is intended to serve as the runtime glue command between a data file or files like mail folders and an index database file consisting of text hexadecimal offsets into the actual data files.

For internal simplicity and speed, fetch can only interpret file byte offsets in hexadecimal , with no 0x or other prefix. If fetch is given only the starting offset, fetch outputs to the next unix newline, ASCII 10, "linefeed", or if there are no newlines in 72 bytes 72 bytes will be output. In other words, with only one offset argument, if the offset is within a long line only a 72 byte segment of the line will be output.

BUGS

I know and don't care that it doesn't check for reversed offsets. Otherwise, let me know. rick@clienux.com

RIGHTS

The fetch program and this seedoc are Copyright 2000 Rick Hohensee. segment is released for redistribution only as part of an intact entire cLIeNUX Core.