diff --git a/CHANGES b/CHANGES index 9ddd6a0..d706ff9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,7 @@ -README - 06/18/2003 +README - 07/20/2003 ------------------- -CHANGES IN Mini-XML 1.0.1 +CHANGES IN Mini-XML 1.1 - The mxmlLoadFile() function now uses dynamically allocated string buffers for element names, attribute @@ -9,6 +9,8 @@ CHANGES IN Mini-XML 1.0.1 capped at 16383, 255, and 255 bytes, respectively. - Added a new mxmlLoadString() function for loading an XML node tree from a string. + - Add emulation of strdup() if the local platform does + not provide the function. CHANGES IN Mini-XML 1.0 diff --git a/Makefile.in b/Makefile.in index 303382a..3750590 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ # -# "$Id: Makefile.in,v 1.9 2003/07/20 13:19:08 mike Exp $" +# "$Id: Makefile.in,v 1.10 2003/07/20 13:41:17 mike Exp $" # # Makefile for mini-XML, a small XML-like file parsing library. # @@ -75,7 +75,8 @@ MAN3EXT = @MAN3EXT@ # DOCFILES = documentation.html README COPYING CHANGES -LIBOBJS = mxml-attr.o mxml-file.o mxml-node.o mxml-search.o +LIBOBJS = mxml-attr.o mxml-file.o mxml-node.o mxml-search.o \ + mxml-string.o OBJS = mxmldoc.o testmxml.o $(LIBOBJS) TARGETS = libmxml.a mxmldoc mxml.$(CAT3EXT) mxmldoc.$(CAT1EXT) \ testmxml mxml.xml @@ -213,9 +214,9 @@ mxml.xml: mxmldoc mxml.h $(LIBOBJS:.o=.c) # All object files depend on the makefile... # -$(OBJS): Makefile +$(OBJS): Makefile config.h # -# End of "$Id: Makefile.in,v 1.9 2003/07/20 13:19:08 mike Exp $". +# End of "$Id: Makefile.in,v 1.10 2003/07/20 13:41:17 mike Exp $". # diff --git a/README b/README index 5dc3e9b..137611d 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ -README - 06/14/2003 +README - 07/20/2003 ------------------- INTRODUCTION This README file describes the Mini-XML library version - 1.0.1. + 1.1. Mini-XML is a small XML parsing library that you can use to read XML and XML-like data files in your application without diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..1dac15b --- /dev/null +++ b/config.h.in @@ -0,0 +1,40 @@ +/* + * "$Id: config.h.in,v 1.1 2003/07/20 13:41:17 mike Exp $" + * + * Configuration file for mini-XML, a small XML-like file parsing library. + * + * Copyright 2003 by Michael Sweet. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2, or (at your option) any later version. + * + * This program 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 General Public License for more details. + */ + +/* + * Do we have the strXXX() functions? + */ + +#undef HAVE_STRDUP +#undef HAVE_STRLCAT +#undef HAVE_STRLCPY + + +/* + * Define prototypes for string functions as needed... + */ + +# ifndef HAVE_STRDUP +extern char *mxml_strdup(const char *); +# define strdup mxml_strdup +# endif /* !HAVE_STRDUP */ + + +/* + * End of "$Id: config.h.in,v 1.1 2003/07/20 13:41:17 mike Exp $". + */ diff --git a/configure b/configure index 8d98e6b..44294f3 100755 --- a/configure +++ b/configure @@ -1155,6 +1155,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_config_headers="$ac_config_headers config.h" + CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" @@ -1184,6 +1186,12 @@ fi; +uname=`uname` +uversion=`uname -r | sed -e '1,$s/[^0-9]//g'` +if test x$uname = xIRIX64; then + uname="IRIX" +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2588,7 +2596,7 @@ echo "${ECHO_T}no" >&6 fi -case "`uname`" in +case "$uname" in Darwin* | *BSD*) ARFLAGS="-rcv" ;; @@ -2599,6 +2607,86 @@ esac + + + + +for ac_func in strdup strlcat strlcpy +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + if test -n "$GCC"; then CFLAGS="-Wall $CFLAGS" fi @@ -2616,7 +2704,7 @@ if test "$docdir" = "NONE"; then fi if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then - case "`uname`" in + case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" @@ -2632,7 +2720,7 @@ if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then esac fi -case "`uname`" in +case "$uname" in *BSD* | Darwin*) # *BSD CAT1EXT="0" @@ -2729,38 +2817,7 @@ s/^[^=]*=[ ]*$//; }' fi -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - +DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} @@ -3056,10 +3113,15 @@ Usage: $0 [OPTIONS] [FILE]... --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files +Configuration headers: +$config_headers + Report bugs to ." _ACEOF @@ -3153,6 +3215,7 @@ do # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "mxml.list" ) CONFIG_FILES="$CONFIG_FILES mxml.list" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -3165,6 +3228,7 @@ done # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Create a temporary directory, and hook for its removal unless debugging. @@ -3453,6 +3517,223 @@ s,@abs_top_builddir@,$ac_abs_top_builddir,;t t done _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF diff --git a/configure.in b/configure.in index bfd6e58..e974928 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl -dnl "$Id: configure.in,v 1.5 2003/06/15 01:37:32 mike Exp $" +dnl "$Id: configure.in,v 1.6 2003/07/20 13:41:17 mike Exp $" dnl dnl Configuration script for mini-XML, a small XML-like file parsing library. dnl @@ -16,11 +16,14 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl +dnl Specify a source file from the distribution... AC_INIT(mxml.h) +dnl Set the name of the config header file... +AC_CONFIG_HEADER(config.h) + dnl Clear default debugging options and set normal optimization by dnl default unless the user asks for debugging specifically. - CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" LDFLAGS="${LDFLAGS:=}" @@ -41,6 +44,13 @@ AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation], AC_SUBST(docdir) +dnl Get the operating system and version number... +uname=`uname` +uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` +if test x$uname = xIRIX64; then + uname="IRIX" +fi + dnl Checks for programs... AC_PROG_CC AC_PROG_CXX @@ -60,7 +70,7 @@ fi AC_PATH_PROG(RM,rm) dnl Flags for "ar" command... -case "`uname`" in +case "$uname" in Darwin* | *BSD*) ARFLAGS="-rcv" ;; @@ -71,6 +81,9 @@ esac AC_SUBST(ARFLAGS) +dnl Checks for string functions. +AC_CHECK_FUNCS(strdup strlcat strlcpy) + dnl Add -Wall for GCC... if test -n "$GCC"; then CFLAGS="-Wall $CFLAGS" @@ -93,7 +106,7 @@ fi dnl Fix "mandir" variable if it hasn't been specified... if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then - case "`uname`" in + case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" @@ -110,7 +123,7 @@ if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then fi dnl More manpage stuff... -case "`uname`" in +case "$uname" in *BSD* | Darwin*) # *BSD CAT1EXT="0" @@ -136,5 +149,5 @@ dnl Output the makefile, etc... AC_OUTPUT(Makefile mxml.list) dnl -dnl End of "$Id: configure.in,v 1.5 2003/06/15 01:37:32 mike Exp $". +dnl End of "$Id: configure.in,v 1.6 2003/07/20 13:41:17 mike Exp $". dnl diff --git a/documentation.html b/documentation.html index 0a8facd..1b3b334 100644 --- a/documentation.html +++ b/documentation.html @@ -53,6 +53,7 @@
  • mxmlSaveString()
  • mxmlWalkNext()
  • mxmlWalkPrev()
  • +
  • mxml_strdup()

  • mxmlAdd()

    @@ -488,6 +489,23 @@ mxmlWalkPrev(

    Returns

    Previous node or NULL

    +
    +

    mxml_strdup()

    +

    Duplicate a string.

    +

    Syntax

    +
    +char *
    +mxml_strdup(
    +    const char * s);
    +
    +

    Arguments

    +

    + + + +
    NameDescription
    sString to duplicate

    +

    Returns

    +

    New string pointer

    Structures

    • mxml_attr_s
    • diff --git a/index.html b/index.html index f06db9e..e78f677 100644 --- a/index.html +++ b/index.html @@ -16,11 +16,11 @@ href="../index.html">Back to Home Page ]

      Mini-XML Home Page

      -

      Current Release: v1.0.1, June 15, 2003
      +

      Current Release: v1.1, July 20, 2003
      Download Source (.tar.gz 64k) +href="mxml-1.1.tar.gz">Download Source (.tar.gz 64k) | Download Linux RPM (.i386.rpm 42k) +href="mxml-1.1-1.i386.rpm">Download Linux RPM (.i386.rpm 42k) | Change Log | Documentation | Rate/Make Comments ]

      diff --git a/mxml-attr.c b/mxml-attr.c index c8efcf1..fd69d72 100644 --- a/mxml-attr.c +++ b/mxml-attr.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-attr.c,v 1.2 2003/06/14 23:56:47 mike Exp $" + * "$Id: mxml-attr.c,v 1.3 2003/07/20 13:41:17 mike Exp $" * * Attribute support code for mini-XML, a small XML-like file parsing library. * @@ -26,6 +26,7 @@ */ #include "mxml.h" +#include "config.h" /* @@ -155,5 +156,5 @@ mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ /* - * End of "$Id: mxml-attr.c,v 1.2 2003/06/14 23:56:47 mike Exp $". + * End of "$Id: mxml-attr.c,v 1.3 2003/07/20 13:41:17 mike Exp $". */ diff --git a/mxml-file.c b/mxml-file.c index a016b8d..4dafe09 100644 --- a/mxml-file.c +++ b/mxml-file.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-file.c,v 1.14 2003/07/20 13:19:08 mike Exp $" + * "$Id: mxml-file.c,v 1.15 2003/07/20 13:41:17 mike Exp $" * * File loading code for mini-XML, a small XML-like file parsing library. * @@ -36,6 +36,7 @@ */ #include "mxml.h" +#include "config.h" /* @@ -1372,5 +1373,5 @@ mxml_write_ws(mxml_node_t *node, /* I - Current node */ /* - * End of "$Id: mxml-file.c,v 1.14 2003/07/20 13:19:08 mike Exp $". + * End of "$Id: mxml-file.c,v 1.15 2003/07/20 13:41:17 mike Exp $". */ diff --git a/mxml-node.c b/mxml-node.c index 7f974d9..5413be2 100644 --- a/mxml-node.c +++ b/mxml-node.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-node.c,v 1.5 2003/06/14 23:56:47 mike Exp $" + * "$Id: mxml-node.c,v 1.6 2003/07/20 13:41:17 mike Exp $" * * Node support code for mini-XML, a small XML-like file parsing library. * @@ -33,6 +33,7 @@ */ #include "mxml.h" +#include "config.h" /* @@ -489,5 +490,5 @@ mxml_new(mxml_node_t *parent, /* I - Parent node */ /* - * End of "$Id: mxml-node.c,v 1.5 2003/06/14 23:56:47 mike Exp $". + * End of "$Id: mxml-node.c,v 1.6 2003/07/20 13:41:17 mike Exp $". */ diff --git a/mxml-search.c b/mxml-search.c index 0d9ca6e..167eaac 100644 --- a/mxml-search.c +++ b/mxml-search.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-search.c,v 1.6 2003/06/14 23:56:47 mike Exp $" + * "$Id: mxml-search.c,v 1.7 2003/07/20 13:41:17 mike Exp $" * * Search/navigation functions for mini-XML, a small XML-like file * parsing library. @@ -28,6 +28,7 @@ */ #include "mxml.h" +#include "config.h" /* @@ -194,5 +195,5 @@ mxmlWalkPrev(mxml_node_t *node, /* I - Current node */ /* - * End of "$Id: mxml-search.c,v 1.6 2003/06/14 23:56:47 mike Exp $". + * End of "$Id: mxml-search.c,v 1.7 2003/07/20 13:41:17 mike Exp $". */ diff --git a/mxml-string.c b/mxml-string.c new file mode 100644 index 0000000..94bfba7 --- /dev/null +++ b/mxml-string.c @@ -0,0 +1,54 @@ +/* + * "$Id: mxml-string.c,v 1.1 2003/07/20 13:41:17 mike Exp $" + * + * String functions for mini-XML, a small XML-like file parsing library. + * + * Copyright 2003 by Michael Sweet. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * Contents: + * + * mxml_strdup() - Duplicate a string. + */ + +/* + * Include necessary headers... + */ + +#include "config.h" + + +/* + * 'mxml_strdup()' - Duplicate a string. + */ + +#ifndef HAVE_STRDUP +char * /* O - New string pointer */ +mxml_strdup(const char *s) /* I - String to duplicate */ +{ + char *t; /* New string pointer */ + + + if (s == NULL) + return (NULL); + + if ((t = malloc(strlen(s) + 1)) == NULL) + return (NULL); + + return (strcpy(t, s)); +} +#endif /* !HAVE_STRDUP */ + + +/* + * End of "$Id: mxml-string.c,v 1.1 2003/07/20 13:41:17 mike Exp $". + */ diff --git a/mxml.xml b/mxml.xml index 14c4f8e..ba12387 100644 --- a/mxml.xml +++ b/mxml.xml @@ -207,6 +207,11 @@ name="child">mxml_node_t *First child nodemxml_value_tNode value struct mxml_node_sAn XML node.An XML node. +New string pointerchar +* +Duplicate a string.const char *String to duplicate + An XML text value.char *Fragment string intLeading whitespace? diff --git a/mxmldoc.c b/mxmldoc.c index 9093b09..07d7169 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -1,5 +1,5 @@ /* - * "$Id: mxmldoc.c,v 1.12 2003/06/14 23:56:47 mike Exp $" + * "$Id: mxmldoc.c,v 1.13 2003/07/20 13:41:17 mike Exp $" * * Documentation generator using mini-XML, a small XML-like file parsing * library. @@ -35,6 +35,7 @@ */ #include "mxml.h" +#include "config.h" /* @@ -2079,5 +2080,5 @@ ws_cb(mxml_node_t *node, /* I - Element node */ /* - * End of "$Id: mxmldoc.c,v 1.12 2003/06/14 23:56:47 mike Exp $". + * End of "$Id: mxmldoc.c,v 1.13 2003/07/20 13:41:17 mike Exp $". */ diff --git a/testmxml.c b/testmxml.c index f694585..52c2719 100644 --- a/testmxml.c +++ b/testmxml.c @@ -1,5 +1,5 @@ /* - * "$Id: testmxml.c,v 1.9 2003/06/19 03:20:41 mike Exp $" + * "$Id: testmxml.c,v 1.10 2003/07/20 13:41:17 mike Exp $" * * Test program for mini-XML, a small XML-like file parsing library. * @@ -28,6 +28,7 @@ */ #include "mxml.h" +#include "config.h" /* @@ -383,5 +384,5 @@ whitespace_cb(mxml_node_t *node, /* I - Element node */ /* - * End of "$Id: testmxml.c,v 1.9 2003/06/19 03:20:41 mike Exp $". + * End of "$Id: testmxml.c,v 1.10 2003/07/20 13:41:17 mike Exp $". */