refdb-cvs Mailing List for RefDB (Page 65)
Status: Beta
Brought to you by:
mhoenicka
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(88) |
Feb
(50) |
Mar
(36) |
Apr
(9) |
May
(30) |
Jun
(30) |
Jul
(22) |
Aug
(16) |
Sep
(42) |
Oct
(18) |
Nov
(29) |
Dec
(23) |
2005 |
Jan
(18) |
Feb
(28) |
Mar
(21) |
Apr
(35) |
May
(62) |
Jun
(22) |
Jul
(5) |
Aug
(40) |
Sep
(98) |
Oct
(81) |
Nov
(51) |
Dec
(62) |
2006 |
Jan
(46) |
Feb
(36) |
Mar
(8) |
Apr
(16) |
May
(14) |
Jun
(16) |
Jul
(47) |
Aug
(60) |
Sep
(34) |
Oct
(16) |
Nov
(46) |
Dec
(11) |
2007 |
Jan
(16) |
Feb
(13) |
Mar
(58) |
Apr
(32) |
May
(4) |
Jun
(8) |
Jul
(31) |
Aug
(46) |
Sep
(22) |
Oct
(30) |
Nov
(58) |
Dec
(15) |
2008 |
Jan
(8) |
Feb
(8) |
Mar
(2) |
Apr
(6) |
May
(3) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
(6) |
Nov
(3) |
Dec
(5) |
2009 |
Jan
(1) |
Feb
(20) |
Mar
(8) |
Apr
(5) |
May
(8) |
Jun
(3) |
Jul
(6) |
Aug
(4) |
Sep
(7) |
Oct
(8) |
Nov
(2) |
Dec
(1) |
2010 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
(5) |
Feb
(5) |
Mar
(13) |
Apr
(3) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
|
Dec
(3) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(13) |
2014 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(4) |
May
(1) |
Jun
(1) |
Jul
|
Aug
(6) |
Sep
(3) |
Oct
|
Nov
(2) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2022 |
Jan
(9) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Markus H. <mho...@us...> - 2004-07-06 22:08:18
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12120 Modified Files: Tag: Release_0_9_5_stable refdbc.c Log Message: getref s switch overrides fields variable Index: refdbc.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbc.c,v retrieving revision 1.72 retrieving revision 1.72.2.1 diff -u -U2 -r1.72 -r1.72.2.1 --- refdbc.c 31 Mar 2004 17:23:34 -0000 1.72 +++ refdbc.c 6 Jul 2004 22:08:09 -0000 1.72.2.1 @@ -2211,9 +2211,9 @@ if (*format_string || *default_fields) { strcat(slvals.outbuffer, " -s \""); - if (*default_fields) { - strcat(slvals.outbuffer, default_fields); + if (*format_string) { + strcat(slvals.outbuffer, format_string); } else { - strcat(slvals.outbuffer, format_string); + strcat(slvals.outbuffer, default_fields); } strcat(slvals.outbuffer, "\""); |
From: Markus H. <mho...@us...> - 2004-06-29 18:59:04
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22993 Modified Files: Tag: Release_0_9_5_stable refdbxp.c Log Message: count_lilicit():fix while loop to catch first entry and not to segfault if there are no members Index: refdbxp.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbxp.c,v retrieving revision 1.7.2.2 retrieving revision 1.7.2.3 diff -u -U2 -r1.7.2.2 -r1.7.2.3 --- refdbxp.c 24 Jun 2004 20:33:56 -0000 1.7.2.2 +++ refdbxp.c 29 Jun 2004 18:58:53 -0000 1.7.2.3 @@ -1149,4 +1149,8 @@ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ count_lilicit(): counts the members of the Lilicit linked list + + int count_lilicit returns the number of members minus one. This is + the easiest way to distinguish between single (0) + and multiple (!=0) references Lilicit* ptr_first ptr to the sentinel of the linked list @@ -1157,5 +1161,5 @@ Lilicit *ptr_curr; - ptr_curr = ptr_first->ptr_next; + ptr_curr = ptr_first; while (ptr_curr = get_next_lilicit(ptr_curr)) { @@ -1163,4 +1167,8 @@ } + if (i) { + i--; + } + return i; } |
From: Markus H. <mho...@us...> - 2004-06-27 22:24:40
|
Update of /cvsroot/refdb/refdb/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21637/scripts Modified Files: Tag: Release_0_9_5_stable refdbxml.in Log Message: added support for FOP config file Index: refdbxml.in =================================================================== RCS file: /cvsroot/refdb/refdb/scripts/refdbxml.in,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -U2 -r1.12 -r1.12.2.1 --- refdbxml.in 28 Apr 2004 03:07:10 -0000 1.12 +++ refdbxml.in 27 Jun 2004 22:24:30 -0000 1.12.2.1 @@ -38,4 +38,7 @@ fo_classpath="" +# FOP can accept a user configuration file parameter +fop_config_file="" + # this option is required to find xep.sh which usually is not in your # PATH. Specify the directory containing xep.sh including the trailing @@ -90,4 +93,7 @@ outformat=$refdbval fi + if [ $refdbvar = fop_config_file ]; then + fop_config_file="-c $refdbval" + fi fi done < $config @@ -180,5 +186,5 @@ rm $basename.aux.$$;; fop ) - java -cp "$fo_classpath" org.apache.fop.apps.Fop -fo $1 -pdf $2;; + java -cp "$fo_classpath" org.apache.fop.apps.Fop $fop_config_file -fo $1 -pdf $2;; xep ) ${xep_path}xep.sh -fo $1 -pdf $2;; @@ -187,8 +193,9 @@ # read the command line options -while getopts ":hp:f:s:t:" opt; do +while getopts ":hp:f:s:t:c:" opt; do case $opt in + c ) fop_config_file="-c $OPTARG";; h ) echo "creates formatted output from a DocBook or TEI XML sources" - echo 'usage: refdbxml [-h] [-p xslt_processor] [-f fo_processor ] [-s stylesheet] [-t outformat] file1 [file2...]' + echo 'usage: refdbxml [-c fop_config_file] [-h] [-p xslt_processor] [-f fo_processor ] [-s stylesheet] [-t outformat] file1 [file2...]' echo "Options: -h print this help and exit" echo " -p specify xslt processor: xalan, xt, saxon, or xsltproc" @@ -201,5 +208,5 @@ s ) stylesheet=$OPTARG;; t ) outformat=$OPTARG;; - \? ) echo 'usage: refdbxml [-h] [-p xslt_processor] [-f fo_processor] [-s stylesheet] [-t outformat] file1 [file2...]' + \? ) echo 'usage: refdbxml [-c fop_config_file] [-h] [-p xslt_processor] [-f fo_processor] [-s stylesheet] [-t outformat] file1 [file2...]' echo 'type refdbxml -h to invoke help' exit 1;; @@ -251,4 +258,8 @@ fi +# if using fop and config file is specified, then check config file exists +[ "$fo_processor" = "fop" ] && [ -n "$fop_config_file" ] && [ ! -r +${fop_config_file##-c } ] && echo "unable to access fop configuration +file: ${fop_config_file##-c }" && fop_config_file="" # on Win32-cygwin, the native Win32 tools want the DOS path |
From: Markus H. <mho...@us...> - 2004-06-27 22:24:39
|
Update of /cvsroot/refdb/refdb/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21637/etc Modified Files: Tag: Release_0_9_5_stable refdbxmlrc Log Message: added support for FOP config file Index: refdbxmlrc =================================================================== RCS file: /cvsroot/refdb/refdb/etc/refdbxmlrc,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -U2 -r1.1 -r1.1.2.1 --- refdbxmlrc 5 Mar 2004 00:09:31 -0000 1.1 +++ refdbxmlrc 27 Jun 2004 22:24:30 -0000 1.1.2.1 @@ -76,4 +76,7 @@ #fo_classpath /usr/share/java +## FOP configuration file (optional). This option is useful to add font +## support to FOP +#fop_config_file /path/to/your/config/file ## Include following variables to cover all command line options |
From: Markus H. <mho...@us...> - 2004-06-24 21:17:51
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20130 Modified Files: Tag: Release_0_9_5_stable backend-risx.c Log Message: removed debug printf() calls Index: backend-risx.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-risx.c,v retrieving revision 1.30.2.1 retrieving revision 1.30.2.2 diff -u -U2 -r1.30.2.1 -r1.30.2.2 --- backend-risx.c 22 Jun 2004 22:23:19 -0000 1.30.2.1 +++ backend-risx.c 24 Jun 2004 21:17:42 -0000 1.30.2.2 @@ -737,5 +737,5 @@ int nhave_data = 0; - printf("in add_pubinfo_risx\n"); +/* printf("in add_pubinfo_risx\n"); */ /* get some memory for the pubinfo stuff */ buffer1_len = 4096; @@ -991,5 +991,5 @@ char* slashes[3] = {NULL, NULL, NULL}; /* only the first three slashes are relevant, if at all */ - printf("in add_pubdate_risx\n"); +/* printf("in add_pubdate_risx\n"); */ /* get some memory for the pubinfo stuff */ buffer1_len = 4096; @@ -1017,5 +1017,5 @@ if (item && *item) { int i = 0; - printf("item went to:%s<<\n", item); +/* printf("item went to:%s<<\n", item); */ nhave_other++; slash = strchr(item, (int)'/'); @@ -1049,7 +1049,7 @@ } - printf("date_buffer went to:%s<<\n", date_buffer); +/* printf("date_buffer went to:%s<<\n", date_buffer); */ if (nhave_year || nhave_other) { - printf("nhave_year=%d || nhave_other+%d went to TRUE\n", nhave_year, nhave_other); +/* printf("nhave_year=%d || nhave_other+%d went to TRUE\n", nhave_year, nhave_other); */ nhave_data++; if (print_elstart_x(&buffer1, &buffer1_len, "date", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, ptr_indent) == NULL) { @@ -1094,5 +1094,5 @@ } - printf("finish pubyear\n"); +/* printf("finish pubyear\n"); */ if (print_elend_x(&buffer1, &buffer1_len, "date", ptr_indent) == NULL) { free(buffer1); @@ -1100,5 +1100,5 @@ } } - printf("now I'm here\n"); +/* printf("now I'm here\n"); */ /*----------------------------------------------------------------*/ /* pubyear - other information */ @@ -1111,5 +1111,5 @@ } - printf("finish pubyearother\n"); +/* printf("finish pubyearother\n"); */ if (print_elend_x(&buffer1, &buffer1_len, "pubdate", ptr_indent) == NULL) { free(buffer1); |
From: Markus H. <mho...@us...> - 2004-06-24 21:10:17
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17599 Modified Files: Tag: Release_0_9_5_stable noteshandler.c refdbdnote.c refdbdref.c risxhandler.c Log Message: fixed off-by-one errors in character conversion Index: noteshandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/noteshandler.c,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -u -U2 -r1.18 -r1.18.2.1 --- noteshandler.c 16 Feb 2004 21:38:05 -0000 1.18 +++ noteshandler.c 24 Jun 2004 21:10:07 -0000 1.18.2.1 @@ -638,5 +638,5 @@ if (ptr_andata->conv_descriptor && *((ptr_andata->ptr_first)->ptr_elvalue)) { - inlength = strlen((ptr_andata->ptr_first)->ptr_elvalue) + 1; + inlength = strlen((ptr_andata->ptr_first)->ptr_elvalue)/* + 1 */; /* with the encodings supported by our database engines, the converted string can't be longer than the input string */ Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -u -U2 -r1.25 -r1.25.2.1 --- refdbdnote.c 15 Feb 2004 23:41:27 -0000 1.25 +++ refdbdnote.c 24 Jun 2004 21:10:07 -0000 1.25.2.1 @@ -2107,5 +2107,5 @@ char* my_sql_command_start = NULL; /* records initial state of my_elvalue */ const char* my_instring = NULL; /* this ptr will be modified by iconv() */ - inlength = strlen(sql_command) + 1; + inlength = strlen(sql_command)/* + 1 */; /* with the encodings supported by our database engines, the converted string can't be longer than six times the input string */ Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.65.2.1 retrieving revision 1.65.2.2 diff -u -U2 -r1.65.2.1 -r1.65.2.2 --- refdbdref.c 3 Jun 2004 21:41:02 -0000 1.65.2.1 +++ refdbdref.c 24 Jun 2004 21:10:07 -0000 1.65.2.2 @@ -4133,5 +4133,5 @@ const char* my_instring = NULL; /* this ptr will be modified by iconv() */ /* strlen should be ok here as this can't be a multibyte encoding */ - inlength = strlen(sql_command) + 1; + inlength = strlen(sql_command)/* + 1 */; /* with the encodings supported by our database engines, the converted string can't be longer than six times the input string */ Index: risxhandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/risxhandler.c,v retrieving revision 1.28.2.1 retrieving revision 1.28.2.2 diff -u -U2 -r1.28.2.1 -r1.28.2.2 --- risxhandler.c 7 May 2004 21:27:51 -0000 1.28.2.1 +++ risxhandler.c 24 Jun 2004 21:10:08 -0000 1.28.2.2 @@ -649,5 +649,5 @@ if (ptr_ardata->conv_descriptor && *((ptr_ardata->ptr_first)->ptr_elvalue)) { - inlength = strlen((ptr_ardata->ptr_first)->ptr_elvalue) + 1; + inlength = strlen((ptr_ardata->ptr_first)->ptr_elvalue)/* + 1 */; /* with the encodings supported by our database engines, the converted string can't be longer than the input string */ |
From: Markus H. <mho...@us...> - 2004-06-24 20:34:05
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9105/src Modified Files: Tag: Release_0_9_5_stable refdbxp.c Log Message: bail out if full citation is too short Index: refdbxp.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbxp.c,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -U2 -r1.7.2.1 -r1.7.2.2 --- refdbxp.c 20 Jun 2004 21:56:26 -0000 1.7.2.1 +++ refdbxp.c 24 Jun 2004 20:33:56 -0000 1.7.2.2 @@ -473,4 +473,9 @@ /* use one char less to eliminate trailing type specifier */ len = idend - idstring - 1; + + if (len < 5) { + /* incomplete citation */ + continue; + } /* skip the type suffix separator */ |
From: Markus H. <mho...@us...> - 2004-06-24 20:32:25
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8731/src Modified Files: Tag: Release_0_9_5_stable refdbdbib.c Log Message: fixed off-by-one error in character conversions Index: refdbdbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdbib.c,v retrieving revision 1.36.2.1 retrieving revision 1.36.2.2 diff -u -U2 -r1.36.2.1 -r1.36.2.2 --- refdbdbib.c 5 May 2004 19:36:03 -0000 1.36.2.1 +++ refdbdbib.c 24 Jun 2004 20:32:16 -0000 1.36.2.2 @@ -916,7 +916,7 @@ size_t orig_outlength; char* my_outbuffer = NULL; /* this ptr will be modified by iconv() */ - char* my_outbuffer_start = NULL; /* records initial state of my_elvalue */ + char* my_outbuffer_start = NULL; /* records initial state of outbuffer */ const char* my_instring = NULL; /* this ptr will be modified by iconv() */ - inlength = strlen(outbuffer) + 1; + inlength = strlen(outbuffer); /* with the encodings supported by our database engines, the converted string can't be longer than six times the input string */ |
From: Markus H. <mho...@us...> - 2004-06-24 20:30:05
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8160/src Modified Files: Tag: Release_0_9_5_stable backend-dbiba.c Log Message: fixed off-by-one error in character conversions Index: backend-dbiba.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-dbiba.c,v retrieving revision 1.26.2.3 retrieving revision 1.26.2.4 diff -u -U2 -r1.26.2.3 -r1.26.2.4 --- backend-dbiba.c 15 Jun 2004 22:26:36 -0000 1.26.2.3 +++ backend-dbiba.c 24 Jun 2004 20:29:57 -0000 1.26.2.4 @@ -1236,10 +1236,12 @@ } - if ((new_ref = format_month(*ptr_ref, ptr_ref_len, item_dateother, item_monthformat, item_pad, dbires_cit)) == NULL) { - delete_all_lilimem(&sentinel); - return NULL; - } - else { - *ptr_ref = new_ref; + if (item_dateother && *item_dateother) { + if ((new_ref = format_month(*ptr_ref, ptr_ref_len, item_dateother, item_monthformat, item_pad, dbires_cit)) == NULL) { + delete_all_lilimem(&sentinel); + return NULL; + } + else { + *ptr_ref = new_ref; + } } @@ -1280,11 +1282,12 @@ if (item_dateother && *item_dateother) { nhave_content = 1; - } - if ((new_ref = format_month(*ptr_ref, ptr_ref_len, item_dateother, item_monthformat, item_pad, dbires_cit)) == NULL) { - delete_all_lilimem(&sentinel); - return NULL; - } - else { - *ptr_ref = new_ref; + + if ((new_ref = format_month(*ptr_ref, ptr_ref_len, item_dateother, item_monthformat, item_pad, dbires_cit)) == NULL) { + delete_all_lilimem(&sentinel); + return NULL; + } + else { + *ptr_ref = new_ref; + } } @@ -1301,10 +1304,12 @@ } - if ((new_ref = format_day(*ptr_ref, ptr_ref_len, item_dateother, item_dayformat, item_pad)) == NULL) { - delete_all_lilimem(&sentinel); - return NULL; - } - else { - *ptr_ref = new_ref; + if (item_dateother && *item_dateother) { + if ((new_ref = format_day(*ptr_ref, ptr_ref_len, item_dateother, item_dayformat, item_pad)) == NULL) { + delete_all_lilimem(&sentinel); + return NULL; + } + else { + *ptr_ref = new_ref; + } } |
From: Markus H. <mho...@us...> - 2004-06-24 20:28:41
|
Update of /cvsroot/refdb/refdb/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7970/scripts Modified Files: Tag: Release_0_9_5_stable refdbnd.in runbib.in Log Message: added support for encoding Index: refdbnd.in =================================================================== RCS file: /cvsroot/refdb/refdb/scripts/refdbnd.in,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -U2 -r1.8 -r1.8.2.1 --- refdbnd.in 8 Feb 2004 00:36:39 -0000 1.8 +++ refdbnd.in 24 Jun 2004 20:28:33 -0000 1.8.2.1 @@ -3,5 +3,5 @@ # refdbnd: creates a new document and sets up a Makefile for use # with RefDB bibliographies -# Invocation: refdbnd basename doctype|filename pubtype database style +# Invocation: refdbnd basename doctype|filename pubtype database style encoding # or: refdbnd (interactive mode) @@ -29,5 +29,7 @@ defdatabase="refdbtest" defstyle="J.Biol.Chem." +defencoding="utf-8" xfile="" +encoding="" # Makefile-generated defaults @@ -54,12 +56,15 @@ doctype="db41x" pubtype=`grep "DTD DocBook XML V4.1.2//EN" $basename | sed 's/^<!DOCTYPE \(.*\) PUBLIC.*/\1/'` + encoding=`grep "^<?xml version=\"1.0\"" $basename | sed 's/^.*encoding=\"\(.*\)\".*/\1/'` else if grep "^<!DOCTYPE.*DTD DocBook XML V4.2//EN" $basename; then doctype="db42x" pubtype=`grep "DTD DocBook XML V4.2//EN" $basename | sed 's/^<!DOCTYPE \(.*\) PUBLIC.*/\1/'` + encoding=`grep "^<?xml version=\"1.0\"" $basename | sed 's/^.*encoding=\"\(.*\)\".*/\1/'` else if grep "^<!DOCTYPE.*TEI P4//DTD Main DTD Driver File//EN" $basename; then doctype="teix" pubtype=`grep "TEI P4//DTD Main DTD Driver File//EN" $basename | sed 's/^<!DOCTYPE \(.*\) PUBLIC.*/\1/'` + encoding=`grep "^<?xml version=\"1.0\"" $basename | sed 's/^.*encoding=\"\(.*\)\".*/\1/'` fi fi @@ -72,7 +77,7 @@ } -# if we have five command line arguments, we'll use them. Otherwise +# if we have six command line arguments, we'll use them. Otherwise # ask interactively -if [ -z "$*" ] || [ "$#" -ne 5 ]; then +if [ -z "$*" ] || [ "$#" -ne 6 ]; then # get arguments interactively clear @@ -92,5 +97,7 @@ echo "[$defbasename]" read basename - + if [ -z "$basename" ]; then + basename=$defbasename + fi check_existing_doc @@ -128,4 +135,10 @@ read style echo "" + if [ -z $encoding ]; then + echo "Please enter the character encoding that your document should use" + echo "[$defencoding]" + read encoding + echo "" + fi # apply defaults to empty strings @@ -145,4 +158,7 @@ style=$defstyle fi + if [ -z "$encoding" ]; then + encoding=$defencoding + fi else @@ -154,4 +170,5 @@ database=$4 style=$5 + encoding=$6 fi @@ -162,4 +179,5 @@ echo "Database: $database" echo "Bibliography style: $style" +echo "Encoding: $encoding" echo "" @@ -210,9 +228,11 @@ # substitute values -sed "s%<doctypeswitch>%$doctypeswitch%" < $maketemplate | sed "s%<pubtype>%$pubtype%" | sed "s%<basename>%$basename%" | sed "s%<extension>%$extension%" | sed "s%<style>%$style%" | sed "s%<htmlstylesheet>%$htmlstylesheet%" | sed "s%<xhtmlstylesheet>%$xhtmlstylesheet%" | sed "s%<printstylesheet>%$printstylesheet%" | sed "s%<database>%$database%" | sed "s%all: pdf rtf html%$makeall%" | sed "s%dist: pdfdist rtfdist htmldist%$dist%" | sed "s%<transformscript>%$transformscript%" > Makefile +sed "s%<doctypeswitch>%$doctypeswitch%" < $maketemplate | sed "s%<pubtype>%$pubtype%" | sed "s%<basename>%$basename%" | sed "s%<extension>%$extension%" | sed "s%<style>%$style%" | sed "s%<htmlstylesheet>%$htmlstylesheet%" | sed "s%<xhtmlstylesheet>%$xhtmlstylesheet%" | sed "s%<printstylesheet>%$printstylesheet%" | sed "s%<database>%$database%" | sed "s%all: pdf rtf html%$makeall%" | sed "s%dist: pdfdist rtfdist htmldist%$dist%" | sed "s%<transformscript>%$transformscript%" | sed "s%<encoding>%$encoding%" > Makefile echo "Makefile created." echo "" +encodingstring=" encoding=\"$encoding\"" + # create an empty document if [ -z $xfile ]; then @@ -221,7 +241,7 @@ db40 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V4.0//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; db41 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - db41x) echo -e "<?xml version=\"1.0\"?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - db42x) echo -e "<?xml version=\"1.0\"?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - teix ) echo -e "<?xml version=\"1.0\"?>\n<!DOCTYPE TEI.2 PUBLIC \"-//TEI P4//DTD Main DTD Driver File//EN\" \"http://www.tei-c.org/P4X/DTD/tei2.dtd\" [\n<!ENTITY % TEI.general 'INCLUDE'>\n<!ENTITY % TEI.names.dates 'INCLUDE'>\n<!ENTITY % TEI.linking 'INCLUDE'>\n<!ENTITY % TEI.XML 'INCLUDE'>\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; + db41x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; + db42x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; + teix ) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE TEI.2 PUBLIC \"-//TEI P4//DTD Main DTD Driver File//EN\" \"http://www.tei-c.org/P4X/DTD/tei2.dtd\" [\n<!ENTITY % TEI.general 'INCLUDE'>\n<!ENTITY % TEI.names.dates 'INCLUDE'>\n<!ENTITY % TEI.linking 'INCLUDE'>\n<!ENTITY % TEI.XML 'INCLUDE'>\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; esac echo "Document $basename.short.$extension created." Index: runbib.in =================================================================== RCS file: /cvsroot/refdb/refdb/scripts/runbib.in,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -U2 -r1.14 -r1.14.2.1 --- runbib.in 13 Nov 2003 00:24:28 -0000 1.14 +++ runbib.in 24 Jun 2004 20:28:33 -0000 1.14.2.1 @@ -40,4 +40,5 @@ # some initialization databaseopt="" +encodingopt="" outtype=db31 username="" @@ -88,10 +89,12 @@ # read the command line options -while getopts ":d:hi:IN:p:S:t:u:w:" opt; do +while getopts ":d:E:hi:IN:p:S:t:u:w:" opt; do case $opt in d ) databaseopt="-d "$OPTARG;; + E ) encodingopt="-E "$OPTARG;; h ) echo "creates refdb bibliography from a SGML, XML, or Latex document" - echo 'usage: runbib [-d database] [-h] [-i includevar] [-I] [-N number] [-S style] [-t type] [-u username] [-w password] file1 [file2...]' + echo 'usage: runbib [-d database] [-E encoding] [-h] [-i includevar] [-I] [-N number] [-S style] [-t type] [-u username] [-w password] file1 [file2...]' echo "Options: -d select default database" + echo " -E set output character encoding" echo " -h print this help and exit" echo " -i specify variable to include marked sections" @@ -171,5 +174,5 @@ # the bibliography file and the style specification file - $myrefdbib $databaseopt $useropt $passwdopt $numopt $portarg -S $style -D "." -t db31 $basename.id.xml > $basename.bib.sgml + $myrefdbib $databaseopt $encodingopt $useropt $passwdopt $numopt $portarg -S $style -D "." -t db31 $basename.id.xml > $basename.bib.sgml if [ $? -ne 0 ]; then # move the output to error files so we can use the script @@ -192,5 +195,5 @@ fi - $myrefdbib $databaseopt $useropt $passwdopt $numopt $portarg -S $style -D "." -t db31x $basename.id.xml > $basename.bib.xml + $myrefdbib $databaseopt $encodingopt $useropt $passwdopt $numopt $portarg -S $style -D "." -t db31x $basename.id.xml > $basename.bib.xml if [ $? -ne 0 ]; then # move the output to error files so we can use the script @@ -217,5 +220,5 @@ fi - $myrefdbib $databaseopt $useropt $passwdopt $numopt $portarg -S $style -D "." -t teix $basename.id.xml > $basename.bib.xml + $myrefdbib $databaseopt $encodingopt $useropt $passwdopt $numopt $portarg -S $style -D "." -t teix $basename.id.xml > $basename.bib.xml if [ $? -ne 0 ]; then # move the output to error files so we can use the script @@ -248,5 +251,5 @@ fi - $mysort $filename | $myuniq | $myrefdbib $databaseopt $useropt $passwdopt -S $style -t bibtex > $basename.bib + $mysort $filename | $myuniq | $myrefdbib $databaseopt $encodingopt $useropt $passwdopt -S $style -t bibtex > $basename.bib if [ $? -ne 0 ]; then exit 1 |
From: Markus H. <mho...@us...> - 2004-06-24 20:28:09
|
Update of /cvsroot/refdb/refdb/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7831/examples Modified Files: Tag: Release_0_9_5_stable Makefile.template Log Message: added support for encoding Index: Makefile.template =================================================================== RCS file: /cvsroot/refdb/refdb/examples/Makefile.template,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -U2 -r1.8 -r1.8.2.1 --- Makefile.template 1 Mar 2004 22:14:31 -0000 1.8 +++ Makefile.template 24 Jun 2004 20:27:59 -0000 1.8.2.1 @@ -24,4 +24,7 @@ stylename = <style> +# the character encoding to be used +encoding = <encoding> + # the stylesheet driver files for PDF and HTML output htmlstylesheet = ${stylename:.=}<htmlstylesheet> @@ -116,3 +119,3 @@ $(basename).bib.$(extension): $(basename).$(extension) - runbib -d $(database) -S $(stylename) -t $(doctypeswitch) $(basename).$(extension) + runbib -d $(database) -S $(stylename) -t $(doctypeswitch) -E $(encoding) $(basename).$(extension) |
From: Markus H. <mho...@us...> - 2004-06-22 22:23:29
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24915 Modified Files: Tag: Release_0_9_5_stable backend-risx.c Log Message: add_pubdate_risx(): promote have_buffer_data upstream Index: backend-risx.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-risx.c,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -u -U2 -r1.30 -r1.30.2.1 --- backend-risx.c 1 May 2004 23:40:14 -0000 1.30 +++ backend-risx.c 22 Jun 2004 22:23:19 -0000 1.30.2.1 @@ -737,4 +737,5 @@ int nhave_data = 0; + printf("in add_pubinfo_risx\n"); /* get some memory for the pubinfo stuff */ buffer1_len = 4096; @@ -979,5 +980,5 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ static char* add_pubdate_risx(char** ptr_buffer, size_t* ptr_buffer_len, dbi_conn conn, int type, struct renderinfo* ptr_rendinfo, int* ptr_nhave_buffer_data, struct xmlindent* ptr_indent) { - char date_buffer[256]; + char date_buffer[256] = ""; char* buffer1; char* new_ref; @@ -990,4 +991,5 @@ char* slashes[3] = {NULL, NULL, NULL}; /* only the first three slashes are relevant, if at all */ + printf("in add_pubdate_risx\n"); /* get some memory for the pubinfo stuff */ buffer1_len = 4096; @@ -1015,5 +1017,5 @@ if (item && *item) { int i = 0; - + printf("item went to:%s<<\n", item); nhave_other++; slash = strchr(item, (int)'/'); @@ -1047,5 +1049,7 @@ } + printf("date_buffer went to:%s<<\n", date_buffer); if (nhave_year || nhave_other) { + printf("nhave_year=%d || nhave_other+%d went to TRUE\n", nhave_year, nhave_other); nhave_data++; if (print_elstart_x(&buffer1, &buffer1_len, "date", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, ptr_indent) == NULL) { @@ -1090,4 +1094,5 @@ } + printf("finish pubyear\n"); if (print_elend_x(&buffer1, &buffer1_len, "date", ptr_indent) == NULL) { free(buffer1); @@ -1095,5 +1100,5 @@ } } - + printf("now I'm here\n"); /*----------------------------------------------------------------*/ /* pubyear - other information */ @@ -1106,4 +1111,5 @@ } + printf("finish pubyearother\n"); if (print_elend_x(&buffer1, &buffer1_len, "pubdate", ptr_indent) == NULL) { free(buffer1); @@ -1122,4 +1128,8 @@ } + if (nhave_data) { + (*ptr_nhave_buffer_data)++; + } + free(buffer1); return *ptr_buffer; |
From: Markus H. <mho...@us...> - 2004-06-20 21:56:35
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18634 Modified Files: Tag: Release_0_9_5_stable refdbxp.c Log Message: fixed memory allocation problems Index: refdbxp.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbxp.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -U2 -r1.7 -r1.7.2.1 --- refdbxp.c 19 Mar 2004 23:23:12 -0000 1.7 +++ refdbxp.c 20 Jun 2004 21:56:26 -0000 1.7.2.1 @@ -83,4 +83,5 @@ char typesep = '-'; /* separator for A,Q,Y etc suffix */ + /* prototypes */ int handle_full_style(Liliment *ptr_first, Lilicit *ptr_first_cit); @@ -222,4 +223,6 @@ /* loop over all \n-terminated lines of the input */ while ((result = fget_line(&linebuffer, &lb_len, start_tag, end_tag, infp)) != NULL) { +/* fprintf(stderr, linebuffer); */ + /* get sizes of linebuffer and outbuffer in sync if necessary */ if (lb_len > ob_len) { @@ -341,6 +344,8 @@ fputs(result, stdout); } + if (lb_len > LINE_SIZE) { - new_linebuffer = (char*)realloc(linebuffer, LINE_SIZE); + lb_len = LINE_SIZE; + new_linebuffer = (char*)realloc(linebuffer, lb_len); if (!new_linebuffer) { delete_all_lilicit(&cit_sentinel); @@ -355,4 +360,10 @@ } } + + if (uplinebuffer) { /* only used for SGML data, otherwise NULL */ + free(uplinebuffer); + uplinebuffer = NULL; + } + linebuffer[0] = '\0'; } @@ -399,5 +410,5 @@ cit_sentinel.cit = NULL; - if (!ptr_first->eldata && !*(ptr_first->eldata)) { + if (!ptr_first || (!ptr_first->eldata && !*(ptr_first->eldata))) { return 0; /* nothing to do */ } @@ -421,4 +432,5 @@ for (token = strtok(ptr_first->eldata, "<"); token; token = strtok(NULL, "<")) { +/* fprintf(stderr, "token:%s<<\n", token); */ if (!n_intype) { strup(token); @@ -773,5 +785,5 @@ char *start_cit; char *end_cit; - char *my_cit; + char *my_cit = NULL; size_t len; size_t total_len = 0; @@ -798,5 +810,5 @@ if (result[len-1] == '\n') { if (!n_have_cit) { - /* now we need to check whether the curent line contains + /* now we need to check whether the current line contains the start of an unfinished citation element. If so, we need to loop until we find the matching end tag */ @@ -827,4 +839,5 @@ n_have_cit = 1; } + my_cit = NULL; } } @@ -885,4 +898,5 @@ } } + return *linebuffer; } |
From: Markus H. <mho...@us...> - 2004-06-20 21:55:35
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18016 Modified Files: refdbxp.c Log Message: fixed memory allocation problems Index: refdbxp.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbxp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -U2 -r1.7 -r1.8 --- refdbxp.c 19 Mar 2004 23:23:12 -0000 1.7 +++ refdbxp.c 20 Jun 2004 21:55:22 -0000 1.8 @@ -83,4 +83,5 @@ char typesep = '-'; /* separator for A,Q,Y etc suffix */ + /* prototypes */ int handle_full_style(Liliment *ptr_first, Lilicit *ptr_first_cit); @@ -222,4 +223,6 @@ /* loop over all \n-terminated lines of the input */ while ((result = fget_line(&linebuffer, &lb_len, start_tag, end_tag, infp)) != NULL) { +/* fprintf(stderr, linebuffer); */ + /* get sizes of linebuffer and outbuffer in sync if necessary */ if (lb_len > ob_len) { @@ -341,6 +344,8 @@ fputs(result, stdout); } + if (lb_len > LINE_SIZE) { - new_linebuffer = (char*)realloc(linebuffer, LINE_SIZE); + lb_len = LINE_SIZE; + new_linebuffer = (char*)realloc(linebuffer, lb_len); if (!new_linebuffer) { delete_all_lilicit(&cit_sentinel); @@ -355,4 +360,10 @@ } } + + if (uplinebuffer) { /* only used for SGML data, otherwise NULL */ + free(uplinebuffer); + uplinebuffer = NULL; + } + linebuffer[0] = '\0'; } @@ -399,5 +410,5 @@ cit_sentinel.cit = NULL; - if (!ptr_first->eldata && !*(ptr_first->eldata)) { + if (!ptr_first || (!ptr_first->eldata && !*(ptr_first->eldata))) { return 0; /* nothing to do */ } @@ -421,4 +432,5 @@ for (token = strtok(ptr_first->eldata, "<"); token; token = strtok(NULL, "<")) { +/* fprintf(stderr, "token:%s<<\n", token); */ if (!n_intype) { strup(token); @@ -773,5 +785,5 @@ char *start_cit; char *end_cit; - char *my_cit; + char *my_cit = NULL; size_t len; size_t total_len = 0; @@ -798,5 +810,5 @@ if (result[len-1] == '\n') { if (!n_have_cit) { - /* now we need to check whether the curent line contains + /* now we need to check whether the current line contains the start of an unfinished citation element. If so, we need to loop until we find the matching end tag */ @@ -827,4 +839,5 @@ n_have_cit = 1; } + my_cit = NULL; } } @@ -885,4 +898,5 @@ } } + return *linebuffer; } |
From: Markus H. <mho...@us...> - 2004-06-20 21:54:32
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17104 Modified Files: refdbda.c Log Message: merge from stable branch Index: refdbda.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbda.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -U2 -r1.42 -r1.43 --- refdbda.c 17 May 2004 23:35:10 -0000 1.42 +++ refdbda.c 20 Jun 2004 21:54:20 -0000 1.43 @@ -1251,8 +1251,10 @@ } - /* MySQL 4.02 introduced a new privilege "LOCK TABLES". As older + /* MySQL 4.0.2 introduced a new privilege "LOCK TABLES". As older versions will barf at it, add it only if we use a newer version */ - if (ver.major >= 4 && ver.minor >= 2) { + if ((ver.major == 4 && ver.minor == 0 && ver.minuscule >=2) + || (ver.major == 4 && ver.minor > 0) + || ver.major > 4) { strcpy(lockstring, ",LOCK TABLES "); } @@ -1365,14 +1367,14 @@ a new user with the given password. If the user already exists, the password will be changed to the one given */ - sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE ON %s.* TO %s IDENTIFIED BY \'%s\'", MAIN_DB, userathost, newuser_passwd); + sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE%s ON %s.* TO %s IDENTIFIED BY \'%s\'", lockstring, MAIN_DB, userathost, newuser_passwd); } else if (create_new) { /* avoid possible security risk: we provide a default password to avoid creating users with no passwords */ - sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE ON %s.* TO %s IDENTIFIED BY \'refdb\'", MAIN_DB, userathost); + sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE%s ON %s.* TO %s IDENTIFIED BY \'refdb\'", lockstring, MAIN_DB, userathost); } else { /* the user already exists and we don't touch the password */ - sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE ON %s.* TO %s", MAIN_DB, userathost); + sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE%s ON %s.* TO %s", lockstring, MAIN_DB, userathost); } LOG_PRINT(LOG_DEBUG, sql_command); |
From: Markus H. <mho...@us...> - 2004-06-20 21:52:02
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14750 Modified Files: mods_processdata.h mods_processdata.c Log Message: new function mods_real_process_subject() Index: mods_processdata.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/mods_processdata.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -U2 -r1.1 -r1.2 --- mods_processdata.h 17 May 2004 23:12:51 -0000 1.1 +++ mods_processdata.h 20 Jun 2004 21:51:53 -0000 1.2 @@ -34,4 +34,5 @@ int mods_process_note(struct modsObject* ptr_note, struct addmods_data* ptr_amdata); int mods_process_subject(struct modsObject* ptr_subject, struct addmods_data* ptr_amdata); +int mods_real_process_subject(struct modsObject* ptr_subject, struct addmods_data* ptr_amdata, unsigned long long n_subject_id, char* type_q, char* href_q, char* role_q, char* arcrole_q, char* title_q, char* show_q, char* actuate_q, char* lang_q, char* script_q, char* transliteration_q); int mods_process_classification(struct modsObject* ptr_classification, struct addmods_data* ptr_amdata); int mods_process_relateditem(struct modsObject* ptr_relateditem, struct addmods_data* ptr_amdata); Index: mods_processdata.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/mods_processdata.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -U2 -r1.1 -r1.2 --- mods_processdata.c 17 May 2004 23:12:51 -0000 1.1 +++ mods_processdata.c 20 Jun 2004 21:51:53 -0000 1.2 @@ -40,4 +40,7 @@ #include "mods_handler.h" #include "mods_helper.h" +#include "mods_processdata.h" +#include "mods_checkdup.h" + extern int n_log_level; @@ -199,5 +202,5 @@ int mods_process_object returns 0 if ok, 1 if error - struct modsObject* ptr_titleinfo ptr to titleinfo object + struct modsObject* ptr_object ptr to mods object struct addmods_data* ptr_amdata ptr to addmods_data structure @@ -325,4 +328,13 @@ driver = dbi_conn_get_driver(ptr_amdata->conn); + + /* see whether this is a duplicate */ + n_titleinfo_id = mods_checkdup_titleinfo(ptr_titleinfo, ptr_amdata); + + if (n_titleinfo_id) { + LOG_PRINT(LOG_DEBUG, "found duplicate titleinfo"); + return 0; + } + /* look at the content linked list */ ptr_first_content = &(ptr_titleinfo->content_sentinel); @@ -520,5 +532,5 @@ ptr_curr_content = ptr_first_content; - while ((ptr_curr_content = get_lilinameval(ptr_curr_content, "title", 0)) != NULL) { + while ((ptr_curr_content = get_next_lilinameval(ptr_curr_content)) != NULL) { char *value_q; @@ -532,138 +544,25 @@ } - sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'title\', "ULLSPEC")", value_q, n_titleinfo_id); - - free(value_q); - - LOG_PRINT(LOG_DEBUG, sql_command); - dbires = dbi_conn_query(ptr_amdata->conn, sql_command); - - if (!dbires) { - (ptr_amdata->ndb_error)++; - LOG_PRINT(LOG_WARNING, "insert into t_titleparts failed"); - retval++; - goto finish; - } - - dbi_result_free(dbires); - } /* end if value */ - } /* end while */ - - ptr_curr_content = ptr_first_content; - - while ((ptr_curr_content = get_lilinameval(ptr_curr_content, "subTitle", 0)) != NULL) { - char *value_q; - - if (ptr_curr_content->value) { - result = dbi_driver_quote_string_copy(driver, ptr_curr_content->value, &value_q); - if (result == -1) { - (ptr_amdata->nmem_error)++; - LOG_PRINT(LOG_WARNING, "cannot quote argument"); - retval++; - goto finish; + if (!strcmp(ptr_curr_content->name, "title")) { + sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'title\', "ULLSPEC")", value_q, n_titleinfo_id); } - - sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'subTitle\', "ULLSPEC")", value_q, n_titleinfo_id); - - free(value_q); - LOG_PRINT(LOG_DEBUG, sql_command); - dbires = dbi_conn_query(ptr_amdata->conn, sql_command); - - if (!dbires) { - (ptr_amdata->ndb_error)++; - LOG_PRINT(LOG_WARNING, "insert into t_titleparts failed"); - retval++; - goto finish; + else if (!strcmp(ptr_curr_content->name, "subTitle")) { + sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'subTitle\', "ULLSPEC")", value_q, n_titleinfo_id); } - - dbi_result_free(dbires); - } /* end if value */ - } /* end while */ - - ptr_curr_content = ptr_first_content; - - while ((ptr_curr_content = get_lilinameval(ptr_curr_content, "partNumber", 0)) != NULL) { - char *value_q; - - if (ptr_curr_content->value) { - result = dbi_driver_quote_string_copy(driver, ptr_curr_content->value, &value_q); - if (result == -1) { - (ptr_amdata->nmem_error)++; - LOG_PRINT(LOG_WARNING, "cannot quote argument"); - retval++; - goto finish; + else if (!strcmp(ptr_curr_content->name, "partNumber")) { + sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'partNumber\', "ULLSPEC")", value_q, n_titleinfo_id); } - - sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'partNumber\', "ULLSPEC")", value_q, n_titleinfo_id); - - free(value_q); - - LOG_PRINT(LOG_DEBUG, sql_command); - dbires = dbi_conn_query(ptr_amdata->conn, sql_command); - - if (!dbires) { - (ptr_amdata->ndb_error)++; - LOG_PRINT(LOG_WARNING, "insert into t_titleparts failed"); - retval++; - goto finish; + else if (!strcmp(ptr_curr_content->name, "partName")) { + sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'partName\', "ULLSPEC")", value_q, n_titleinfo_id); } - - dbi_result_free(dbires); - } /* end if value */ - } /* end while */ - - ptr_curr_content = ptr_first_content; - - if ((ptr_curr_content = get_lilinameval(ptr_curr_content, "partName", 0)) != NULL) { - char *value_q; - - if (ptr_curr_content->value) { - result = dbi_driver_quote_string_copy(driver, ptr_curr_content->value, &value_q); - if (result == -1) { - (ptr_amdata->nmem_error)++; - LOG_PRINT(LOG_WARNING, "cannot quote argument"); - retval++; - goto finish; + else if (!strcmp(ptr_curr_content->name, "nonSort")) { + sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'nonSort\', "ULLSPEC")", value_q, n_titleinfo_id); } - sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'partName\', "ULLSPEC")", value_q, n_titleinfo_id); - free(value_q); LOG_PRINT(LOG_DEBUG, sql_command); dbires = dbi_conn_query(ptr_amdata->conn, sql_command); - - if (!dbires) { - (ptr_amdata->ndb_error)++; - LOG_PRINT(LOG_WARNING, "insert into t_titleparts failed"); - retval++; - goto finish; - } - - dbi_result_free(dbires); - } /* end if value */ - } /* end while */ - - ptr_curr_content = ptr_first_content; - - if ((ptr_curr_content = get_lilinameval(ptr_curr_content, "nonSort", 0)) != NULL) { - char *value_q; - - if (ptr_curr_content->value) { - result = dbi_driver_quote_string_copy(driver, ptr_curr_content->value, &value_q); - if (result == -1) { - (ptr_amdata->nmem_error)++; - LOG_PRINT(LOG_WARNING, "cannot quote argument"); - retval++; - goto finish; - } - sprintf(sql_command, "INSERT INTO t_titleparts (titleparts_value, titleparts_type, titleinfo_id) VALUES (%s, \'nonSort\', "ULLSPEC")", value_q, n_titleinfo_id); - - free(value_q); - - LOG_PRINT(LOG_DEBUG, sql_command); - dbires = dbi_conn_query(ptr_amdata->conn, sql_command); - if (!dbires) { (ptr_amdata->ndb_error)++; @@ -735,4 +634,12 @@ driver = dbi_conn_get_driver(ptr_amdata->conn); + /* see whether this is a duplicate */ + n_name_id = mods_checkdup_name(ptr_name, ptr_amdata); + + if (n_name_id) { + LOG_PRINT(LOG_DEBUG, "found duplicate name"); + return 0; + } + ptr_first_content = &(ptr_name->content_sentinel); @@ -2650,5 +2557,4 @@ char* title_q = NULL; char* transliteration_q = NULL; - char *sql_command; char *type_q = NULL; char *role_q = NULL; @@ -2660,7 +2566,5 @@ int retval = 0; int result; - size_t sql_cmd_len; - unsigned long long n_subject_id; - unsigned long long n_geocode_id; + unsigned long long n_subject_id = 0; struct lilimem sentinel; Lilinameval* ptr_curr_content; @@ -2679,4 +2583,12 @@ driver = dbi_conn_get_driver(ptr_amdata->conn); + + /* ToDo: check for duplicates */ + /* must generate sql command dynamically along these lines: + SELECT t_subject.subject_id FROM t_subject, t_geocode, t_xgeocode, t_nameval WHERE t_subject.subject_type='type' AND t_subject.subject_href='href' AND t_subject.subject_role='role' AND t_subject.subject_arcrole='arcrole' AND t_subject.subject_title='title' AND t_subject.subject_show='show' AND t_subject.subject_actuate='actuate' AND t_subject.subject_lang='lang' AND t_subject.subject_script='script' AND t_subject.subject_transliteration='transliteration' AND t_geocode.geocode_value='value' AND t_geocode.geocode_authority='authority' AND t_geocode.geocode_id=t_xgeocode.geocode_id AND t_xgeocode.subject_id=t_subject.subject_id AND t_nameval.nameval_name='elname' AND t_nameval.nameval_value='value' AND t_nameval.nameval_parent='subject' AND t_nameval.parent_id=t_subject.subject_id + +Use same code as below to walk through the bits and pieces */ + + ptr_curr_content = get_lilinameval(&(ptr_subject->content_sentinel), "href", 1); @@ -2786,4 +2698,72 @@ } + n_subject_id = mods_checkdup_subject(ptr_subject, ptr_amdata, type_q, href_q, role_q, arcrole_q, title_q, show_q, actuate_q, lang_q, script_q, transliteration_q); + + result = mods_real_process_subject(ptr_subject, ptr_amdata, n_subject_id, type_q, href_q, role_q, arcrole_q, title_q, show_q, actuate_q, lang_q, script_q, transliteration_q); + + + finish: + delete_all_lilimem(&sentinel); + + return retval; +} + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + mods_real_process_subject(): processes subject data + + int mods_real_process_subject returns 0 if ok, 1 if error + + struct modsObject* ptr_subject ptr to subject object + + struct addmods_data* ptr_amdata ptr to addmods_data structure + + unsigned long long n_subject_id 0 if a new dataset should + be created, > 0 if the entry should be linked to the + existing subject entry with the given ID + + char* type_q ptr to quoted type + + char* href_q ptr to quoted href + + char* role_q ptr to quoted role + + char* arcrole_q ptr to quoted arcrole + + char* title_q ptr to quoted title + + char* show_q ptr to quoted show + + char* actuate_q ptr to quoted actuate + + char* lang_q ptr to quoted lang + + char* script_q ptr to quoted script + + char* transliteration_q ptr to quoted transliteration + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +int mods_real_process_subject(struct modsObject* ptr_subject, struct addmods_data* ptr_amdata, unsigned long long n_subject_id, char* type_q, char* href_q, char* role_q, char* arcrole_q, char* title_q, char* show_q, char* actuate_q, char* lang_q, char* script_q, char* transliteration_q) { + char *sql_command; + int retval = 0; + int result; + int n_create_new = 0; + size_t sql_cmd_len; + unsigned long long n_geocode_id = 0; + struct lilimem sentinel; + Lilinameval* ptr_curr_content; + Lilimodsdate* ptr_curr_lmdate; + Lilimodsobj* ptr_curr_lmobj; + struct modsDate* ptr_curr_date; + struct modsObject* ptr_curr_object; + dbi_result dbires; + dbi_driver driver; + +/* printf("process %s\n", ptr_subject->objectName); */ + + sentinel.ptr_mem = NULL; + sentinel.ptr_next = NULL; + sentinel.varname[0] = '\0'; + driver = dbi_conn_get_driver(ptr_amdata->conn); + sql_cmd_len = 512 /* sql overhead */; sql_cmd_len += (href_q) ? strlen(href_q) : 0; @@ -2797,25 +2777,28 @@ goto finish; } - - sprintf(sql_command, "INSERT INTO t_subject (subject_type, subject_href, subject_role, subject_arcrole, subject_title, subject_show, subject_actuate, subject_lang, subject_script, subject_transliteration) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", type_q, href_q, role_q, arcrole_q, title_q, show_q, actuate_q, lang_q, script_q, transliteration_q); - LOG_PRINT(LOG_DEBUG, sql_command); - dbires = dbi_conn_query(ptr_amdata->conn, sql_command); + if (!n_subject_id) { + n_create_new++; + sprintf(sql_command, "INSERT INTO t_subject (subject_type, subject_href, subject_role, subject_arcrole, subject_title, subject_show, subject_actuate, subject_lang, subject_script, subject_transliteration) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", type_q, href_q, role_q, arcrole_q, title_q, show_q, actuate_q, lang_q, script_q, transliteration_q); + + LOG_PRINT(LOG_DEBUG, sql_command); + dbires = dbi_conn_query(ptr_amdata->conn, sql_command); - if (!dbires) { - (ptr_amdata->ndb_error)++; - LOG_PRINT(LOG_WARNING, "insert into t_subject failed"); - retval++; - goto finish; - } - - dbi_result_free(dbires); + if (!dbires) { + (ptr_amdata->ndb_error)++; + LOG_PRINT(LOG_WARNING, "insert into t_subject failed"); + retval++; + goto finish; + } - /* retrieve subject_id of newly created dataset */ - if (!strcmp(ptr_amdata->drivername, "mysql") || !strcmp(ptr_amdata->drivername, "sqlite")) { - n_subject_id = dbi_conn_sequence_last(ptr_amdata->conn, NULL); - } - else if (!strcmp(ptr_amdata->drivername, "pgsql")) { - n_subject_id = dbi_conn_sequence_last(ptr_amdata->conn, "t_subject_subject_id_seq"); + dbi_result_free(dbires); + + /* retrieve subject_id of newly created dataset */ + if (!strcmp(ptr_amdata->drivername, "mysql") || !strcmp(ptr_amdata->drivername, "sqlite")) { + n_subject_id = dbi_conn_sequence_last(ptr_amdata->conn, NULL); + } + else if (!strcmp(ptr_amdata->drivername, "pgsql")) { + n_subject_id = dbi_conn_sequence_last(ptr_amdata->conn, "t_subject_subject_id_seq"); + } } @@ -2835,4 +2818,8 @@ dbi_result_free(dbires); + if (!n_create_new) { + goto finish; + } + ptr_curr_content = &(ptr_subject->content_sentinel); @@ -2895,4 +2882,5 @@ } else if (strcmp(ptr_curr_content->name, "transliteration")) { + /* topic | temporal | hierarchicalGeographic (subelements) | cartographics | occupation*/ sprintf(sql_command, "INSERT INTO t_nameval (nameval_name, nameval_value, nameval_parent, parent_id) VALUES (\'%s\', %s, \'%s\', "ULLSPEC")", ptr_curr_content->name, value_q, "subject", n_subject_id); } @@ -4022,5 +4010,5 @@ } - if (ptr_recordinfo->lang) { + if (*(ptr_recordinfo->lang)) { result = dbi_driver_quote_string_copy(driver, ptr_recordinfo->lang, &lang_q); if (result == -1 || insert_lilimem(&sentinel, (void**)&lang_q, NULL)) { @@ -4032,5 +4020,5 @@ } - if (ptr_recordinfo->script) { + if (*(ptr_recordinfo->script)) { result = dbi_driver_quote_string_copy(driver, ptr_recordinfo->script, &script_q); if (result == -1 || insert_lilimem(&sentinel, (void**)&script_q, NULL)) { |
From: Markus H. <mho...@us...> - 2004-06-20 21:49:05
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12647 Modified Files: mods_dbfncs.c Log Message: added extended notes stuff for sqlite Index: mods_dbfncs.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/mods_dbfncs.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -U2 -r1.1 -r1.2 --- mods_dbfncs.c 17 May 2004 23:12:51 -0000 1.1 +++ mods_dbfncs.c 20 Jun 2004 21:48:56 -0000 1.2 @@ -1872,4 +1872,54 @@ dbi_result_free(dbires); + /* create the extended notes table */ + dbires = dbi_conn_query(conn, "CREATE TABLE t_xtnote \ + (xtnote_id INTEGER PRIMARY KEY, \ + xtnote_key TEXT UNIQUE, \ + xtnote_title TEXT, \ + xtnote_content_type TEXT, \ + xtnote_content_xmllang TEXT, \ + xtnote_user_id INTEGER, \ + xtnote_date DATE, \ + xtnote_content TEXT)"); + + + if (!dbires) { + tiwrite(ptr_clrequest->fd, "create t_xtnote failed\n", TERM_NO); + return 1; + } + + dbi_result_free(dbires); + + /* create t_xtnote table indexes */ + dbires = dbi_conn_query(conn, "CREATE INDEX i_xtnote_title ON t_xtnote (xtnote_title)"); + + + if (!dbires) { + tiwrite(ptr_clrequest->fd, "create i_xtnote_title failed\n", TERM_NO); + return 1; + } + + dbi_result_free(dbires); + + dbires = dbi_conn_query(conn, "CREATE INDEX i_xtnote_xtnote_userid ON t_xtnote (xtnote_user_id)"); + + + if (!dbires) { + tiwrite(ptr_clrequest->fd, "create i_xtnote_xtnote_userid failed\n", TERM_NO); + return 1; + } + + dbi_result_free(dbires); + + dbires = dbi_conn_query(conn, "CREATE INDEX i_xtnote_date ON t_xtnote (xtnote_date)"); + + + if (!dbires) { + tiwrite(ptr_clrequest->fd, "create i_xtnote_date failed\n", TERM_NO); + return 1; + } + + dbi_result_free(dbires); + return 0; } |
From: Markus H. <mho...@us...> - 2004-06-20 21:47:48
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11468 Modified Files: linklist.h linklist.c Log Message: new function lilid_to_string() Index: linklist.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/linklist.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -U2 -r1.7 -r1.8 --- linklist.h 2 Sep 2003 00:25:22 -0000 1.7 +++ linklist.h 20 Jun 2004 21:47:39 -0000 1.8 @@ -104,4 +104,6 @@ unsigned long long count_lilid(Lilid* ptr_first); +char* lilid_to_string(Lilid* ptr_first); + int delete_all_lilid(Lilid *ptr_first); Index: linklist.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/linklist.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -U2 -r1.9 -r1.10 --- linklist.c 2 Sep 2003 00:25:22 -0000 1.9 +++ linklist.c 20 Jun 2004 21:47:39 -0000 1.10 @@ -21,4 +21,5 @@ #include <stdio.h> /* for a definition of NULL */ +#include "strfncs.h" #include "linklist.h" @@ -668,4 +669,52 @@ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + lilid_to_string(): concatenates the entries of the linked list to + a comma-separated string of values + + char lilid_to_string returns a string if ok or NULL in case of an error + + Lilid *ptr_first pointer to sentinel + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +char* lilid_to_string(Lilid* ptr_first) { + char* the_string; + char* the_new_string; + char buffer[32]; + size_t the_string_len = 256; + int is_first = 1; + Lilid *ptr_curr; + + if ((the_string = (char*)malloc(the_string_len)) == NULL) { + return NULL; + } + + *the_string = '\0'; + + /* start at the beginning */ + ptr_curr = ptr_first; + + /* loop over all list elements */ + while ((ptr_curr = get_next_lilid(ptr_curr)) != NULL) { + if (is_first) { + is_first--; + sprintf(buffer, ULLSPEC, ptr_curr->value); + } + else { + sprintf(buffer, ","ULLSPEC, ptr_curr->value); + } + + if ((the_new_string = mstrcat(the_string, buffer, &the_string_len, 0)) == NULL) { + free(the_string); + return NULL; + } + else { + the_string = the_new_string; + } + } + + return the_string; +} + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ delete_all_lilid(): deletes all members from the list |
From: Markus H. <mho...@us...> - 2004-06-20 21:45:47
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9496 Modified Files: backend-dbiba.c refdbdref.c xmlhandler.c xmlout.c Log Message: merge from stable branch Index: backend-dbiba.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-dbiba.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -U2 -r1.28 -r1.29 --- backend-dbiba.c 15 Jun 2004 00:53:34 -0000 1.28 +++ backend-dbiba.c 20 Jun 2004 21:45:32 -0000 1.29 @@ -3342,5 +3342,16 @@ } } - else if (nameorder && strcmp(nameorder, "LASTCOMMAFIRSTMIDDLE") == 0) { + else if (nameorder && (strcmp(nameorder, "LASTCOMMAFIRSTMIDDLE") == 0 + || strcmp(nameorder, "LASTCOMMASPCFIRSTMIDDLE") == 0)) { + char sep[3]; + + /* quick and dirty strcmp */ + if (nameorder[9] == 'F') { + strcpy(sep, ","); + } + else { + strcpy(sep, ", "); + } + if ((new_ref = format_lastname(ptr_ref, ptr_ref_len, *(ptr_ainfo->lastname) ? ptr_ainfo->lastname : ptr_ainfo->name, author_upper, nis_intext, type)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); @@ -3352,5 +3363,5 @@ if ((*(ptr_ainfo->lastname) || *(ptr_ainfo->name)) && (*(ptr_ainfo->firstname) || *ptr_ainfo->middlename)) { - if ((new_ref = mstrcat(*ptr_ref, ",", ptr_ref_len, 0)) == NULL) { + if ((new_ref = mstrcat(*ptr_ref, sep, ptr_ref_len, 0)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); return NULL; Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -U2 -r1.66 -r1.67 --- refdbdref.c 17 May 2004 23:41:08 -0000 1.66 +++ refdbdref.c 20 Jun 2004 21:45:37 -0000 1.67 @@ -1348,5 +1348,5 @@ dbi_result_free(dbires); - sprintf(sql_command, "SELECT user_id, xuser_id FROM t_xuser WHERE refdb_id="ULLSPEC, (unsigned long long)idval); + sprintf(sql_command, "SELECT t_user.user_id, t_user.user_name, t_xuser.xuser_id FROM t_user, t_xuser WHERE t_user.user_id=t_xuser.user_id AND t_xuser.refdb_id="ULLSPEC, (unsigned long long)idval); LOG_PRINT(LOG_DEBUG, sql_command); dbires_user = dbi_conn_query(conn, sql_command); @@ -1362,13 +1362,34 @@ } - if (dbi_result_get_numrows(dbires_user) > 1) { - /* dataset is used by at least one other user, refuse to delete it */ - sprintf(sql_command, "ID "ULLSPEC" is still in use\n", (unsigned long long)idval); - tiwrite(ptr_clrequest->fd, sql_command, TERM_NO); - my_dbi_conn_unlock(conn); - my_dbi_conn_rollback(conn); - dbi_result_free(dbires_user); - ptr_delresult->skipped++; - return 1; + if (dbi_result_get_numrows(dbires_user) >= 1) { + int used_by_other = 1; + + if (dbi_result_get_numrows(dbires_user) == 1) { + if (dbi_result_next_row(dbires_user) == 0) { + if (ptr_clrequest->n_cgi) { + iwrite(ptr_clrequest->fd, cgihead_plain.text, cgihead_plain.length); + } + tiwrite(ptr_clrequest->fd, "deleteref failed\n", TERM_NO); + my_dbi_conn_unlock(conn); + my_dbi_conn_rollback(conn); + LOG_PRINT(LOG_WARNING, "query error"); + return 0; + } + + if (!strcmp(ptr_clrequest->username, my_dbi_result_get_string(dbires_user, "user_name"))) { + used_by_other--; + } + } + + if (used_by_other) { + /* dataset is used by at least one other user, refuse to delete it */ + sprintf(sql_command, "ID "ULLSPEC" is still in use\n", (unsigned long long)idval); + tiwrite(ptr_clrequest->fd, sql_command, TERM_NO); + my_dbi_conn_unlock(conn); + my_dbi_conn_rollback(conn); + dbi_result_free(dbires_user); + ptr_delresult->skipped++; + return 1; + } } Index: xmlhandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlhandler.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -U2 -r1.23 -r1.24 --- xmlhandler.c 17 May 2004 23:54:34 -0000 1.23 +++ xmlhandler.c 20 Jun 2004 21:45:37 -0000 1.24 @@ -510,6 +510,26 @@ /* the name of the style */ if (strcmp((ptr_asdata->ptr_first)->elname, "STYLENAME") == 0) { - strncpy(ptr_asdata->the_journal, (ptr_asdata->ptr_first)->ptr_elvalue, 255); - ptr_asdata->the_journal[255] = '\0'; + char* the_journal_q = NULL; + + if ((the_journal_q = strdup((ptr_asdata->ptr_first)->ptr_elvalue)) == NULL) { + (*(ptr_asdata->ptr_nmem_error))++; + LOG_PRINT(LOG_WARNING, "error in sql command"); + } + else { + if (dbi_driver_quote_string(dbi_conn_get_driver(ptr_asdata->conn), &the_journal_q) == -1) { + (*(ptr_asdata->ptr_nmem_error))++; + LOG_PRINT(LOG_WARNING, "error in sql command"); + } + } + + if (the_journal_q) { + strncpy(ptr_asdata->the_journal, the_journal_q, 255); + ptr_asdata->the_journal[255] = '\0'; + free(the_journal_q); + } + else { + ptr_asdata->the_journal[0] = '\0'; + } + strcpy(column_name, "JOURNAL"); strcpy(table_name, "CITSTYLE"); @@ -788,5 +808,6 @@ else if (strcmp((ptr_asdata->ptr_first)->elname, "CITESTYLE") == 0) { (*(ptr_asdata->ptr_set_count))++; - sprintf(sql_command, "SELECT ID FROM CITSTYLE WHERE JOURNAL='%s' ORDER BY ID ASC", ptr_asdata->the_journal); + /* the_journal is already quoted */ + sprintf(sql_command, "SELECT ID FROM CITSTYLE WHERE JOURNAL=%s ORDER BY ID ASC", ptr_asdata->the_journal); dbires = dbi_conn_query(ptr_asdata->conn, sql_command); LOG_PRINT(LOG_DEBUG, sql_command); @@ -831,25 +852,40 @@ if (n_chardata) { - if (pubtype[0]) { - sprintf(sql_command, "UPDATE REFSTYLE SET %s='%s' WHERE CITSTYLEID="ULLSPEC" AND PUBTYPE='", column_name, (ptr_asdata->ptr_first)->ptr_elvalue, (unsigned long long)current_id); - /* we have to add pubtype outside of the sprintf call. The reason is unclear, but may be a hidden overflow or something */ - strcat(sql_command, pubtype); - strcat(sql_command, "\'"); - } - else { - sprintf(sql_command, "UPDATE %s SET %s='%s' WHERE ID="ULLSPEC, table_name, column_name, (ptr_asdata->ptr_first)->ptr_elvalue, (unsigned long long)current_id); - } - /* printf("%s\n", sql_command); */ - dbires = dbi_conn_query(ptr_asdata->conn, sql_command); - LOG_PRINT(LOG_DEBUG, sql_command); - if (!dbires) { - (*(ptr_asdata->ptr_ndb_error))++; - LOG_PRINT(LOG_WARNING, "error in sql command"); + char* elvalue_q = NULL; + + /* quote element value */ + if ((elvalue_q = strdup((ptr_asdata->ptr_first)->ptr_elvalue)) == NULL) { + /* todo: bail out */ } else { - dbi_result_free(dbires); + if (dbi_driver_quote_string(dbi_conn_get_driver(ptr_asdata->conn), &elvalue_q) == -1) { + /* todo: bail out */ + } } - } - } + + if (elvalue_q) { + if (pubtype[0]) { + sprintf(sql_command, "UPDATE REFSTYLE SET %s=%s WHERE CITSTYLEID="ULLSPEC" AND PUBTYPE='", column_name, elvalue_q, (unsigned long long)current_id); + /* we have to add pubtype outside of the sprintf call. The reason is unclear, but may be a hidden overflow or something */ + strcat(sql_command, pubtype); + strcat(sql_command, "\'"); + } + else { + sprintf(sql_command, "UPDATE %s SET %s=%s WHERE ID="ULLSPEC, table_name, column_name, elvalue_q, (unsigned long long)current_id); + } + + free(elvalue_q); + dbires = dbi_conn_query(ptr_asdata->conn, sql_command); + LOG_PRINT(LOG_DEBUG, sql_command); + if (!dbires) { + (*(ptr_asdata->ptr_ndb_error))++; + LOG_PRINT(LOG_WARNING, "error in sql command"); + } + else { + dbi_result_free(dbires); + } + } /* end if elvalue_q */ + } /* end if n_chardata */ + } /* end if no mem or db errors */ /* remove attributes of the current element from the list */ Index: xmlout.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlout.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -U2 -r1.6 -r1.7 --- xmlout.c 29 Jan 2004 01:42:51 -0000 1.6 +++ xmlout.c 20 Jun 2004 21:45:38 -0000 1.7 @@ -168,4 +168,6 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ int iwrite_element(struct CLIENT_REQUEST* ptr_clrequest, const char* elname, Liliform *ptr_first, const char *elvalue) { + char* entitize_buf; + if (!elvalue || !*elvalue || !elname || !*elname) { /* nothing to do */ @@ -177,8 +179,17 @@ } - if (tiwrite(ptr_clrequest->fd, elvalue, TERM_NO) == -1) { + /* take care of entities */ + if ((entitize_buf = strdup(elvalue)) == NULL + || sgml_entitize(&entitize_buf, NULL) == NULL) { + return 1; + } + + if (tiwrite(ptr_clrequest->fd, entitize_buf, TERM_NO) == -1) { + free(entitize_buf); return 1; } + free(entitize_buf); + if (iwrite_elend(ptr_clrequest, elname)) { return 1; |
From: Markus H. <mho...@us...> - 2004-06-20 21:42:59
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8402 Added Files: mods_checkdup.c mods_checkdup.h Log Message: initial version --- NEW FILE --- /* mods_checkdup.c: duplicate checking of mods records */ /* ma...@mh... 2004-05-31 */ /* $Id: mods_checkdup.c,v 1.1 2004/06/20 21:42:51 mhoenicka Exp $ */ /* This program 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 program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...1615 lines suppressed...] int free_name_lists returns 0 if ok struct name_lists* ptr_namelists ptr to name_lists structure ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ int free_name_lists(struct name_lists* ptr_namelists) { if (ptr_namelists != NULL) { delete_all_lilid(&(ptr_namelists->name)); delete_all_lilid(&(ptr_namelists->roleterm)); delete_all_lilid(&(ptr_namelists->nameval)); delete_all_lilid(&(ptr_namelists->nameparts)); free(ptr_namelists); } return 0; } --- NEW FILE --- /*+++++++++++++++++++++++ mods_checkdup.h header file for mods_checkdup.c ma...@mh... 2004-05-31 $Id: mods_checkdup.h,v 1.1 2004/06/20 21:42:51 mhoenicka Exp $ This program 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 program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++++++++++++++++++++++++*/ struct subject_lists { Lilid subject; Lilid topic; Lilid geographic; Lilid temporal; Lilid geographicCode; Lilid continent; Lilid country; Lilid province; Lilid region; Lilid state; Lilid territory; Lilid county; Lilid city; Lilid island; Lilid area; Lilid scale; Lilid projection; Lilid coordinates; Lilid occupation; Lilid date; }; struct subject_lists* new_subject_lists(); int free_subject_lists(struct subject_lists* ptr_sublists); struct titleinfo_lists { Lilid titleinfo; Lilid title; Lilid subTitle; Lilid partNumber; Lilid partName; Lilid nonSort; }; struct titleinfo_lists* new_titleinfo_lists(); int free_titleinfo_lists(struct titleinfo_lists* ptr_titleinfolists); struct name_lists { Lilid name; Lilid roleterm; Lilid nameval; Lilid nameparts; }; struct name_lists* new_name_lists(); int free_name_lists(struct name_lists* ptr_namelists); unsigned long long mods_checkdup_titleinfo(struct modsObject* ptr_titleinfo, struct addmods_data* ptr_amdata); unsigned long long mods_checkdup_name(struct modsObject* ptr_name, struct addmods_data* ptr_amdata); unsigned long long mods_checkdup_subject(struct modsObject* ptr_subject, struct addmods_data* ptr_amdata, char* type_q, char* href_q, char* role_q, char* arcrole_q, char* title_q, char* show_q, char* actuate_q, char* lang_q, char* script_q, char* transliteration_q); |
From: Markus H. <mho...@us...> - 2004-06-20 21:42:03
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7975 Modified Files: Makefile.am Log Message: added mods_checkdup Index: Makefile.am =================================================================== RCS file: /cvsroot/refdb/refdb/src/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -U2 -r1.22 -r1.23 --- Makefile.am 17 May 2004 23:15:46 -0000 1.22 +++ Makefile.am 20 Jun 2004 21:41:52 -0000 1.23 @@ -18,5 +18,5 @@ refdbc_SOURCES = refdbc.c pref.c strfncs.c readln.c page.c refdb-client.c client-commands.c readris.c connect.c tokenize.c getopt.c linklist.c enigma.c cgi.c atoll.c refdb.h refdbc.h pref.h strfncs.h readln.h page.h refdb-client.h client-commands.h readris.h connect.h tokenize.h getopt.h linklist.h enigma.h cgi.h -refdbd_SOURCES = refdbd.c refdbdref.c refdbda.c refdbdbib.c pref.c strfncs.c tokenize.c connect.c risdb.c writeris.c getopt.c readris.c backend.c backend-scrn.c backend-ris.c backend-risx.c backend-db31.c backend-teix.c backend-bibtex.c backend-html.c backend-dbib.c backend-dbiba.c linklist.c xmlhandler.c enigma.c cgi.c atoll.c dbfncs.c xmlout.c risxhandler.c authorinfo.c risdata.c noteshandler.c refdbdnote.c writenote.c backendn-scrn.c backendn-notex.c backendn-html.c xmlhelper.c elstack.c mods_starthandler.c mods_endhandler.c mods_objects.c mods_processdata.c mods_dbfncs.c mods_helper.c refdb.h refdbd.h pref.h strfncs.h tokenize.h connect.h risdb.h writeris.h getopt.h readris.h backend.h backend-scrn.h backend-ris.h backend-risx.h backend-db31.h backend-teix.h backend-bibtex.h backend-html.h backend-dbib.h linklist.h xmlhandler.h enigma.h cgi.h dbfncs.h xmlout.h risxhandler.h authorinfo.h risdata.h noteshandler.h writenote.h backendn-scrn.h backendn-notex.h xmlhelper.h backendn-html.h elstack.h mods_handler.h mods_objects.h mods_processdata.h mods_dbfncs.h mods_helper.h +refdbd_SOURCES = refdbd.c refdbdref.c refdbda.c refdbdbib.c pref.c strfncs.c tokenize.c connect.c risdb.c writeris.c getopt.c readris.c backend.c backend-scrn.c backend-ris.c backend-risx.c backend-db31.c backend-teix.c backend-bibtex.c backend-html.c backend-dbib.c backend-dbiba.c linklist.c xmlhandler.c enigma.c cgi.c atoll.c dbfncs.c xmlout.c risxhandler.c authorinfo.c risdata.c noteshandler.c refdbdnote.c writenote.c backendn-scrn.c backendn-notex.c backendn-html.c xmlhelper.c elstack.c mods_starthandler.c mods_endhandler.c mods_objects.c mods_processdata.c mods_dbfncs.c mods_helper.c mods_checkdup.c refdb.h refdbd.h pref.h strfncs.h tokenize.h connect.h risdb.h writeris.h getopt.h readris.h backend.h backend-scrn.h backend-ris.h backend-risx.h backend-db31.h backend-teix.h backend-bibtex.h backend-html.h backend-dbib.h linklist.h xmlhandler.h enigma.h cgi.h dbfncs.h xmlout.h risxhandler.h authorinfo.h risdata.h noteshandler.h writenote.h backendn-scrn.h backendn-notex.h xmlhelper.h backendn-html.h elstack.h mods_handler.h mods_objects.h mods_processdata.h mods_dbfncs.h mods_helper.h mods_checkdup.h refdbxp_SOURCES = refdbxp.c getopt.c strfncs.c getopt.h strfncs.h |
From: Markus H. <mho...@us...> - 2004-06-15 22:49:15
|
Update of /cvsroot/refdb/refdb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21777 Modified Files: Tag: Release_0_9_5_stable configure.in Log Message: bumped up version number Index: configure.in =================================================================== RCS file: /cvsroot/refdb/refdb/configure.in,v retrieving revision 1.49.2.1 retrieving revision 1.49.2.2 diff -u -U2 -r1.49.2.1 -r1.49.2.2 --- configure.in 7 May 2004 21:32:05 -0000 1.49.2.1 +++ configure.in 15 Jun 2004 22:49:04 -0000 1.49.2.2 @@ -6,5 +6,5 @@ dnl Use automake -AM_INIT_AUTOMAKE(refdb, 0.9.5-pre2) +AM_INIT_AUTOMAKE(refdb, 0.9.5-pre3) dnl Find out host type |
From: Markus H. <mho...@us...> - 2004-06-15 22:31:17
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6635/src Modified Files: Tag: Release_0_9_5_stable xmlout.c Log Message: entitize style output Index: xmlout.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlout.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -U2 -r1.6 -r1.6.2.1 --- xmlout.c 29 Jan 2004 01:42:51 -0000 1.6 +++ xmlout.c 15 Jun 2004 22:31:08 -0000 1.6.2.1 @@ -168,4 +168,6 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ int iwrite_element(struct CLIENT_REQUEST* ptr_clrequest, const char* elname, Liliform *ptr_first, const char *elvalue) { + char* entitize_buf; + if (!elvalue || !*elvalue || !elname || !*elname) { /* nothing to do */ @@ -177,8 +179,17 @@ } - if (tiwrite(ptr_clrequest->fd, elvalue, TERM_NO) == -1) { + /* take care of entities */ + if ((entitize_buf = strdup(elvalue)) == NULL + || sgml_entitize(&entitize_buf, NULL) == NULL) { + return 1; + } + + if (tiwrite(ptr_clrequest->fd, entitize_buf, TERM_NO) == -1) { + free(entitize_buf); return 1; } + free(entitize_buf); + if (iwrite_elend(ptr_clrequest, elname)) { return 1; |
From: Markus H. <mho...@us...> - 2004-06-15 22:30:38
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5870/src Modified Files: Tag: Release_0_9_5_stable xmlhandler.c Log Message: quote values before assembling SQL queries Index: xmlhandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlhandler.c,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -u -U2 -r1.22 -r1.22.2.1 --- xmlhandler.c 28 Apr 2004 03:03:16 -0000 1.22 +++ xmlhandler.c 15 Jun 2004 22:30:27 -0000 1.22.2.1 @@ -510,6 +510,26 @@ /* the name of the style */ if (strcmp((ptr_asdata->ptr_first)->elname, "STYLENAME") == 0) { - strncpy(ptr_asdata->the_journal, (ptr_asdata->ptr_first)->ptr_elvalue, 255); - ptr_asdata->the_journal[255] = '\0'; + char* the_journal_q = NULL; + + if ((the_journal_q = strdup((ptr_asdata->ptr_first)->ptr_elvalue)) == NULL) { + (*(ptr_asdata->ptr_nmem_error))++; + LOG_PRINT(LOG_WARNING, "error in sql command"); + } + else { + if (dbi_driver_quote_string(dbi_conn_get_driver(ptr_asdata->conn), &the_journal_q) == -1) { + (*(ptr_asdata->ptr_nmem_error))++; + LOG_PRINT(LOG_WARNING, "error in sql command"); + } + } + + if (the_journal_q) { + strncpy(ptr_asdata->the_journal, the_journal_q, 255); + ptr_asdata->the_journal[255] = '\0'; + free(the_journal_q); + } + else { + ptr_asdata->the_journal[0] = '\0'; + } + strcpy(column_name, "JOURNAL"); strcpy(table_name, "CITSTYLE"); @@ -788,5 +808,6 @@ else if (strcmp((ptr_asdata->ptr_first)->elname, "CITESTYLE") == 0) { (*(ptr_asdata->ptr_set_count))++; - sprintf(sql_command, "SELECT ID FROM CITSTYLE WHERE JOURNAL='%s' ORDER BY ID ASC", ptr_asdata->the_journal); + /* the_journal is already quoted */ + sprintf(sql_command, "SELECT ID FROM CITSTYLE WHERE JOURNAL=%s ORDER BY ID ASC", ptr_asdata->the_journal); dbires = dbi_conn_query(ptr_asdata->conn, sql_command); LOG_PRINT(LOG_DEBUG, sql_command); @@ -831,25 +852,40 @@ if (n_chardata) { - if (pubtype[0]) { - sprintf(sql_command, "UPDATE REFSTYLE SET %s='%s' WHERE CITSTYLEID="ULLSPEC" AND PUBTYPE='", column_name, (ptr_asdata->ptr_first)->ptr_elvalue, (unsigned long long)current_id); - /* we have to add pubtype outside of the sprintf call. The reason is unclear, but may be a hidden overflow or something */ - strcat(sql_command, pubtype); - strcat(sql_command, "\'"); - } - else { - sprintf(sql_command, "UPDATE %s SET %s='%s' WHERE ID="ULLSPEC, table_name, column_name, (ptr_asdata->ptr_first)->ptr_elvalue, (unsigned long long)current_id); - } - /* printf("%s\n", sql_command); */ - dbires = dbi_conn_query(ptr_asdata->conn, sql_command); - LOG_PRINT(LOG_DEBUG, sql_command); - if (!dbires) { - (*(ptr_asdata->ptr_ndb_error))++; - LOG_PRINT(LOG_WARNING, "error in sql command"); + char* elvalue_q = NULL; + + /* quote element value */ + if ((elvalue_q = strdup((ptr_asdata->ptr_first)->ptr_elvalue)) == NULL) { + /* todo: bail out */ } else { - dbi_result_free(dbires); + if (dbi_driver_quote_string(dbi_conn_get_driver(ptr_asdata->conn), &elvalue_q) == -1) { + /* todo: bail out */ + } } - } - } + + if (elvalue_q) { + if (pubtype[0]) { + sprintf(sql_command, "UPDATE REFSTYLE SET %s=%s WHERE CITSTYLEID="ULLSPEC" AND PUBTYPE='", column_name, elvalue_q, (unsigned long long)current_id); + /* we have to add pubtype outside of the sprintf call. The reason is unclear, but may be a hidden overflow or something */ + strcat(sql_command, pubtype); + strcat(sql_command, "\'"); + } + else { + sprintf(sql_command, "UPDATE %s SET %s=%s WHERE ID="ULLSPEC, table_name, column_name, elvalue_q, (unsigned long long)current_id); + } + + free(elvalue_q); + dbires = dbi_conn_query(ptr_asdata->conn, sql_command); + LOG_PRINT(LOG_DEBUG, sql_command); + if (!dbires) { + (*(ptr_asdata->ptr_ndb_error))++; + LOG_PRINT(LOG_WARNING, "error in sql command"); + } + else { + dbi_result_free(dbires); + } + } /* end if elvalue_q */ + } /* end if n_chardata */ + } /* end if no mem or db errors */ /* remove attributes of the current element from the list */ |
From: Markus H. <mho...@us...> - 2004-06-15 22:26:45
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2358/src Modified Files: Tag: Release_0_9_5_stable backend-dbiba.c Log Message: added support for LASTCOMMASPCFIRSTMIDDLE attribute value Index: backend-dbiba.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-dbiba.c,v retrieving revision 1.26.2.2 retrieving revision 1.26.2.3 diff -u -U2 -r1.26.2.2 -r1.26.2.3 --- backend-dbiba.c 15 Jun 2004 00:55:07 -0000 1.26.2.2 +++ backend-dbiba.c 15 Jun 2004 22:26:36 -0000 1.26.2.3 @@ -3342,5 +3342,16 @@ } } - else if (nameorder && strcmp(nameorder, "LASTCOMMAFIRSTMIDDLE") == 0) { + else if (nameorder && (strcmp(nameorder, "LASTCOMMAFIRSTMIDDLE") == 0 + || strcmp(nameorder, "LASTCOMMASPCFIRSTMIDDLE") == 0)) { + char sep[3]; + + /* quick and dirty strcmp */ + if (nameorder[9] == 'F') { + strcpy(sep, ","); + } + else { + strcpy(sep, ", "); + } + if ((new_ref = format_lastname(ptr_ref, ptr_ref_len, *(ptr_ainfo->lastname) ? ptr_ainfo->lastname : ptr_ainfo->name, author_upper, nis_intext, type)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); @@ -3352,5 +3363,5 @@ if ((*(ptr_ainfo->lastname) || *(ptr_ainfo->name)) && (*(ptr_ainfo->firstname) || *ptr_ainfo->middlename)) { - if ((new_ref = mstrcat(*ptr_ref, ",", ptr_ref_len, 0)) == NULL) { + if ((new_ref = mstrcat(*ptr_ref, sep, ptr_ref_len, 0)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); return NULL; |