Menu

Tree [54c4de] master /
 History

HTTPS access


File Date Author Commit
 resource 2013-05-23 Felix Felix [306259] autotools
 src 2013-05-23 Felix Felix [306259] autotools
 util 2013-05-23 Felix Felix [306259] autotools
 .gitignore 2013-05-23 Felix Felix [306259] autotools
 CHANGES 2012-03-12 Felix Ott Felix Ott [cd76f7] Merge branch 'master' of ssh://gzx.git.sourcefo...
 COPYING 2011-03-19 Felix Ott Felix Ott [787cb7] Initial commit
 INSTALL 2013-05-23 Felix Felix [306259] autotools
 Makefile.am 2013-05-23 Felix Felix [54c4de] Makefile.am: don't install fuse scripts unless ...
 Makefile.old 2013-05-23 Felix Felix [5b869e] autotools; code formatting
 README 2012-03-12 Felix Ott Felix Ott [cd76f7] Merge branch 'master' of ssh://gzx.git.sourcefo...
 autogen.sh 2013-05-23 Felix Felix [5b869e] autotools; code formatting
 configure.ac 2013-05-23 Felix Felix [d2b609] fix configure --without-fuse
 gzxless 2012-03-12 Felix Ott Felix Ott [cd76f7] Merge branch 'master' of ssh://gzx.git.sourcefo...
 targzmount 2012-03-12 Felix Ott Felix Ott [cd76f7] Merge branch 'master' of ssh://gzx.git.sourcefo...

Read Me

`libgzx' is a C library that provides GZIP compliant compression with random
access read support.

`gzx' is a random access file compression command line tool.

`gzxfuse' and `gzxless' are FUSE-based tools for viewing and accessing gzx
compressed files. For a file GZX_FILE.gz, gzxfuse creates a file
GZX_FILE/access which can be accessed like a regular file.

`libavacs' is a C library for command line option parsing and automated help
page generation.

Installation
============
See the file `INSTALL' for installation instructions

Using libgzx
============

The main functions declared in the header `gzx/gzx.h' roughly correspond to the
standard library functions fopen(), fflush(), fclose(), fseek(), ftell(), fread(),
fwrite() and ferror():

Open file:
	gzx_file *gzx_open(const char*const filename,const char mode);

Open a stream:
	gzx_file *gzx_sopen(FILE *const file,const char mode);

Flush gzx stream:
	int gzx_flush(gzx_file *const gzx);

Close the stream:
	int gzx_close(gzx_file *const gzx);

Seek to a position (read access only):
	int gzx_seek(gzx_file *const gzx,off_t offset,int whence);

Get the current stream position:
	off_t gzx_tell(const gzx_file *const gzx);

Read <size> bytes into the buffer at <ptr>:
	size_t gzx_read(gzx_file *const gzx,void *ptr,size_t size);

Write <size> bytes to the stream:
	size_t gzx_write(gzx_file *const gzx,const void *ptr,size_t size);

Check if an error occured in gzx_read() or gzx_write():
	int gzx_error(gzx_file *const gzx);


Using libavacs
==============

Main funtions in `avacs/avacs.h':

 - avacs_parser_create()
 - avacs_parser_destroy()
 - avacs_addoption()
 - avacs_parseargs()
 - avacs_printusage().

In addtion some predefined string conversion functions are provided:

 - avacs_convi:  int
 - avacs_convu:  unsigned int
 - avacs_convl:  long
 - avacs_convlu: unsigned long
 - avacs_convf:  float
 - avacs_convc:  char
 - avacs_convs:  astr

Usage example:

	#include <stdio.h>
	#include "avacs/avacs.h"
	
	int main(int ac, char *av[])
	{
		int pac;
		int help=0;
		float value=-1;
		astr *text=astr_create("something");
		
		avacs_parser *p=
			avacs_parser_create(av[0], "avacs program", "[OTHERARGS]");
		
		if((p==0)||(text==0)) return 1;
		
		avacs_addoption(p, "help", 'h', &help, 0, "give this help", 0);
		avacs_addoption(p, "text", 't', text, avacs_convs, "provide a text", "STRING");
		
		/* question mark (?XYZ) indicates there's no default value for this option */
		avacs_addoption(p, "value", 'v', &value, avacs_convf, "provide a value", "?XYZ");
		
		if(ac==1) avacs_printusage(p, stdout);
		else
		{
			pac=avacs_parseargs(p, ac, av);
			
			if(help||(pac<0))
			{
				avacs_printusage(p, stdout);
			}
			else
			{
				fprintf(stdout, "text is %s\n", astr_beg(text));
				fprintf(stdout, "value is %d\n", value);
			}
		}
		
		avacs_parser_destroy(p);
		astr_destroy(text);
		return 0;
	}