--- libvformat-1.13.orig/samples/split_phonebook.c +++ libvformat-1.13/samples/split_phonebook.c @@ -0,0 +1,171 @@ +/****************************************************************************** + + (C) Nick Marley, 2001 - + + This software is distributed under the GNU Lesser General Public Licence. + Please read and understand the comments at the top of vf_iface.h before use! + +FILE + $Workfile$ + $Revision: 1.3 $ + $Author: tilda $ + +ORIGINAL AUTHOR + Nick Marley + +DESCRIPTION + Platform independant test harness for the vformat library functions. This + code runs various tests on the library, results are written to stdout. + +REFERENCES + (none) + +MODIFICATION HISTORY + * $Log: split_phonebook.c,v $ + * Revision 1.3 2001/10/24 18:37:38 tilda + * BASE64 bugfixes. Split reader/writer code. Start create/modify work. + * + * Revision 1.2 2001/10/24 05:29:24 tilda + * Tidy up. + * + * Revision 1.1.1.1 2001/10/16 05:49:57 tilda + * Initial Import to CVS. + * + *******************************************************************************/ + +#ifndef NORCSID +static const char split_phonebook_c_vss_id[] = "$Header: /cvsroot/vformat/build/samples/split_phonebook.c,v 1.3 2001/10/24 18:37:38 tilda Exp $"; +#endif + +/*=============================================================================* + ANSI C & System-wide Header Files + *=============================================================================*/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +/*============================================================================* + Interface Header Files + *============================================================================*/ + +#include "vformat/vf_iface.h" + +/*============================================================================* + Local Header File + *============================================================================*/ + +#include "split_phonebook.h" + +/*============================================================================* + Private Defines + *============================================================================*/ +/* None */ + +/*============================================================================* + Private Data Types + *============================================================================*/ +/* None */ + +/*============================================================================* + Private Function Prototypes + *============================================================================*/ +/* None */ + +/*============================================================================* + Private Data + *============================================================================*/ +/* None */ + +/*============================================================================* + Public Function Implementations + *============================================================================*/ + + +/*----------------------------------------------------------------------------* + * NAME + * split_phonebook() + * + * DESCRIPTION + * Read in the indicated file which is assumed to be a list of VCARDs. + * The component cards are written out to individual files. + * + * RETURNS + * TRUE <=> read / written OK. + *----------------------------------------------------------------------------*/ + +bool_t split_phonebook( + const char *p_filename, + const char *p_outdir + ) +{ + VF_OBJECT_T *p_object = NULL; + bool_t ret = FALSE; + + if (vf_read_file(&p_object, p_filename)) + { + VF_OBJECT_T *p_tmp = p_object; + + ret = TRUE; + + do + { + VF_PROP_T *p_prop; + char name[256]; + + name[0] = '\0'; + + if (vf_get_property(&p_prop, p_object, FALSE, NULL, VFP_NAME, NULL)) + { + const char *p_givenname = vf_get_prop_value_string(p_prop, VFP_NAME_GIVEN); + const char *p_familyname = vf_get_prop_value_string(p_prop, VFP_NAME_FAMILY); + + if (p_familyname && p_givenname) + { + sprintf(name, "%s %s", p_givenname, p_familyname); + } + else + if (p_familyname) + { + strcpy(name, p_familyname); + } + else + if (p_givenname) + { + strcpy(name, p_givenname); + } + } + else + if (vf_get_property(&p_prop, p_object, FALSE, NULL, VFP_FULLNAME, NULL)) + { + const char *p_fullname = vf_get_prop_value_string(p_prop, VFP_NAME_GIVEN); + + if (p_fullname) + { + strcpy(name, p_fullname); + } + } + + if (name[0]) + { + char filename[_MAX_PATH]; + + sprintf(filename, "%s\\%s.vcf", p_outdir, name); + + ret &= vf_write_file(filename, p_object, FALSE); + } + } + while (ret && vf_get_next_object(&p_object)) + ; + + vf_delete_object(p_tmp, TRUE); + } + + return ret; +} + + + +/*============================================================================* + Private Function Implementations + *============================================================================*/ --- libvformat-1.13.orig/samples/split_phonebook.h +++ libvformat-1.13/samples/split_phonebook.h @@ -0,0 +1,66 @@ +/****************************************************************************** + + (C) Nick Marley, 2001 - + + This software is distributed under the GNU Lesser General Public Licence. + Please read and understand the comments at the top of vf_iface.h before use! + +FILE + $Workfile$ + $Revision: 1.2 $ + $Author: tilda $ + +ORIGINAL AUTHOR + Nick Marley + +DESCRIPTION + Sample code for the vformat library. + +REFERENCES + (none) + +MODIFICATION HISTORY + * $Log: split_phonebook.h,v $ + * Revision 1.2 2001/10/24 05:29:24 tilda + * Tidy up. + * + * Revision 1.1.1.1 2001/10/16 05:49:57 tilda + * Initial Import to CVS. + * + *******************************************************************************/ + +#ifndef NORCSID +static const char split_phonebook_h_vss_id[] = "$Header: /cvsroot/vformat/build/samples/split_phonebook.h,v 1.2 2001/10/24 05:29:24 tilda Exp $"; +#endif + +/*=============================================================================* + Public Includes + *=============================================================================*/ +/* None */ + +/*============================================================================* + Public Defines + *============================================================================*/ +/* None */ + +/*============================================================================* + Public Functions + *============================================================================*/ + + +/*----------------------------------------------------------------------------* + * NAME + * split_phonebook() + * + * DESCRIPTION + * Read in the indicated file which is assumed to be a list of VCARDs. + * The component cards are written out to individual files. + * + * RETURNS + * TRUE <=> read / written OK. + *----------------------------------------------------------------------------*/ + +extern bool_t split_phonebook( + const char *p_filename, + const char *p_outdir + ); --- libvformat-1.13.orig/vformat/vf_iface.h +++ libvformat-1.13/vformat/vf_iface.h @@ -28,7 +28,7 @@ FILE $Workfile: vf_iface.h $ - $Revision: 1.30 $ + $Revision: 1.31 $ $Author: monos $ ORIGINAL AUTHOR @@ -42,6 +42,9 @@ MODIFICATION HISTORY * $Log: vf_iface.h,v $ + * Revision 1.31 2003/04/10 12:49:16 monos + * included type defs in vf_iface.h, started info documentation + * * Revision 1.30 2002/12/07 17:25:44 monos * *** empty log message *** * @@ -135,29 +138,45 @@ #define _VF_IFACE_H_ #ifndef NORCSID -static const char vf_iface_h_vss_id[] = "$Header: /cvsroot/vformat/src/vformat/vf_iface.h,v 1.30 2002/12/07 17:25:44 monos Exp $"; +static const char vf_iface_h_vss_id[] = "$Header: /cvsroot/vformat/src/vformat/vf_iface.h,v 1.31 2003/04/10 12:49:16 monos Exp $"; #endif /*============================================================================* Public Includes *============================================================================*/ -#include <common/types.h> -#include <stdarg.h> +/* Dont now yet how this is handled by windows systems */ + + /* c2man (for producing man pages) can't handle some lines in time.h */ #ifndef __C2MAN__ +#include <stdarg.h> #include <time.h> #else #define time_t long int +#define va_list char #endif /*============================================================================* Public defines *============================================================================*/ +#undef NULL +#define NULL 0 + +#undef FALSE +#define FALSE ((bool_t)(0)) + +#undef TRUE +#define TRUE ((bool_t)(1)) + + + + + #if defined(__cplusplus) extern "C" { #endif @@ -434,6 +453,23 @@ Public Types *============================================================================*/ +#ifndef _TYPES_H_ +#define _TYPES_H_ +#if defined(USE_INTTYPES_H) +#include <inttypes.h> +#else +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned long int uint32_t; +#endif + +/* + * Please avoide 'BOOL' (from Windows) and 'bool' (from C++) - vformat is used + * extensively in pure C embedded applications where neither are relevant. + */ +typedef unsigned char bool_t; +#endif + /* * Type representing "parser" - an object used to parse VOBJECTS. */ --- libvformat-1.13.orig/ChangeLog +++ libvformat-1.13/ChangeLog @@ -1,3 +1,10 @@ +2003-04-10 <mathias@ozone2.iup.uni-bremen.de> + + * Moved the content of common/types.h in vf_iface.h, + common/types.h is kept because of depends of sources on it. + + * included manpages and started info-files + 2002-11-22 Mathias Palm <mathias.palm@gmx.net> * manpages are generated from the header file and installed