/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * e-xml-utils.c * Copyright (C) 2000 Helix Code, Inc. * Author: Chris Lahey * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, 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. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include #include "e-util.h" int g_str_compare(const void *x, const void *y) { return strcmp(x, y); } int g_int_compare(const void *x, const void *y) { if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) ) return -1; else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) ) return 0; else return 1; } char * e_strdup_strip(char *string) { int i; int length = 0; int initial = 0; for ( i = 0; string[i]; i++ ) { if (initial == i && isspace(string[i])) { initial ++; } if (!isspace(string[i])) { length = i - initial + 1; } } return g_strndup(string + initial, length); } void e_free_object_list (GList *list) { GList *p; for (p = list; p != NULL; p = p->next) gtk_object_unref (GTK_OBJECT (p->data)); g_list_free (list); } void e_free_string_list (GList *list) { GList *p; for (p = list; p != NULL; p = p->next) g_free (p->data); g_list_free (list); } #define BUFF_SIZE 1024 char * e_read_file(const char *filename) { int fd; char buffer[BUFF_SIZE]; GList *list = NULL, *list_iterator; GList *lengths = NULL, *lengths_iterator; int length = 0; int bytes; char *ret_val; fd = open(filename, O_RDONLY); if (fd == -1) return NULL; bytes = read(fd, buffer, BUFF_SIZE); while (bytes) { if (bytes > 0) { list = g_list_prepend(list, g_strndup(buffer, bytes)); lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes)); length += bytes; } else { if (errno != EINTR) { close(fd); g_list_foreach(list, (GFunc) g_free, NULL); g_list_free(list); g_list_free(lengths); return NULL; } } bytes = read(fd, buffer, BUFF_SIZE); } ret_val = g_new(char, length + 1); ret_val[length] = 0; lengths_iterator = lengths; list_iterator = list; for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) { int this_length = GPOINTER_TO_INT(lengths_iterator->data); length -= this_length; memcpy(ret_val + length, list_iterator->data, this_length); } close(fd); g_list_foreach(list, (GFunc) g_free, NULL); g_list_free(list); g_list_free(lengths); return ret_val; } gint e_write_file(const char *filename, const char *data, int flags) { int fd; int length = strlen(data); int bytes; fd = open(filename, flags, 0666); if (fd == -1) return errno; while (length > 0) { bytes = write(fd, data, length); if (bytes > 0) { length -= bytes; data += bytes; } else { if (errno != EINTR && errno != EAGAIN) { int save_errno = errno; close(fd); return save_errno; } } } close(fd); return 0; } typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object, gint arg1, gint arg2, gpointer arg3, gpointer user_data); void e_marshal_INT__INT_INT_POINTER (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { GtkSignal_INT__INT_INT_POINTER rfunc; gint *return_val; return_val = GTK_RETLOC_INT (args[3]); rfunc = (GtkSignal_INT__INT_INT_POINTER) func; *return_val = (*rfunc) (object, GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]), GTK_VALUE_POINTER (args[2]), func_data); } typedef void (*GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, GtkObject *arg1, gdouble arg2, gdouble arg3, gboolean arg4, gpointer user_data); void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; rfunc = (GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) func; (*rfunc) (object, GTK_VALUE_OBJECT (args[0]), GTK_VALUE_DOUBLE (args[1]), GTK_VALUE_DOUBLE (args[2]), GTK_VALUE_BOOL (args[3]), func_data); } typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, GtkObject *arg1, gdouble arg2, gdouble arg3, gboolean arg4, gpointer user_data); void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; gdouble *return_val; return_val = GTK_RETLOC_DOUBLE (args[4]); rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) func; *return_val = (*rfunc) (object, GTK_VALUE_OBJECT (args[0]), GTK_VALUE_DOUBLE (args[1]), GTK_VALUE_DOUBLE (args[2]), GTK_VALUE_BOOL (args[3]), func_data); } typedef gdouble (*GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, GtkObject *arg1, gdouble arg2, gdouble arg3, gboolean arg4, gpointer user_data); void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; gboolean *return_val; return_val = GTK_RETLOC_BOOL (args[4]); rfunc = (GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) func; *return_val = (*rfunc) (object, GTK_VALUE_OBJECT (args[0]), GTK_VALUE_DOUBLE (args[1]), GTK_VALUE_DOUBLE (args[2]), GTK_VALUE_BOOL (args[3]), func_data); } 2c9ac089869effe1217c1'/>
Commit message (Expand)AuthorAgeFilesLines
* - Update Calligra and l10n ports to 2.6.2:avilla2013-03-302-5/+8
* KDE/FreeBSD team presents KDE SC 4.10.1 ports!makc2013-03-274-43/+97
* Update to 4.0.1.jkim2013-03-091-4/+4
* Merge from area51 repository:makc2013-02-052-3/+3
* Update to 3.6.5.jkim2013-02-051-4/+4
* KDE/FreeBSD team presents KDE SC 4.9.5 ports!makc2013-02-044-32/+147
* - Deprecate QT3, KDE3 and unmaintained ports depending on them. QT 3.3.8beat2012-12-301-0/+3
* - Update to 3.5.7.jkim2012-10-272-9/+4
* - Update Calligra Suite to 2.5.2.avilla2012-09-171-2/+2
* - Update Calligra to 2.5.1.avilla2012-09-012-7/+2
* The KDE/FreeBSD team is pleased to announce version 2.5 of Calligra,avilla2012-08-262-15/+3
* - Update to 3.5.6.jkim2012-08-241-4/+4
* - Update LibreOffice and the language packs to 3.5.5.jkim2012-07-181-4/+4
* - Update Calligra to 2.4.3.avilla2012-07-051-2/+2
* - The FreeBSD Office team is proud to announce LibreOffice.org 3.5.4 releasefluffy2012-07-011-4/+4
* KDE/FreeBSD team presents KDE SC 4.8.4, probably the last release in 4.8.x se...makc2012-06-153-3/+33
* - update png to 1.5.10dinoex2012-06-012-1/+2
* - Remove koffice-i18n ports, as they are not very useful withoutavilla2012-05-315-64/+0
* The KDE/FreeBSD team is pleased to announce Calligra Suite 2.4.2, KDEavilla2012-05-319-238/+129
* KDE/FreeBSD team presents long awaited KDE SC 4.8.3!makc2012-05-254-20/+263
* - upgrade to 3.5.2bapt2012-04-234-0/+22
* - Bump PORTREVISION to chase the update of multimedia/libvpxashish2012-02-161-0/+1
* The KDE/FreeBSD team is pleased to announce KDE SC 4.7.4, whichavilla2012-01-252-2/+35
* - Pass maintainership to office@FreeBSD.orgsunpoet2011-11-291-1/+1
* The KDE on FreeBSD team is pleased to update the KDE4 ports to 4.7.3.rakuco2011-11-141-2/+2
* Mark as broken on powerpc-9: does not install.linimon2011-11-111-1/+7
* The KDE/FreeBSD team is pleased to announce KDE Software Compilationavilla2011-10-172-14/+60
* - Set DIST_SUBDIR: move dist files to DISTDIR/mythessunpoet2011-08-182-2/+3
* - Set DIST_SUBDIR: move dist files to DISTDIR/hyphensunpoet2011-08-182-2/+3
* - Set DIST_SUBDIR: move dist files to DISTDIR/hunspellsunpoet2011-08-182-2/+3
* - Change MASTER_SITES to my LOCAL to avoid implicit change of non-versionedsunpoet2011-08-182-4/+4
* - Set WRKSRCsunpoet2011-08-131-1/+2
* - Unify COMMENT and pkg-descrsunpoet2011-08-132-2/+2
* - Move language prefix to PKGNAMEPREFIXsunpoet2011-07-293-20/+20
* - Fix typosunpoet2011-07-251-1/+1
* Pass matainership to the new office teambapt2011-07-223-3/+3
* Add some locales thesaurusbapt2011-07-214-0/+40
* Add Ukrainian hyphenation rulesbapt2011-07-214-0/+33
* Add ukrainian hunspell dictionnarybapt2011-07-204-0/+41
* Reset maintainership de jure. In fact KDE 3 has not been maintained by our teammakc2011-07-082-2/+2
* Update KDE Software Compilation ports to 4.6.5makc2011-07-083-3/+155
* The FreeBSD KDE Team is pleased to announce KDE SC 4.6.4. Read fullavilla2011-06-141-2/+2
* Update KDE Software Compilation ports to 4.6.3makc2011-05-172-2/+56
* - Update KOffice to 2.3.3.avilla2011-04-132-4/+4
* The FreeBSD KDE Team is pleased to announce April updates for KDEavilla2011-04-071-2/+2
* - Update KOffice to 2.3.1.avilla2011-03-254-6/+30
* The FreeBSD KDE Team is pleased to announce KDE SC 4.6.1 and KDE PIMavilla2011-03-252-25/+67
* - Get Rid MD5 supportmiwi2011-03-195-5/+0
* - Remove unnecessary PKGNAMEPREFIX declarationsunpoet2011-01-094-4/+0
* - The KDE FreeBSD team is proud to announce the release of KDE 4.5.5fluffy2011-01-082-2/+30
* KDE FreeBSD team presents KDE SC 4.5.4.makc2010-12-033-7/+3
* Reset anray@FreeBSD.org due to maintainer-timeouts and no response to email.linimon2010-12-021-1/+1
* KDE FreeBSD team presents KDE SC 4.5.3.makc2010-11-042-3/+11
* KDE FreeBSD team presents KDE SC 4.5.2.makc2010-10-062-7/+12
* Autotools update. Read ports/UPDATING 20100915 for details.ade2010-09-162-4/+2
* KDE FreeBSD team presents KDE SC 4.5.1.makc2010-09-033-385/+76
* Update KOffice l10n ports to 2.2.2makc2010-08-284-24/+8
* Present KDE SC 4.4.5 for FreeBSD.makc2010-06-301-3/+3
* - Update KOffice (and its l10n packs) to 2.2.0 releasefluffy2010-06-194-26/+66
* Present KDE SC 4.4.4 for FreeBSD.makc2010-06-021-3/+3
* Bounce PORTREVISION for gettext-related ports. Have fun, ya'll.ade2010-05-312-2/+2
* - Update KOffice to 2.1.2 releasefluffy2010-05-116-64/+6
* - The FreeBSD KDE team is pleased to announce KDE SC 4.4.3 for FreeBSDfluffy2010-05-114-219/+430
* - update to 1.4.1dinoex2010-03-285-4/+5
* Presenting KDE 4.3.5 for FreeBSD. The official release notes for thismiwi2010-02-073-4/+43
* - update to jpeg-8dinoex2010-02-055-2/+5
* The KDE FreeBSD team is proud to announce the release of KOffice2 suite for F...fluffy2009-12-227-76/+243
* The FreeBSD KDE is please to announce the release of KDE 4.3.4,miwi2009-12-022-16/+78
* The KDE FreeBSD team is proud to announce the release of KDE 4.3.3miwi2009-11-272-5/+27
* The FreeBSD KDE is please to announce the release of KDE 4.3.1,tabthorpe2009-09-022-4/+4
* - Switch SourceForge ports to the new File Release System: categories startin...amdmi32009-08-221-2/+1
* clean upmakc2009-08-081-3/+0
* The KDE FreeBSD team is proud to announce the release of KDE 4.3.0miwi2009-08-054-27/+137
* - bump all port that indirectly depends on libjpeg and have not yet been bump...dinoex2009-07-315-0/+5
* The KDE FreeBSD team is pleased to announce KDE 4.2.4, the last bugfixmiwi2009-06-032-4/+8
* Update KDE ports to 4.2.3makc2009-05-102-3/+4
* The KDE FreeBSD team is proud to announce the release of KDE 4.2.2miwi2009-04-022-15/+25
* Update KDE to 4.2.1.makc2009-03-092-3/+31
* - Add all manpages for kde4-l10n*miwi2009-02-091-0/+57
* The KDE FreeBSD team is proud to announce the release of KDE 4.2.0miwi2009-02-093-92/+289
* kde@freebsd team is pleased to announce KDE 4.1.4, the last bugfix release in...makc2009-01-143-10/+502
* The KDE FreeBSD team is proud to announce the release of KDE 4.1.1miwi2008-09-032-8/+185
* The KDE FreeBSD team is proud to announce the releasemiwi2008-08-291-3/+3
* The KDE FreeBSD team is proud to announce the releasemiwi2008-08-182-7/+61
* The KDE FreeBSD team is proud to announce the release of KDE 4.1.0miwi2008-08-105-294/+747
* - unbreak after update to webalizer 2.20-01dinoex2008-08-063-34/+0
* Mark BROKEN: does not patch after the upgrade of www/webalizererwin2008-08-051-0/+2
* - Update maintainer's email addresspav2008-07-241-1/+1
* Bump portrevision due to upgrade of devel/gettext.edwin2008-06-061-0/+1
* - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-203-9/+10
* Update to KDE 3.5.8lofi2007-10-304-8/+8
* Update to KDE 3.5.7 / KOffice 1.6.3lofi2007-07-0412-41/+20
* Upgrade to 1.4.0-0.thierry2007-06-132-4/+4
* - Welcome X.org 7.2 \o/.flz2007-05-206-0/+6
* 2007-04-06 sysutils/tct: this port is obsolete, please use sysutils/sleuthkit...miwi2007-04-116-86/+0
* Update to KDE 3.5.6 / KOffice 1.6.2lofi2007-03-1413-21/+32
* Really normalize Aspell dictionaries ports PKGVERSION...thierry2007-02-151-1/+1
* Upgrade to 1.3.1-0.thierry2007-02-132-4/+4
* Schedule these broken ports for removal on 2007-04-10 if they are stillkris2007-02-111-0/+2
* - Switch dependencies to modern XFree86/Xorg portspav2007-02-031-1/+1
* Normalize Aspell dictionaries PKGNAMEs.thierry2007-01-141-0/+1
* BROKEN: Leaves behind config file on deinstallkris2007-01-111-0/+2
* Update to KDE 3.5.5 / KOffice 1.6.1lofi2006-12-2011-18/+21
* KDE 3.5.4 / KOffice 1.5.2lofi2006-09-1310-30/+24
* All dictionaries can be installed separately:thierry2006-07-154-7/+18
* Update to KDE 3.5.3lofi2006-06-064-16/+16
* Update to KOffice 1.5.1lofi2006-05-276-12/+12
* Update to KOffice 1.5.0lofi2006-04-299-78/+51
* Update to KDE 3.5.2lofi2006-03-314-122/+16
* Update to KDE 3.5.1.lofi2006-02-014-6/+14
* SHA256ifyedwin2006-01-245-0/+5
* Removed not needed distinfo and add empty MASTERSITES and DISTFILES for fix p...anray2006-01-172-3/+2
* Distfile moved to FILESDIR.anray2006-01-172-5/+108
* Update to KDE 3.5.0lofi2006-01-094-110/+68
* KOI8-U coding system for all emacsen.anray2005-12-165-0/+46
* Update to KDE 3.4.3 / KOffice 1.4.2lofi2005-11-052-4/+4
* Remove expired portskris2005-11-0519-3074/+0
* Do the same trick with uk-pine.language as done with ru-pine.languageedwin2005-11-043-8/+41
* Remove all the secondary port of editors/ooodict-allmaho2005-11-012-21/+0
* Fix index build by moving openoffice.org-1.1 ports.maho2005-08-291-1/+1
* Update to KDE 3.4.2 / KOffice 1.4.1lofi2005-08-0110-115/+37
* This port is scheduled for deletion on 2005-09-22 if it is still brokenkris2005-07-232-0/+4
* Update to KDE 3.4.1lofi2005-06-267-17/+6