Revision 238 (by dpavlin, 2004/03/08 17:46:16) tagging openisis 0.9.0
/*
	openisis - an open implementation of the CDS/ISIS database
	Version 0.8.x (patchlevel see file Version)
	Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	see README for more information
EOH */

/*
	$Id: demo.c,v 1.10 2003/04/08 00:20:52 kripke Exp $
	demo main file
*/

#include <stddef.h> /* NULL */
#include <stdio.h> /* printf */
#include <stdlib.h> /* atol */

#include "openisis.h"


int main ( int argc, const char **argv )
{
	int rowid = atoi(argv[argc-1]);
	int db, i;
	OpenIsisRec *rec;

	if ( 0L == rowid ) {
		printf( "usage: demo -db <db> <rowid>\n\tprints row with number <rowid>\n" );
		return 1;
	}

	openIsisLog( 0, NULL );
	db = openIsisOpen( NULL, argv, argc );
	rec = openIsisReadRow( db, rowid );
	for ( i=0; i<rec->len; i++ )
		printf( "<%d>%s</%d>\n",
			rec->field[i].tag,
			openIsis2Html(rec->field[i].val, rec->field[i].len),
			rec->field[i].tag );

	return 0;
}	/* demo main */