refdb-cvs Mailing List for RefDB (Page 71)
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-02-04 21:06:55
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16736 Modified Files: refdbc.c Log Message: fix length of terminator Index: refdbc.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbc.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -U2 -r1.66 -r1.67 --- refdbc.c 1 Feb 2004 22:31:45 -0000 1.66 +++ refdbc.c 4 Feb 2004 21:04:09 -0000 1.67 @@ -1170,5 +1170,5 @@ } - sprintf(cmd_buffer+strlen(cmd_buffer), " %d", strlen(slvals.outbuffer)+1); + sprintf(cmd_buffer+strlen(cmd_buffer), " %d", strlen(slvals.outbuffer)+TERM_LEN); /* printf("%s\n", outbuffer); */ @@ -1545,5 +1545,5 @@ } - sprintf(cmd_buffer+strlen(cmd_buffer), " %d", strlen(slvals.outbuffer)+1); + sprintf(cmd_buffer+strlen(cmd_buffer), " %d", strlen(slvals.outbuffer)+TERM_LEN); /* printf("outbuffer:%s<<\ncmd_buffer:%s<<\n", outbuffer, cmd_buffer); */ |
From: Markus H. <mho...@us...> - 2004-02-04 21:03:45
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16246 Modified Files: refdb-client.c Log Message: fix length of terminator Index: refdb-client.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdb-client.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -U2 -r1.27 -r1.28 --- refdb-client.c 31 Jan 2004 14:50:22 -0000 1.27 +++ refdb-client.c 4 Feb 2004 21:01:13 -0000 1.28 @@ -721,5 +721,5 @@ if (!n_cgi) { (*ptr_ris_set_buffer)[0] = '\0'; - *ptr_n_setlength = 1; /* the 1 is for the terminating \0 */ + *ptr_n_setlength = TERM_LEN; /* for the terminating \0's */ n_result = read_ris_set(infp, default_ris, ptr_ris_set_buffer, ptr_n_setlength, 0); @@ -738,5 +738,5 @@ } - if (*ptr_n_setlength != 1) { /* if dataset is not empty */ + if (*ptr_n_setlength != TERM_LEN) { /* if dataset is not empty */ /* send length information to database server */ sprintf(thebytes, "%d", *ptr_n_setlength); |
From: Markus H. <mho...@us...> - 2004-02-04 21:01:36
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15639 Modified Files: readris.c Log Message: read_ris_set(): add terminator to end of dataset Index: readris.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/readris.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -U2 -r1.10 -r1.11 --- readris.c 17 Dec 2003 00:06:24 -0000 1.10 +++ readris.c 4 Feb 2004 20:58:59 -0000 1.11 @@ -29,4 +29,5 @@ #include <limits.h> +#include "refdb.h" #include "readris.h" #include "strfncs.h" @@ -179,4 +180,15 @@ free(linebuffer); + *ptr_inbufsize += TERM_LEN; + + newinbuf = realloc(*ptr_inbuffer, *ptr_inbufsize); + if (newinbuf == NULL) { + return 0; + } + else { + *ptr_inbuffer = newinbuf; + } + memset((*ptr_inbuffer) + *ptr_inbufsize - TERM_LEN, (int)'\0', TERM_LEN); + if (filedone) { return 2; |
From: Markus H. <mho...@us...> - 2004-02-01 22:35:21
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23303 Modified Files: tokenize.c Log Message: minor tilde fix Index: tokenize.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/tokenize.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -U2 -r1.12 -r1.13 --- tokenize.c 1 Feb 2004 00:36:20 -0000 1.12 +++ tokenize.c 1 Feb 2004 22:33:25 -0000 1.13 @@ -91,5 +91,5 @@ have quotes, so we ignore them now */ this_token = inbuffer; - delimiter = strpbrk(inbuffer, " \n\r"); + delimiter = strpbrk(inbuffer, " ~\n\r"); if (delimiter == NULL) { /* no more whitespace detected */ next_token = NULL; |
From: Markus H. <mho...@us...> - 2004-02-01 22:33:43
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21711 Modified Files: refdbc.c Log Message: fixed help strings of getref() and getnote(); minor tilde fixes Index: refdbc.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbc.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -U2 -r1.65 -r1.66 --- refdbc.c 31 Jan 2004 20:07:42 -0000 1.65 +++ refdbc.c 1 Feb 2004 22:31:45 -0000 1.66 @@ -2012,5 +2012,5 @@ break; case 'h': - printf("Displays the result of a database search.\nSyntax: getref [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|!=|>}{unix-regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding set the output character encoding\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, db31, db31x, teix, ris, risx, or bibtex\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of a database search.\nSyntax: getref [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|~|!=|!~|>}{string|regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding set the output character encoding\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, db31, db31x, teix, ris, risx, or bibtex\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); delete_all_lilimem(&sentinel); return 0; @@ -2157,6 +2157,7 @@ even if there is no space between e.g. a '=' and the quoted item. To rectify this, check whether the previous - item ended with a '=' */ - if (slvals.outbuffer[strlen(slvals.outbuffer)-1] != '=') { + item ended with a '=' or a '~' */ + if (slvals.outbuffer[strlen(slvals.outbuffer)-1] != '=' + && slvals.outbuffer[strlen(slvals.outbuffer)-1] != '~') { strcat(slvals.outbuffer, " "); } @@ -2591,11 +2592,11 @@ case 'h': if (type == 0 || type == 6 | type == 7) { - printf("Displays the result of an author search.\nSyntax: getau [-c command] [-d database] [-h] [-o outfile] [-O outfile] {unix-regexp}\ngeted and getas work the same way, but return a list of editors and series authors, respectively.\nOptions: -p command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of an author search.\nSyntax: getau [-c command] [-d database] [-h] [-o outfile] [-O outfile] {regexp}\ngeted and getas work the same way, but return a list of editors and series authors, respectively.\nOptions: -p command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n All other arguments are interpreted as the search string/regular expression.\n"); } else if (type == 1) { - printf("Displays the result of a keyword search.\nSyntax: getkw [-c command] [-d database] [-h] [-o outfile] [-O outfile] {unix-regexp}\nOptions: -p command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of a keyword search.\nSyntax: getkw [-c command] [-d database] [-h] [-o outfile] [-O outfile] {regexp}\nOptions: -p command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n All other arguments are interpreted as the search string/regular expression.\n"); } else { - printf("Displays the result of a journal search.\nSyntax: getjo [-a] [-c command] [-d database] [-h] [-o outfile] [-O outfile] {unix-regexp}\ngetjf, getj1, getj2 are used the same way, but search in full journal names, custom abbreviations1, and custom abbreviations 2, respectively\nOptions: -a list all synonyms\n -c command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of a journal search.\nSyntax: getjo [-a] [-c command] [-d database] [-h] [-o outfile] [-O outfile] {regexp}\ngetjf, getj1, getj2 are used the same way, but search in full journal names, custom abbreviations1, and custom abbreviations 2, respectively\nOptions: -a list all synonyms\n -c command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n All other arguments are interpreted as the search string/regular expression.\n"); } @@ -4470,5 +4471,5 @@ break; case 'h': - printf("Displays the result of a database search for notes.\nSyntax: getnote [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|!=|>}{unix-regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, or xnote\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of a database search for notes.\nSyntax: getnote [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|~|!=|!~|>}{string|regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, or xnote\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); delete_all_lilimem(&sentinel); return 0; |
From: Markus H. <mho...@us...> - 2004-02-01 00:38:08
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28907 Modified Files: refdbdnote.c refdbdref.c tokenize.c Log Message: support tilde to denote regexp match Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -U2 -r1.21 -r1.22 --- refdbdnote.c 31 Jan 2004 20:06:22 -0000 1.21 +++ refdbdnote.c 1 Feb 2004 00:36:20 -0000 1.22 @@ -35,4 +35,5 @@ #include "tokenize.h" #include "writenote.h" +#include "dbfncs.h" /* some globals */ @@ -791,5 +792,5 @@ if (*token != '&' && *token != '|') { /* simple keyword query */ - sprintf(sql_command, "SELECT DISTINCT t_xkeyword.xref_id FROM t_xkeyword, t_keyword WHERE t_xkeyword.xkeyword_type=\'NOTE\' AND t_keyword.keyword_id=t_xkeyword.keyword_id AND t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + sprintf(sql_command, "SELECT DISTINCT t_xkeyword.xref_id FROM t_xkeyword, t_keyword WHERE t_xkeyword.xkeyword_type=\'NOTE\' AND t_keyword.keyword_id=t_xkeyword.keyword_id AND t_keyword.keyword_name %s ", (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) ? "=" : my_dbi_conn_get_cap(conn, "rlike")); quoted_token = mstrdup(token); if (!quoted_token) { @@ -816,5 +817,11 @@ token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_keyword.keyword_name = "); + } + else { + sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -883,5 +890,11 @@ token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_keyword.keyword_name = "); + } + else { + sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -1038,5 +1051,5 @@ if (*token != '&' && *token != '|') { /* simple keyword query */ - sprintf(sql_command, "SELECT t_xnote.note_id FROM t_xnote, t_keyword WHERE t_keyword.keyword_id=t_xnote.xref_id AND t_xnote.xnote_type=\"KEYWORD\" AND t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + sprintf(sql_command, "SELECT t_xnote.note_id FROM t_xnote, t_keyword WHERE t_keyword.keyword_id=t_xnote.xref_id AND t_xnote.xnote_type=\'KEYWORD\' AND t_keyword.keyword_name %s ", (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) ? "=" : my_dbi_conn_get_cap(conn, "rlike")); quoted_token = mstrdup(token); if (!quoted_token) { @@ -1059,9 +1072,15 @@ } else if (*token == '|') { - strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id FROM t_xnote, t_keyword WHERE t_keyword.keyword_id=t_xnote.xref_id AND t_xnote.xnote_type=\"KEYWORD\" AND ("); + strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id FROM t_xnote, t_keyword WHERE t_keyword.keyword_id=t_xnote.xref_id AND t_xnote.xnote_type=\'KEYWORD\' AND ("); while (token != NULL) { token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_keyword.keyword_name = "); + } + else { + sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -1119,10 +1138,16 @@ else if (*token == '&') { counter = 0; - strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id, COUNT(*) FROM t_xnote, t_keyword WHERE t_keyword.keyword_id=t_xnote.xref_id AND t_xnote.xnote_type=\"KEYWORD\" AND ("); + strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id, COUNT(*) FROM t_xnote, t_keyword WHERE t_keyword.keyword_id=t_xnote.xref_id AND t_xnote.xnote_type=\'KEYWORD\' AND ("); while (token != NULL) { token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_keyword.keyword_name = "); + } + else { + sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -1278,5 +1303,5 @@ if (*token != '&' && *token != '|') { /* simple keyword query */ - sprintf(sql_command, "SELECT t_xnote.note_id FROM t_xnote, t_author WHERE t_author.author_id=t_xnote.xref_id AND t_xnote.xnote_type=\"AUTHOR\" AND t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + sprintf(sql_command, "SELECT t_xnote.note_id FROM t_xnote, t_author WHERE t_author.author_id=t_xnote.xref_id AND t_xnote.xnote_type=\'AUTHOR\' AND t_author.author_name %s ", (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) ? "=" : my_dbi_conn_get_cap(conn, "rlike")); quoted_token = mstrdup(token); if (!quoted_token) { @@ -1299,9 +1324,15 @@ } else if (*token == '|') { - strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id FROM t_xnote, t_author WHERE t_author.author_id=t_xnote.xref_id AND t_xnote.xnote_type=\"AUTHOR\" AND ("); + strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id FROM t_xnote, t_author WHERE t_author.author_id=t_xnote.xref_id AND t_xnote.xnote_type=\'AUTHOR\' AND ("); while (token != NULL) { token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_author.author_name = "); + } + else { + sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -1359,10 +1390,16 @@ else if (*token == '&') { counter = 0; - strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id, COUNT(*) FROM t_xnote, t_author WHERE t_author.author_id=t_xnote.xref_id AND t_xnote.xnote_type=\"AUTHOR\" AND ("); + strcpy(sql_command, "SELECT DISTINCT t_xnote.note_id, COUNT(*) FROM t_xnote, t_author WHERE t_author.author_id=t_xnote.xref_id AND t_xnote.xnote_type=\'AUTHOR\' AND ("); while (token != NULL) { token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_author.author_name = "); + } + else { + sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -1522,5 +1559,15 @@ /* translate operator to regexp operator */ - if (strncmp(operator, "=", 1) == 0) { + if (*operator == '=') { +/* sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); */ + if ((new_sql_command = mstrcat(sql_command, " = ", &sql_command_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command = new_sql_command; + } + } + else if (*operator == '~') { sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { @@ -1532,5 +1579,15 @@ } } - else { /* treat all other operators as non-equal */ + else if (*(operator+1) == '=') { +/* sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); */ + if ((new_sql_command = mstrcat(sql_command, " != ", &sql_command_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command = new_sql_command; + } + } + else { /* treat all other operators as non-equal regexp*/ sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { @@ -1650,5 +1707,17 @@ /* append operator */ - if ((new_sql_command = mstrcat(sql_command, operator, &sql_command_len, 0)) == NULL) { + if (strncmp(token, ":ID:", 4) == 0 && *operator == '~') { + strcpy(bitsandpieces, "="); + } + else if (strncmp(token, ":ID:", 4) == 0 + && *operator == '!' + && *(operator+1) == '~') { + strcpy(bitsandpieces, "!="); + } + else { + strcpy(bitsandpieces, operator); + } + + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; break; @@ -1802,23 +1871,23 @@ some intelligent translation into a regexp-based query */ if (n_isalpha) { - if (strncmp(operator, "=", 1) == 0) { + if (*operator == '=') { + strcpy(bitsandpieces, " = "); + } + else if (*operator == '~') { sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); - if ((new_sql_command1 = mstrcat(sql_command1, bitsandpieces, &sql_command1_len, 0)) == NULL) { - error = 1; - break; - } - else { - sql_command1 = new_sql_command1; - } + } + else if (*operator == '!' && *(operator+1) == '=') { + sprintf(bitsandpieces, " != "); } else { /* treat all other operators as non-equal */ sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); - if ((new_sql_command1 = mstrcat(sql_command1, bitsandpieces, &sql_command1_len, 0)) == NULL) { - error = 1; - break; - } - else { - sql_command1 = new_sql_command1; - } + } + + if ((new_sql_command1 = mstrcat(sql_command1, bitsandpieces, &sql_command1_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command1 = new_sql_command1; } } Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -U2 -r1.59 -r1.60 --- refdbdref.c 31 Jan 2004 20:06:23 -0000 1.59 +++ refdbdref.c 1 Feb 2004 00:36:20 -0000 1.60 @@ -2326,5 +2326,5 @@ /* plain query with one author */ if (*token != '&' && *token != '|') { - sprintf(sql_command, "SELECT DISTINCT t_xauthor.refdb_id FROM t_xauthor, t_author WHERE t_author.author_id=t_xauthor.author_id AND t_xauthor.xauthor_type=%s AND t_author.author_name %s ", get_author_type_string(driver, author_type), my_dbi_conn_get_cap(conn, "rlike")); + sprintf(sql_command, "SELECT DISTINCT t_xauthor.refdb_id FROM t_xauthor, t_author WHERE t_author.author_id=t_xauthor.author_id AND t_xauthor.xauthor_type=%s AND t_author.author_name %s ", get_author_type_string(driver, author_type), (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) ? "=" : my_dbi_conn_get_cap(conn, "rlike")); quoted_token = mstrdup(token); @@ -2356,5 +2356,11 @@ token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_author.author_name = "); + } + else { + sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -2429,5 +2435,11 @@ token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_author.author_name = "); + } + else { + sprintf(bitsandpieces, "t_author.author_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -2582,5 +2594,5 @@ if (*token != '&' && *token != '|') { /* simple keyword query */ - sprintf(sql_command, "SELECT DISTINCT t_xkeyword.xref_id FROM t_xkeyword, t_keyword WHERE t_xkeyword.xkeyword_type=\'REFERENCE\' AND t_keyword.keyword_id=t_xkeyword.keyword_id AND t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + sprintf(sql_command, "SELECT DISTINCT t_xkeyword.xref_id FROM t_xkeyword, t_keyword WHERE t_xkeyword.xkeyword_type=\'REFERENCE\' AND t_keyword.keyword_id=t_xkeyword.keyword_id AND t_keyword.keyword_name %s ", (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) ? "=" : my_dbi_conn_get_cap(conn, "rlike")); quoted_token = mstrdup(token); if (!quoted_token) { @@ -2607,5 +2619,11 @@ token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_keyword.keyword_name = "); + } + else { + sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -2674,5 +2692,11 @@ token = nstrtok(token+len, &len, " "); if (token != NULL) { - sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + if (*operator == '=' || (*operator == '!' && *(operator+1) == '=')) { + strcpy(bitsandpieces, "t_keyword.keyword_name = "); + } + else { + sprintf(bitsandpieces, "t_keyword.keyword_name %s ", my_dbi_conn_get_cap(conn, "rlike")); + } + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; @@ -2831,5 +2855,15 @@ /* translate operator to regexp operator */ - if (strncmp(operator, "=", 1) == 0) { + if (*operator == '=') { +/* sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); */ + if ((new_sql_command = mstrcat(sql_command, " = ", &sql_command_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command = new_sql_command; + } + } + else if (*operator == '~') { sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { @@ -2841,5 +2875,15 @@ } } - else { /* treat all other operators as non-equal */ + else if (*(operator+1) == '=') { +/* sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); */ + if ((new_sql_command = mstrcat(sql_command, " != ", &sql_command_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command = new_sql_command; + } + } + else { /* treat all other operators as non-equal regexp*/ sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { @@ -2977,5 +3021,15 @@ /* append operator */ - if ((new_sql_command = mstrcat(sql_command, operator, &sql_command_len, 0)) == NULL) { + if (*operator == '~') { + strcpy(bitsandpieces, "="); + } + else if (*operator == '!' && *(operator+1) == '~') { + strcpy(bitsandpieces, "!="); + } + else { + strcpy(bitsandpieces, operator); + } + + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { error = 1; break; @@ -3093,23 +3147,23 @@ /* translate operator to regexp operator */ - if (strncmp(operator, "=", 1) == 0) { + if (*operator == '=') { + strcpy(bitsandpieces, " = "); + } + else if (*operator == '~') { sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); - if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { - error = 1; - break; - } - else { - sql_command = new_sql_command; - } + } + else if (*operator == '!' && *(operator+1) == '=') { + strcpy(bitsandpieces, " != "); } else { /* treat all other operators as non-equal */ sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); - if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { - error = 1; - break; - } - else { - sql_command = new_sql_command; - } + } + + if ((new_sql_command = mstrcat(sql_command, bitsandpieces, &sql_command_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command = new_sql_command; } @@ -3215,5 +3269,16 @@ /* assemble a surrogate subselect query */ - if (operator[0] == '=') { + if (*operator == '=') { + if (strncmp(token, ":RP:", 4) == 0) { + strcpy(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_reprint = "); + } + else if (strncmp(token, ":N1:", 4) == 0) { + strcpy(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_notes = "); + } + else { + strcpy(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_avail = "); + } + } + else if (*operator == '~') { if (strncmp(token, ":RP:", 4) == 0) { sprintf(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_reprint %s ", my_dbi_conn_get_cap(conn, "rlike")); @@ -3226,4 +3291,15 @@ } } + else if (*operator == '!' && *(operator+1) == '=') { + if (strncmp(token, ":RP:", 4) == 0) { + strcpy(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_reprint != "); + } + else if (strncmp(token, ":N1:", 4) == 0) { + strcpy(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_notes != "); + } + else { + strcpy(sql_command, "SELECT t_xuser.refdb_id FROM t_refdb, t_xuser WHERE t_refdb.refdb_id=t_xuser.refdb_id AND t_xuser.xuser_avail != "); + } + } else { if (strncmp(token, ":RP:", 4) == 0) { @@ -3619,23 +3695,23 @@ some intelligent translation into a regexp-based query */ if (n_isalpha) { - if (strncmp(operator, "=", 1) == 0) { + if (*operator == '=') { + strcpy(bitsandpieces, " = "); + } + else if (*operator == '~') { sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "rlike")); - if ((new_sql_command1 = mstrcat(sql_command1, bitsandpieces, &sql_command1_len, 0)) == NULL) { - error = 1; - break; - } - else { - sql_command1 = new_sql_command1; - } + } + else if (*operator == '!' && *(operator+1) == '=') { + sprintf(bitsandpieces, " != "); } else { /* treat all other operators as non-equal */ sprintf(bitsandpieces, " %s ", my_dbi_conn_get_cap(conn, "not_rlike")); - if ((new_sql_command1 = mstrcat(sql_command1, bitsandpieces, &sql_command1_len, 0)) == NULL) { - error = 1; - break; - } - else { - sql_command1 = new_sql_command1; - } + } + + if ((new_sql_command1 = mstrcat(sql_command1, bitsandpieces, &sql_command1_len, 0)) == NULL) { + error = 1; + break; + } + else { + sql_command1 = new_sql_command1; } } Index: tokenize.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/tokenize.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -U2 -r1.11 -r1.12 --- tokenize.c 6 Jan 2004 23:06:36 -0000 1.11 +++ tokenize.c 1 Feb 2004 00:36:20 -0000 1.12 @@ -420,5 +420,6 @@ if (inbuffer[i+fieldname_len+2] == '!') { - if (inbuffer[i+fieldname_len+3] == '=') { + if (inbuffer[i+fieldname_len+3] == '=' + || inbuffer[i+fieldname_len+3] == '~') { have_token = 1; this_token = &inbuffer[i]; @@ -426,5 +427,6 @@ } } - else if (inbuffer[i+fieldname_len+2] == '=') { + else if (inbuffer[i+fieldname_len+2] == '=' + || inbuffer[i+fieldname_len+2] == '~') { have_token = 1; this_token = &inbuffer[i]; @@ -434,5 +436,7 @@ have_token = 1; this_token = &inbuffer[i]; - if (inbuffer[i+fieldname_len+3] == '>' || inbuffer[i+fieldname_len+3] == '=') { + if (inbuffer[i+fieldname_len+3] == '>' + || inbuffer[i+fieldname_len+3] == '=' + || inbuffer[i+fieldname_len+3] == '~') { ptr_sqltoken->length = fieldname_len+4; } @@ -444,5 +448,6 @@ have_token = 1; this_token = &inbuffer[i]; - if (inbuffer[i+fieldname_len+3] == '=') { + if (inbuffer[i+fieldname_len+3] == '=' + || inbuffer[i+fieldname_len+3] == '~') { ptr_sqltoken->length = fieldname_len+4; } |
From: Markus H. <mho...@us...> - 2004-01-31 20:09:30
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21811 Modified Files: refdbc.c Log Message: com_getref(): add single quotes for quoted items after string parsing Index: refdbc.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbc.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -U2 -r1.64 -r1.65 --- refdbc.c 29 Jan 2004 01:42:15 -0000 1.64 +++ refdbc.c 31 Jan 2004 20:07:42 -0000 1.65 @@ -2145,8 +2145,13 @@ else { if (optind < inargc) { + int open_quote = 0; strcat(slvals.outbuffer, "\""); /* printf("%d\n", optind); */ for (i = optind; i < inargc; i++) { strcat(slvals.outbuffer, inargv[i]); + if (open_quote) { + strcat(slvals.outbuffer, "\'"); + open_quote--; + } /* the tokenizer returns a quoted item as a separate token even if there is no space between e.g. a '=' and the @@ -2156,6 +2161,12 @@ strcat(slvals.outbuffer, " "); } + else { + /* insert a quote after the '='. This will put back the + quote only for items that actually were quoted */ + strcat(slvals.outbuffer, "\'"); + open_quote++; + } } - strcpy(&slvals.outbuffer[strlen(slvals.outbuffer)-1], "\""); /* remove trailing space */ + strcpy(&slvals.outbuffer[strlen(slvals.outbuffer)-1], "\""); /* remove trailing space */ } } |
From: Markus H. <mho...@us...> - 2004-01-31 20:08:10
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20462 Modified Files: refdbdnote.c refdbdref.c Log Message: output database encoding if no conversion required Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -U2 -r1.20 -r1.21 --- refdbdnote.c 31 Jan 2004 14:50:22 -0000 1.20 +++ refdbdnote.c 31 Jan 2004 20:06:22 -0000 1.21 @@ -718,5 +718,11 @@ LOG_PRINT(LOG_DEBUG, "output encoding is:"); - LOG_PRINT(LOG_DEBUG, ptr_biblio_info->encoding); + if (*(ptr_biblio_info->encoding)) { + LOG_PRINT(LOG_DEBUG, ptr_biblio_info->encoding); + } + else { + LOG_PRINT(LOG_DEBUG, db_encoding); + } + Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -U2 -r1.58 -r1.59 --- refdbdref.c 31 Jan 2004 14:50:22 -0000 1.58 +++ refdbdref.c 31 Jan 2004 20:06:23 -0000 1.59 @@ -2240,5 +2240,10 @@ LOG_PRINT(LOG_DEBUG, "output encoding is:"); - LOG_PRINT(LOG_DEBUG, ptr_biblio_info->encoding); + if (*(ptr_biblio_info->encoding)) { + LOG_PRINT(LOG_DEBUG, ptr_biblio_info->encoding); + } + else { + LOG_PRINT(LOG_DEBUG, db_encoding); + } |
From: Markus H. <mho...@us...> - 2004-01-31 14:58:35
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32114 Modified Files: refdb-client.h Log Message: removed leftover extern Index: refdb-client.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdb-client.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -U2 -r1.13 -r1.14 --- refdb-client.h 11 May 2003 21:53:44 -0000 1.13 +++ refdb-client.h 31 Jan 2004 14:56:53 -0000 1.14 @@ -21,6 +21,4 @@ -extern char *xmalloc (); - struct simplelistvals { int n_sockfd; /* file descriptor of the socket */ |
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25264 Modified Files: refdb-client.c refdb.h refdba.c refdbd.c refdbda.c refdbdbib.c refdbdnote.c refdbdref.c refdbib.c Log Message: added support for multi-NULL terminator Index: refdb-client.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdb-client.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -U2 -r1.26 -r1.27 --- refdb-client.c 29 Jan 2004 01:42:12 -0000 1.26 +++ refdb-client.c 31 Jan 2004 14:50:22 -0000 1.27 @@ -53,4 +53,5 @@ extern char username[]; extern char passwd[]; +extern const char cs_term[]; /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -336,4 +337,6 @@ FILE *pagerfp; /* ptr to file */ FILE* errstream; + int n_curr_trailing_z = 0; + int n_last_trailing_z = 0; slvals->inbuffer[0] = '\0'; /* terminate just in case we fail and the @@ -376,10 +379,26 @@ return 1; } + + n_curr_trailing_z = get_trailz(slvals->inbuffer, numbyte); - if (slvals->inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + if (numbyte >= TERM_LEN) { + if (n_curr_trailing_z >= TERM_LEN) { + /* terminator is complete */ + n_read_done++; + /* send back confirmation to the server */ + tiwrite(slvals->n_sockfd, "POS", TERM_YES); + } + } + else if (n_curr_trailing_z == numbyte + && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { + /* terminator is complete including the previous cycle */ n_read_done++; /* send back confirmation to the server */ tiwrite(slvals->n_sockfd, "POS", TERM_YES); - + } + else if (n_curr_trailing_z == numbyte) { + /* terminator is still incomplete */ + n_last_trailing_z += n_curr_trailing_z; + continue; } @@ -387,5 +406,8 @@ want to write the terminating \0 */ if (!n_broken_pipe) { - byte_written += fwrite(slvals->inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, pagerfp); + if (n_last_trailing_z) { + byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, pagerfp); + } + byte_written += fwrite(slvals->inbuffer, sizeof(char), numbyte-n_curr_trailing_z, pagerfp); } /* printf("%s<<\n", slvals->inbuffer); */ @@ -400,4 +422,8 @@ tiwrite(slvals->n_sockfd, "POS", TERM_YES); } + + if (!n_read_done) { + n_last_trailing_z = n_curr_trailing_z; + } } while (!n_read_done); @@ -512,4 +538,5 @@ int n_read_done = 0; int n_chunk_count = 0; + int num_trailz; size_t n_result; size_t n_chunksize; @@ -624,5 +651,7 @@ } - if (inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + /* we rely on the fact that the server reply is no more than + OUTBUF_LEN in length */ + if ((num_trailz = get_trailz(inbuffer, numbyte)) >= TERM_LEN) { /* if transmission ends */ n_read_done++; } @@ -630,5 +659,5 @@ we do not want to write the terminating \0 */ if (!n_broken_pipe && strcmp(inbuffer, "POS")) { - byte_written += fwrite(inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, pagerfp); + byte_written += fwrite(inbuffer, sizeof(char), numbyte-num_trailz, pagerfp); } /* printf("%s", inbuffer); */ @@ -681,4 +710,5 @@ int n_ris_file_done = 0; int numbyte; + int num_trailz; size_t byte_written = 0; char thebytes[11] = ""; @@ -763,5 +793,7 @@ } - if (inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + /* we rely on the fact that the server reply is no more than + OUTBUF_LEN in length */ + if ((num_trailz = get_trailz(inbuffer, numbyte)) >= TERM_LEN) { /* if transmission ends */ n_read_done++; } @@ -770,5 +802,5 @@ if (!n_broken_pipe) { if (!n_cgi) { - byte_written += fwrite(inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, pagerfp); + byte_written += fwrite(inbuffer, sizeof(char), numbyte-num_trailz, pagerfp); } } Index: refdb.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdb.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -U2 -r1.13 -r1.14 --- refdb.h 29 Jan 2004 01:35:59 -0000 1.13 +++ refdb.h 31 Jan 2004 14:50:22 -0000 1.14 @@ -20,5 +20,5 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -#define REFDB_PROTOCOL_VERSION 1 /* version of the client-server dialog protocol */ +#define REFDB_PROTOCOL_VERSION 2 /* version of the client-server dialog protocol */ #define COMMAND_INBUF_LEN 4096 /* length of buffer for client -> server */ #define OUTBUF_LEN 4096 /* length of buffer for server -> client */ @@ -54,5 +54,5 @@ /* the length of the poly-\0 sequence used to terminate a client/server message */ -#define TERM_LEN 1 +#define TERM_LEN 4 /* whether or not to terminate a client/server message */ Index: refdba.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdba.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -U2 -r1.42 -r1.43 --- refdba.c 29 Jan 2004 01:42:13 -0000 1.42 +++ refdba.c 31 Jan 2004 14:50:22 -0000 1.43 @@ -149,4 +149,6 @@ FILE* fp_log_file = NULL; /* ptr to log file struct */ +extern const char cs_term[]; + /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The one and only main function @@ -773,4 +775,6 @@ int n_have_user_host = 0; int n_remove = 0; + int n_curr_trailing_z = 0; + int n_last_trailing_z = 0; size_t byte_written = 0; FILE *pagerfp; @@ -1094,5 +1098,5 @@ do { - numbyte = read(n_sockfd, inbuffer, OUTBUF_LEN); + numbyte = tread(n_sockfd, inbuffer, OUTBUF_LEN); if (numbyte == -1) { fprintf(stderr, "could not read from refdbd. Stop\n"); @@ -1104,14 +1108,35 @@ } - if (inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + n_curr_trailing_z = get_trailz(inbuffer, numbyte); + + if (numbyte >= TERM_LEN) { + if (n_curr_trailing_z >= TERM_LEN) { + n_read_done++; + /* send back confirmation to the server */ + tiwrite(n_sockfd, "POS", TERM_YES); + } + } + else if (n_curr_trailing_z == numbyte + && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { n_read_done++; /* send back confirmation to the server */ tiwrite(n_sockfd, "POS", TERM_YES); } + else if (n_curr_trailing_z == numbyte) { + /* terminator is still incomplete */ + n_last_trailing_z += n_curr_trailing_z; + continue; + } /* write numbyte chars to output, unless this is the last chunk: we do not want to write the terminating \0 */ if (!n_broken_pipe) { - byte_written += fwrite(inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, pagerfp); + if (n_last_trailing_z) { + byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, pagerfp); + } + byte_written += fwrite(inbuffer, sizeof(char), numbyte-n_curr_trailing_z, pagerfp); + } + if (!n_read_done) { + n_last_trailing_z = n_curr_trailing_z; } /* printf("%s", inbuffer); */ @@ -1188,4 +1213,6 @@ int n_have_user_host = 0; int n_remove = 0; + int n_curr_trailing_z = 0; + int n_last_trailing_z = 0; size_t byte_written = 0; FILE *pagerfp; @@ -1458,5 +1485,5 @@ do { - numbyte = read(n_sockfd, inbuffer, OUTBUF_LEN); + numbyte = tread(n_sockfd, inbuffer, OUTBUF_LEN); if (numbyte == -1) { fprintf(stderr, "could not read from refdbd. Stop\n"); @@ -1468,14 +1495,32 @@ } - if (inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + n_curr_trailing_z = get_trailz(inbuffer, numbyte); + + if (numbyte >= TERM_LEN) { + if (n_curr_trailing_z >= TERM_LEN) { + n_read_done++; + /* send back confirmation to the server */ + tiwrite(n_sockfd, "POS", TERM_YES); + } + } + else if (n_curr_trailing_z == numbyte + && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { n_read_done++; /* send back confirmation to the server */ tiwrite(n_sockfd, "POS", TERM_YES); } + else if (n_curr_trailing_z == numbyte) { + /* terminator is still incomplete */ + n_last_trailing_z += n_curr_trailing_z; + continue; + } /* write numbyte chars to output, unless this is the last chunk: we do not want to write the terminating \0 */ if (!n_broken_pipe) { - byte_written += fwrite(inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, pagerfp); + if (n_last_trailing_z) { + byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, pagerfp); + } + byte_written += fwrite(inbuffer, sizeof(char), numbyte-n_curr_trailing_z, pagerfp); } /* printf("%s", inbuffer); */ Index: refdbd.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbd.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -U2 -r1.71 -r1.72 --- refdbd.c 29 Jan 2004 01:42:27 -0000 1.71 +++ refdbd.c 31 Jan 2004 14:50:22 -0000 1.72 @@ -859,6 +859,7 @@ numbyte = tread(ptr_child_clrequest->fd, child_inbuffer, COMMAND_INBUF_LEN-1); - if (child_inbuffer[numbyte-1] != '\0' || strlen(child_inbuffer) > PROTOCOL_LENGTH) { /* if transmission incomplete or protocol version string too long */ - LOG_PRINT(LOG_CRIT, "invalid client request"); + if (get_trailz(child_inbuffer, numbyte) < TERM_LEN || strlen(child_inbuffer) > PROTOCOL_LENGTH) { /* if transmission incomplete or protocol version string too long */ + LOG_PRINT(LOG_CRIT, "invalid client request:"); + LOG_PRINT(LOG_CRIT, child_inbuffer); tiwrite(ptr_child_clrequest->fd, "invalid client request", TERM_YES); retval = 1; @@ -885,5 +886,5 @@ LOG_PRINT(LOG_DEBUG, "send pseudo-random string to client"); numbyte = tread(ptr_child_clrequest->fd, child_inbuffer, COMMAND_INBUF_LEN-1); - if (child_inbuffer[numbyte-1] != '\0') { /* if transmission incomplete */ + if (get_trailz(child_inbuffer, numbyte) < TERM_LEN) { /* if transmission incomplete */ LOG_PRINT(LOG_CRIT, "incomplete client command"); tiwrite(ptr_child_clrequest->fd, "incomplete client command", TERM_YES); Index: refdbda.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbda.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -U2 -r1.39 -r1.40 --- refdbda.c 29 Jan 2004 01:42:29 -0000 1.39 +++ refdbda.c 31 Jan 2004 14:50:22 -0000 1.40 @@ -1157,5 +1157,5 @@ while (!nread_done) { numbyte = tread(ptr_clrequest->fd, inbuffer, COMMAND_INBUF_LEN-1); - if (inbuffer[numbyte-1] == '\0') { /* if transmission complete */ + if (get_trailz(inbuffer, numbyte) == TERM_LEN) { /* if transmission complete */ nread_done = 1; } @@ -1536,5 +1536,5 @@ while (!nread_done) { numbyte = tread(ptr_clrequest->fd, inbuffer, COMMAND_INBUF_LEN-1); - if (inbuffer[numbyte-1] == '\0') { /* if transmission complete */ + if (get_trailz(inbuffer, numbyte) < TERM_LEN) { /* if transmission complete */ nread_done = 1; } Index: refdbdbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdbib.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -U2 -r1.33 -r1.34 --- refdbdbib.c 29 Jan 2004 01:42:33 -0000 1.33 +++ refdbdbib.c 31 Jan 2004 14:50:22 -0000 1.34 @@ -133,4 +133,5 @@ unsigned long long n_id; size_t msg_len = 0; + size_t result_len; char table_buffer[256]; char entry_id[128]; @@ -913,4 +914,5 @@ size_t inlength; size_t outlength; + 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 */ @@ -918,7 +920,8 @@ inlength = strlen(outbuffer) + 1; /* with the encodings supported by our database engines, the converted - string can't be longer than three times the input string */ + string can't be longer than four times the input string */ /* todo: is this assumption correct? */ - outlength = 3*inlength; + outlength = 4*inlength; + orig_outlength = outlength; if ((my_outbuffer = (char*)malloc(outlength)) == NULL) { @@ -960,9 +963,13 @@ } outbuffer = my_outbuffer_start; - outbuffer_len = outlength; + outbuffer_len = orig_outlength; + result_len = (size_t)(my_outbuffer - my_outbuffer_start); } /* else: no conversion required */ + else { + result_len = strlen(outbuffer); + } - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + iwrite(ptr_clrequest->fd, outbuffer, result_len); outbuffer[0] = '\0'; delete_lilimem(&sentinel, "id_string"); Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -U2 -r1.19 -r1.20 --- refdbdnote.c 29 Jan 2004 01:42:43 -0000 1.19 +++ refdbdnote.c 31 Jan 2004 14:50:22 -0000 1.20 @@ -2003,7 +2003,7 @@ inlength = strlen(sql_command) + 1; /* with the encodings supported by our database engines, the converted - string can't be longer than three times the input string */ + string can't be longer than four times the input string */ /* todo: is this assumption correct? */ - outlength = 3*inlength; + outlength = 4*inlength; if ((my_sql_command = (char*)malloc(outlength)) == NULL) { Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -U2 -r1.57 -r1.58 --- refdbdref.c 29 Jan 2004 01:42:45 -0000 1.57 +++ refdbdref.c 31 Jan 2004 14:50:22 -0000 1.58 @@ -628,6 +628,6 @@ inlength = strlen(ris_set) + 1; /* with the encodings supported by our database engines, the converted - string can't be longer than three times the input string */ - outlength = 3*inlength; + string can't be longer than four times the input string */ + outlength = 4*inlength; if ((my_ris_set = (char*)malloc(outlength)) == NULL) { @@ -2093,4 +2093,5 @@ size_t sql_command1_len; size_t stringbuf_len; + size_t result_len; char *sql_command; /* these are ptrs to the buffers and temporary ptrs */ char *new_sql_command; @@ -4004,9 +4005,9 @@ inlength = strlen(sql_command) + 1; /* with the encodings supported by our database engines, the converted - string can't be longer than three times the input string */ + string can't be longer than four times the input string */ /* todo: is this assumption correct? */ - outlength = 3*inlength; + outlength = 4*inlength; - if ((my_sql_command = (char*)malloc(outlength)) == NULL) { + if ((my_sql_command = (char*)calloc(outlength, sizeof(char))) == NULL) { iwrite(ptr_clrequest->fd, outomem_n.text, outomem_n.length); dbi_result_free(rendinfo.dbires); @@ -4056,11 +4057,18 @@ sql_command = my_sql_command_start; sql_command_len = outlength; + result_len = (size_t)(my_sql_command - my_sql_command_start); + } + else { /* no conversion required */ + result_len = strlen(sql_command); } - /* else: no conversion required */ - tiwrite(ptr_clrequest->fd, sql_command, TERM_NO); + iwrite(ptr_clrequest->fd, sql_command, result_len); /* TERM_NO */ sql_command[0] = '\0'; } + if (conv_descriptor) { + iconv_close(conv_descriptor); + } + if (nref_counter) { /* create a "footer" if necessary */ @@ -4073,7 +4081,4 @@ dbi_conn_close(conn); delete_all_lilimem(&sentinel); - if (conv_descriptor) { - iconv_close(conv_descriptor); - } return 0; } @@ -4088,8 +4093,4 @@ delete_all_lilimem(&sentinel); - if (conv_descriptor) { - iconv_close(conv_descriptor); - } - return nref_counter; } Index: refdbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbib.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -U2 -r1.39 -r1.40 --- refdbib.c 29 Jan 2004 01:42:48 -0000 1.39 +++ refdbib.c 31 Jan 2004 14:50:22 -0000 1.40 @@ -121,4 +121,6 @@ struct BSTRING writerr_n = {"could not write to refdbd\n", 26}; +extern const char cs_term[]; + /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The one and only main function @@ -555,4 +557,6 @@ int n_chunk_count = 0; int n_retval = 0; + int n_curr_trailing_z = 0; + int n_last_trailing_z = 0; size_t byte_written = 0; FILE *pagerfp; @@ -714,11 +718,33 @@ } - if (inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + n_curr_trailing_z = get_trailz(inbuffer, numbyte); + + if (numbyte >= TERM_LEN) { + if (n_curr_trailing_z >= TERM_LEN) { + n_read_done++; + } + } + else if (n_curr_trailing_z == numbyte + && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { n_read_done++; } - /* write numbyte chars to output, unless this is the last chunk: - we do not want to write the terminating \0 */ - byte_written += fwrite(inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, specfilefp); + else if (n_curr_trailing_z == numbyte) { + /* terminator is still incomplete */ + n_last_trailing_z += n_curr_trailing_z; + continue; + } + if (!n_broken_pipe) { + /* write numbyte chars to output, unless this is the last chunk: + we do not want to write the terminating \0 */ + if (n_last_trailing_z) { + byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, pagerfp); + } + byte_written += fwrite(inbuffer, sizeof(char), numbyte-n_curr_trailing_z, specfilefp); + } + + if (!n_read_done) { + n_last_trailing_z = n_curr_trailing_z; + } /* printf("%s<< byte_written:%d\n", inbuffer, byte_written); */ } while (!n_read_done); @@ -812,4 +838,6 @@ n_read_done = 0; + n_last_trailing_z = 0; + n_curr_trailing_z = 0; do { @@ -826,12 +854,34 @@ } - if (inbuffer[numbyte-1] == '\0') { /* if transmission ends */ + n_curr_trailing_z = get_trailz(inbuffer, numbyte); + + if (numbyte >= TERM_LEN) { + if (n_curr_trailing_z >= TERM_LEN) { + n_read_done++; + } + } + else if (n_curr_trailing_z == numbyte + && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { n_read_done++; } + else if (n_curr_trailing_z == numbyte) { + /* terminator is still incomplete */ + n_last_trailing_z += n_curr_trailing_z; + continue; + } + /* write numbyte chars to output, unless this is the last chunk: we do not want to write the terminating \0 */ if (!n_broken_pipe) { - byte_written += fwrite(inbuffer, sizeof(char), (n_read_done) ? numbyte-1 : numbyte, pagerfp); + if (n_last_trailing_z) { + byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, pagerfp); + } + byte_written += fwrite(inbuffer, sizeof(char), numbyte-n_curr_trailing_z, pagerfp); + } + + if (!n_read_done) { + n_last_trailing_z = n_curr_trailing_z; } + } while (!n_read_done); |
From: Markus H. <mho...@us...> - 2004-01-31 14:48:32
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23132 Modified Files: readln.c Log Message: removed leftover extern Index: readln.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/readln.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -U2 -r1.4 -r1.5 --- readln.c 14 Jan 2004 23:21:34 -0000 1.4 +++ readln.c 31 Jan 2004 14:46:49 -0000 1.5 @@ -27,5 +27,4 @@ #include "strfncs.h" -extern char *xmalloc(); extern COMMAND commands[]; |
From: Markus H. <mho...@us...> - 2004-01-31 14:45:58
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20819 Modified Files: connect.h Log Message: new function get_trailz() Index: connect.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/connect.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -U2 -r1.3 -r1.4 --- connect.h 29 Jan 2004 01:33:33 -0000 1.3 +++ connect.h 31 Jan 2004 14:44:15 -0000 1.4 @@ -27,4 +27,5 @@ int iwrite (int fd, const char *buf, int len); int tiwrite (int fd, const char *buf, int n_term); +int get_trailz(const char* buf, int numbyte); #endif /* CONNECT_H */ |
From: Markus H. <mho...@us...> - 2004-01-31 14:45:34
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20406 Modified Files: connect.c Log Message: added support for multi-NULL terminators; new function get_trailz() Index: connect.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/connect.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -U2 -r1.5 -r1.6 --- connect.c 29 Jan 2004 01:33:32 -0000 1.5 +++ connect.c 31 Jan 2004 14:43:51 -0000 1.6 @@ -128,7 +128,8 @@ tread(): Read at most LEN bytes from FD, storing them to BUF. This is virtually the same as iread(), but it checks after each success- - ful read() whether a string is complete (i.e. whether a '\0' was - received). In this case, the function returns immediately, instead - of timing out, even if less byte than requested were received. + ful read() whether a string is complete (i.e. whether the + terminating sequence was received). In this case, the function + returns immediately, instead of timing out, even if less byte than + requested were received. int tread the number of bytes read from fd, or -1 if timeout @@ -142,4 +143,7 @@ int res; int n_byte_read = 0; + char* buf_start; + + buf_start = buf; while (len > 0) { /* read until we have all, a complete string, or timeout */ @@ -163,5 +167,9 @@ res = read(fd, buf, len); /* read some data */ if (res > 0) { /* see whether we've got a complete string */ - if (buf[res-1] == '\0') { /* complete string received */ + if (n_byte_read+res>= TERM_LEN + && !memcmp((const void*)(buf_start+n_byte_read+res-TERM_LEN), + (const void*)cs_term, + TERM_LEN)) { +/* if (buf[res-1] == '\0') { */ /* complete string received */ n_byte_read += res; return n_byte_read; /* get back w/o timeout */ @@ -279,2 +287,28 @@ return n_byte_written_total; } + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + get_trailz(): counts the trailing \0 in a buffer + + int get_trailz the number of trailing \0, or -1 if buf is NULL + + char *buf a pointer to a buffer + + int numbyte offset at which the function should check the buffer + (going from offset towards the start of the buffer) + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +int get_trailz(const char* buf, int numbyte) { + int numz = 0; + int i = numbyte-1; + + if (!buf) { + return -1; + } + + while (!buf[i] && i>=0) { + numz++; + i--; + } + return numz; +} |
From: Markus H. <mho...@us...> - 2004-01-29 15:47:16
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18147 Modified Files: connect.c connect.h Log Message: new function tiwrite() Index: connect.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/connect.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -U2 -r1.4 -r1.5 --- connect.c 13 Dec 2002 20:34:34 -0000 1.4 +++ connect.c 29 Jan 2004 01:33:32 -0000 1.5 @@ -34,8 +34,11 @@ #include "connect.h" +#include "refdb.h" extern int n_refdb_timeout; /* timeout in seconds for read/write on sockets */ extern int n_abort_connect; /* if 1, user tries to abort current connection */ +const char cs_term[5] = {'\0', '\0', '\0', '\0', '\0'}; /* client-server message terminator */ + /* forward declarations of local functions */ static int select_fd (int fd, int maxtime, int writep); @@ -228,2 +231,50 @@ return n_byte_written; } + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + tiwrite(): Write bytes from BUF to FD and terminate if requested. + This is similar to iwrite(). However, it determines the + number of bytes to write from the passed string and adds + the message terminator automatically if requested. + + int tiwrite the number of bytes actually written to fd, or -1 if + timeout + + char *buf a pointer to a character buffer which holds the data + + int n_term if 1, send a terminator sequence after sending the buffer + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +int tiwrite (int fd, const char *buf, int n_term) { + size_t buf_len; + int n_byte_written; + int n_byte_written_total = 0; + + buf_len = strlen(buf); + + if (buf_len) { + /* send buffer proper */ + n_byte_written = iwrite(fd, buf, buf_len); + + if (n_byte_written == -1) { + return -1; + } + else { + n_byte_written_total = n_byte_written; + } + } + + if (n_term) { + /* send terminator */ + n_byte_written = iwrite(fd, cs_term, TERM_LEN); + + if (n_byte_written == -1) { + return -1; + } + else { + n_byte_written_total += n_byte_written; + } + } + + return n_byte_written_total; +} Index: connect.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/connect.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -U2 -r1.2 -r1.3 --- connect.h 1 Mar 2002 07:29:41 -0000 1.2 +++ connect.h 29 Jan 2004 01:33:33 -0000 1.3 @@ -26,4 +26,5 @@ int tread (int fd, char *buf, int len); int iwrite (int fd, const char *buf, int len); +int tiwrite (int fd, const char *buf, int n_term); #endif /* CONNECT_H */ |
From: Markus H. <mho...@us...> - 2004-01-29 11:58:26
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25121 Modified Files: refdbc.c Log Message: fixed help messages Index: refdbc.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbc.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -U2 -r1.62 -r1.63 --- refdbc.c 17 Jan 2004 22:56:16 -0000 1.62 +++ refdbc.c 25 Jan 2004 13:25:52 -0000 1.63 @@ -381,5 +381,5 @@ break; case 'h': - fprintf(stderr, "Usage: refdbc [-c pager] [-C command] [-d db] [-e logdest] [-E encoding] [-F fields] [-G url] [-h] [-i address] [-l loglevel] [-L logfile] [-p port] [-q] [-R pdfroot] [-T time] [-u name] [-v] [-V] [-w password] [-y confdir]\nOptions: -c command line of pager\n -C run command in batch mode\n -d use database db\n -e log destination (0=stderr;1=syslog;2=custom file)\n -E set encoding for output\n -F additional fields in reference output\n -G URL of a css stylesheet for HTML output\n -h prints this help\n -i set server IP address\n -l set log level (0<=level<=7)\n -L full path of custom log file\n -p set server port\n -q ignore init-file\n -R set pdf root directory\n -T set timeout in seconds\n -u use this username\n -v show version information\n -V switch to verbose mode\n -w set password (use '*' to be asked interactively)\n -y look for configuration files in confdir\n"); + fprintf(stderr, "Usage: refdbc [-c pager] [-C command] [-d db] [-e logdest] [-F fields] [-G url] [-h] [-i address] [-l loglevel] [-L logfile] [-p port] [-q] [-R pdfroot] [-T time] [-u name] [-v] [-V] [-w password] [-y confdir]\nOptions: -c command line of pager\n -C run command in batch mode\n -d use database db\n -e log destination (0=stderr;1=syslog;2=custom file)\n -F additional fields in reference output\n -G URL of a css stylesheet for HTML output\n -h prints this help\n -i set server IP address\n -l set log level (0<=level<=7)\n -L full path of custom log file\n -p set server port\n -q ignore init-file\n -R set pdf root directory\n -T set timeout in seconds\n -u use this username\n -v show version information\n -V switch to verbose mode\n -w set password (use '*' to be asked interactively)\n -y look for configuration files in confdir\n"); exit (0); break; @@ -462,5 +462,5 @@ break; case ':': - fprintf(stderr, "Usage: refdbc [-c pager] [-C command] [-d db] [-e logdest] [-E encoding] [-F fields] [-G url] [-h] [-i address] [-l loglevel] [-L logfile] [-p port] [-q] [-R pdfroot] [-T time] [-u name] [-v] [-V] [-w password] [-y confdir]\nOptions: -c command line of pager\n -C run command in batch mode\n -d use database db\n -e log destination (0=stderr;1=syslog;2=custom file)\n -E set encoding for output\n -F additional fields in reference output\n -G URL of a css stylesheet for HTML output\n -h prints this help\n -i set server IP address\n -l set log level (0<=level<=7)\n -L full path of custom log file\n -p set server port\n -q ignore init-file\n -R set pdf root directory\n -T set timeout in seconds\n -u use this username\n -v show version information\n -V switch to verbose mode\n -w set password (use '*' to be asked interactively)\n -y look for configuration files in confdir\n"); + fprintf(stderr, "Usage: refdbc [-c pager] [-C command] [-d db] [-e logdest] [-F fields] [-G url] [-h] [-i address] [-l loglevel] [-L logfile] [-p port] [-q] [-R pdfroot] [-T time] [-u name] [-v] [-V] [-w password] [-y confdir]\nOptions: -c command line of pager\n -C run command in batch mode\n -d use database db\n -e log destination (0=stderr;1=syslog;2=custom file)\n -F additional fields in reference output\n -G URL of a css stylesheet for HTML output\n -h prints this help\n -i set server IP address\n -l set log level (0<=level<=7)\n -L full path of custom log file\n -p set server port\n -q ignore init-file\n -R set pdf root directory\n -T set timeout in seconds\n -u use this username\n -v show version information\n -V switch to verbose mode\n -w set password (use '*' to be asked interactively)\n -y look for configuration files in confdir\n"); exit (1); break; @@ -2012,5 +2012,5 @@ break; case 'h': - printf("Displays the result of a database search.\nSyntax: getref [-c command] [-d database] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|!=|>}{unix-regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, db31, db31x, teix, ris, risx, or bibtex\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of a database search.\nSyntax: getref [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|!=|>}{unix-regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding set the output character encoding\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, db31, db31x, teix, ris, risx, or bibtex\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); delete_all_lilimem(&sentinel); return 0; @@ -2886,5 +2886,5 @@ case 'h': delete_all_lilimem(&sentinel); - fprintf(errstream, "Replaces the specified references in the database\nSyntax: updateref [-c command] [-d database] [-h] [-o outfile] [-O outfile] [-P] [-t type] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P update only personal information (AV, N1, RP)\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); + fprintf(errstream, "Replaces the specified references in the database\nSyntax: updateref [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile] [-P] [-t type] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P update only personal information (AV, N1, RP)\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); return 0; break; @@ -2980,5 +2980,5 @@ case 'h': delete_all_lilimem(&sentinel); - fprintf(errstream, "Adds the specified references to the database\nSyntax: addref [-c command] [-d database] [-g deffile] [-h] [-k] [-o outfile] [-O outfile] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -k keep reference ID\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); + fprintf(errstream, "Adds the specified references to the database\nSyntax: addref [-c command] [-d database] [-E encoding] [-g deffile] [-h] [-k] [-o outfile] [-O outfile] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -k keep reference ID\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); return 0; break; @@ -3562,5 +3562,5 @@ case 'h': delete_all_lilimem(&sentinel); - fprintf(errstream, "Replaces the specified notes in the database\nSyntax: updatenote [-c command] [-d database] [-h] [-o outfile] [-O outfile] [-P] [-t type] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the notes from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); + fprintf(errstream, "Replaces the specified notes in the database\nSyntax: updatenote [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile] [-P] [-t type] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -f infile Read the names of the files with the notes from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); return 0; break; @@ -3654,5 +3654,5 @@ case 'h': delete_all_lilimem(&sentinel); - fprintf(errstream, "Adds the specified notes to the database\nSyntax: addnote [-c command] [-d database] [-g deffile] [-h] [-k] [-o outfile] [-O outfile] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the notes from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -k keep note ID\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); + fprintf(errstream, "Adds the specified notes to the database\nSyntax: addnote [-c command] [-d database] [-E encoding] [-g deffile] [-h] [-k] [-o outfile] [-O outfile] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -f infile Read the names of the files with the notes from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -k keep note ID\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n"); return 0; break; @@ -4459,5 +4459,5 @@ break; case 'h': - printf("Displays the result of a database search for notes.\nSyntax: getnote [-c command] [-d database] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|!=|>}{unix-regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, or xnote\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); + printf("Displays the result of a database search for notes.\nSyntax: getnote [-c command] [-d database] [-E encoding] [-h] [-o outfile] [-O outfile][-P] [-R pdfroot] [-s format] [-S tag] [-t output-format] {search-string|-f infile}\nSearch-string: {:XY:{<|=|!=|>}{unix-regexp}} [AND|OR|AND NOT] [...]\nwhere XY specifies the field to search in\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -E encoding specify the input character encoding\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P limit search to personal interest list\n -R use pdfroot as root for path of pdf files\n -s format specify fields for screen or style for DocBook output\n -S tag sort output by tag ID (default) or PY\n -t output-format display as format scrn, html, xhtml, or xnote\n -f infile use the saved search line in file infile\n All other arguments are interpreted as the search string.\n"); delete_all_lilimem(&sentinel); return 0; |
From: Markus H. <mho...@us...> - 2004-01-29 05:59:35
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18825 Modified Files: backend-bibtex.c dbfncs.c refdb-client.c refdba.c refdbc.c refdbd.c refdbda.c refdbdbib.c refdbdnote.c refdbdref.c refdbib.c risdb.c xmlout.c Log Message: use tiwrite() instead of iwrite() where appropriate Index: backend-bibtex.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-bibtex.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -U2 -r1.15 -r1.16 --- backend-bibtex.c 3 Jan 2004 20:11:43 -0000 1.15 +++ backend-bibtex.c 29 Jan 2004 01:42:06 -0000 1.16 @@ -828,5 +828,5 @@ /* send acknowledgement to client */ - numbyte = iwrite(ptr_clrequest->fd, positive.text, positive.length+1); + numbyte = tiwrite(ptr_clrequest->fd, positive.text, TERM_YES); if (numbyte == -1) { LOG_PRINT(LOG_INFO, "could not write to client"); @@ -938,5 +938,5 @@ rendinfo.dbires = dbi_conn_query(conn, sql_command); if (!rendinfo.dbires) { - iwrite(ptr_clrequest->fd, "select failed\n", 14); + tiwrite(ptr_clrequest->fd, "select failed\n", TERM_NO); dbi_conn_close(conn); delete_all_lilimem(&sentinel); @@ -999,5 +999,5 @@ dbi_conn_close(conn); - iwrite(ptr_clrequest->fd, "", 1); /* finish sending data */ + tiwrite(ptr_clrequest->fd, "", TERM_YES); /* finish sending data */ /* wait for receipt from client, reuse sql_command */ Index: dbfncs.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/dbfncs.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -U2 -r1.14 -r1.15 --- dbfncs.c 25 Jan 2004 13:21:29 -0000 1.14 +++ dbfncs.c 29 Jan 2004 01:42:11 -0000 1.15 @@ -137,5 +137,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_meta failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_meta failed\n", TERM_NO); return 1; } @@ -193,5 +193,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_refdb failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_refdb failed\n", TERM_NO); return 1; } @@ -212,5 +212,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_author failed\n", 23); + tiwrite(ptr_clrequest->fd, "create t_author failed\n", TERM_NO); return 1; } @@ -227,5 +227,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_keyword failed\n", 24); + tiwrite(ptr_clrequest->fd, "create t_keyword failed\n", TERM_NO); return 1; } @@ -248,5 +248,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_periodical failed\n", 27); + tiwrite(ptr_clrequest->fd, "create t_periodical failed\n", TERM_NO); return 1; } @@ -272,5 +272,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_note failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_note failed\n", TERM_NO); return 1; } @@ -288,5 +288,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_user failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_user failed\n", TERM_NO); return 1; } @@ -308,5 +308,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xauthor failed\n", 24); + tiwrite(ptr_clrequest->fd, "create t_xauthor failed\n", TERM_NO); return 1; } @@ -326,5 +326,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xkeyword failed\n", 25); + tiwrite(ptr_clrequest->fd, "create t_xkeyword failed\n", TERM_NO); return 1; } @@ -347,5 +347,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xuser failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_xuser failed\n", TERM_NO); return 1; } @@ -365,5 +365,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xnote failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_xnote failed\n", TERM_NO); return 1; } @@ -390,5 +390,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_meta failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_meta failed\n", TERM_NO); return 1; } @@ -442,5 +442,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_refdb failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_refdb failed\n", TERM_NO); return 1; } @@ -453,5 +453,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical failed\n", 27); + tiwrite(ptr_clrequest->fd, "create i_periodical failed\n", TERM_NO); return 1; } @@ -472,5 +472,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_author failed\n", 23); + tiwrite(ptr_clrequest->fd, "create t_author failed\n", TERM_NO); return 1; } @@ -483,5 +483,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_author_name failed\n", 28); + tiwrite(ptr_clrequest->fd, "create i_author_name failed\n", TERM_NO); return 1; } @@ -498,5 +498,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_keyword failed\n", 24); + tiwrite(ptr_clrequest->fd, "create t_keyword failed\n", TERM_NO); return 1; } @@ -509,5 +509,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_keyword_name failed\n", 29); + tiwrite(ptr_clrequest->fd, "create i_keyword_name failed\n", TERM_NO); return 1; } @@ -527,5 +527,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_periodical failed\n", 27); + tiwrite(ptr_clrequest->fd, "create t_periodical failed\n", TERM_NO); return 1; } @@ -538,5 +538,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_name failed\n", 32); + tiwrite(ptr_clrequest->fd, "create i_periodical_name failed\n", TERM_NO); return 1; } @@ -548,5 +548,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_abbrev failed\n", 34); + tiwrite(ptr_clrequest->fd, "create i_periodical_abbrev failed\n", TERM_NO); return 1; } @@ -558,5 +558,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_custabbrev1 failed\n", 39); + tiwrite(ptr_clrequest->fd, "create i_periodical_custabbrev1 failed\n", TERM_NO); return 1; } @@ -568,5 +568,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_custabbrev2 failed\n", 39); + tiwrite(ptr_clrequest->fd, "create i_periodical_custabbrev2 failed\n", TERM_NO); return 1; } @@ -589,5 +589,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_note failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_note failed\n", TERM_NO); return 1; } @@ -600,5 +600,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_note_title failed\n", 27); + tiwrite(ptr_clrequest->fd, "create i_note_title failed\n", TERM_NO); return 1; } @@ -610,5 +610,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_note_user_id failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_note_user_id failed\n", TERM_NO); return 1; } @@ -620,5 +620,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_note_date failed\n", 27); + tiwrite(ptr_clrequest->fd, "create i_note_date failed\n", TERM_NO); return 1; } @@ -636,5 +636,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_user failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_user failed\n", TERM_NO); return 1; } @@ -647,5 +647,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_user_name failed\n", 26); + tiwrite(ptr_clrequest->fd, "create i_user_name failed\n", TERM_NO); return 1; } @@ -666,5 +666,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xauthor failed\n", 24); + tiwrite(ptr_clrequest->fd, "create t_xauthor failed\n", TERM_NO); return 1; } @@ -677,5 +677,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xauthor_author_id failed\n", 34); + tiwrite(ptr_clrequest->fd, "create i_xauthor_author_id failed\n", TERM_NO); return 1; } @@ -687,5 +687,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xauthor_refdb_id failed\n", 33); + tiwrite(ptr_clrequest->fd, "create i_xauthor_refdb_id failed\n", TERM_NO); return 1; } @@ -704,5 +704,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xkeyword failed\n", 25); + tiwrite(ptr_clrequest->fd, "create t_xkeyword failed\n", TERM_NO); return 1; } @@ -715,5 +715,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xkeyword_keyword_id failed\n", 36); + tiwrite(ptr_clrequest->fd, "create i_xkeyword_keyword_id failed\n", TERM_NO); return 1; } @@ -725,5 +725,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xkeyword_xref_id failed\n", 33); + tiwrite(ptr_clrequest->fd, "create i_xkeyword_xref_id failed\n", TERM_NO); return 1; } @@ -745,5 +745,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xuser failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_xuser failed\n", TERM_NO); return 1; } @@ -756,5 +756,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xuser_user_id failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_xuser_user_id failed\n", TERM_NO); return 1; } @@ -766,5 +766,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xuser_refdb_id failed\n", 31); + tiwrite(ptr_clrequest->fd, "create i_xuser_refdb_id failed\n", TERM_NO); return 1; } @@ -783,5 +783,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xnote failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_xnote failed\n", TERM_NO); return 1; } @@ -794,5 +794,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xnote_note_id failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_xnote_note_id failed\n", TERM_NO); return 1; } @@ -804,5 +804,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xnote_xref_id failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_xnote_xref_id failed\n", TERM_NO); return 1; } @@ -814,5 +814,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xnote_xnote_type failed\n", 33); + tiwrite(ptr_clrequest->fd, "create i_xnote_xnote_type failed\n", TERM_NO); return 1; } @@ -833,5 +833,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "CREATE GROUP failed\n", 20); + tiwrite(ptr_clrequest->fd, "CREATE GROUP failed\n", TERM_NO); return 1; } @@ -844,5 +844,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "GRANT failed for new tables\n", 28); + tiwrite(ptr_clrequest->fd, "GRANT failed for new tables\n", TERM_NO); return 1; } @@ -868,5 +868,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_meta failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_meta failed\n", TERM_NO); return 1; } @@ -912,5 +912,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_refdb failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_refdb failed\n", TERM_NO); return 1; } @@ -923,5 +923,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_refdb_pubyear failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_refdb_pubyear failed\n", TERM_NO); return 1; } @@ -933,5 +933,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_refdb_citekey failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_refdb_citekey failed\n", TERM_NO); return 1; } @@ -950,5 +950,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_author failed\n", 23); + tiwrite(ptr_clrequest->fd, "create t_author failed\n", TERM_NO); return 1; } @@ -961,5 +961,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_author_name failed\n", 28); + tiwrite(ptr_clrequest->fd, "create i_author_name failed\n", TERM_NO); return 1; } @@ -974,5 +974,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_keyword failed\n", 24); + tiwrite(ptr_clrequest->fd, "create t_keyword failed\n", TERM_NO); return 1; } @@ -985,5 +985,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_keyword_name failed\n", 29); + tiwrite(ptr_clrequest->fd, "create i_keyword_name failed\n", TERM_NO); return 1; } @@ -1001,5 +1001,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_periodical failed\n", 27); + tiwrite(ptr_clrequest->fd, "create t_periodical failed\n", TERM_NO); return 1; } @@ -1012,5 +1012,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_name failed\n", 32); + tiwrite(ptr_clrequest->fd, "create i_periodical_name failed\n", TERM_NO); return 1; } @@ -1022,5 +1022,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_abbrev failed\n", 34); + tiwrite(ptr_clrequest->fd, "create i_periodical_abbrev failed\n", TERM_NO); return 1; } @@ -1032,5 +1032,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_custabbrev failed\n", 38); + tiwrite(ptr_clrequest->fd, "create i_periodical_custabbrev failed\n", TERM_NO); return 1; } @@ -1042,5 +1042,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_periodical_custabbrev failed\n", 38); + tiwrite(ptr_clrequest->fd, "create i_periodical_custabbrev failed\n", TERM_NO); return 1; } @@ -1061,5 +1061,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_note failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_note failed\n", TERM_NO); return 1; } @@ -1072,5 +1072,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_note_title failed\n", 27); + tiwrite(ptr_clrequest->fd, "create i_note_title failed\n", TERM_NO); return 1; } @@ -1082,5 +1082,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_note_note_userid failed\n", 33); + tiwrite(ptr_clrequest->fd, "create i_note_note_userid failed\n", TERM_NO); return 1; } @@ -1092,5 +1092,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_note_date failed\n", 26); + tiwrite(ptr_clrequest->fd, "create i_note_date failed\n", TERM_NO); return 1; } @@ -1105,5 +1105,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_user failed\n", 21); + tiwrite(ptr_clrequest->fd, "create t_user failed\n", TERM_NO); return 1; } @@ -1116,5 +1116,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_user_name failed\n", 26); + tiwrite(ptr_clrequest->fd, "create i_user_name failed\n", TERM_NO); return 1; } @@ -1133,5 +1133,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xauthor failed\n", 24); + tiwrite(ptr_clrequest->fd, "create t_xauthor failed\n", TERM_NO); return 1; } @@ -1144,5 +1144,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xauthor_autid failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_xauthor_autid failed\n", TERM_NO); return 1; } @@ -1154,5 +1154,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xauthor_refid failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_xauthor_refid failed\n", TERM_NO); return 1; } @@ -1169,5 +1169,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xkeyword failed\n", 25); + tiwrite(ptr_clrequest->fd, "create t_xkeyword failed\n", TERM_NO); return 1; } @@ -1180,5 +1180,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xkeyword_kwid failed\n", 30); + tiwrite(ptr_clrequest->fd, "create i_xkeyword_kwid failed\n", TERM_NO); return 1; } @@ -1190,5 +1190,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xkeyword_xrefid failed\n", 32); + tiwrite(ptr_clrequest->fd, "create i_xkeyword_xrefid failed\n", TERM_NO); return 1; } @@ -1208,5 +1208,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xuser failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_xuser failed\n", TERM_NO); return 1; } @@ -1219,5 +1219,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xuser_userid failed\n", 29); + tiwrite(ptr_clrequest->fd, "create i_xuser_userid failed\n", TERM_NO); return 1; } @@ -1229,5 +1229,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xuser_refid failed\n", 28); + tiwrite(ptr_clrequest->fd, "create i_xuser_refid failed\n", TERM_NO); return 1; } @@ -1244,5 +1244,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create t_xnote failed\n", 22); + tiwrite(ptr_clrequest->fd, "create t_xnote failed\n", TERM_NO); return 1; } @@ -1255,5 +1255,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xnote_noteid failed\n", 29); + tiwrite(ptr_clrequest->fd, "create i_xnote_noteid failed\n", TERM_NO); return 1; } @@ -1265,5 +1265,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "create i_xnote_xrefid failed\n", 29); + tiwrite(ptr_clrequest->fd, "create i_xnote_xrefid failed\n", TERM_NO); return 1; } Index: refdb-client.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdb-client.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -U2 -r1.25 -r1.26 --- refdb-client.c 26 Dec 2003 01:23:47 -0000 1.25 +++ refdb-client.c 29 Jan 2004 01:42:12 -0000 1.26 @@ -173,5 +173,5 @@ sprintf(outbuffer, "%d", REFDB_PROTOCOL_VERSION); - numbyte = iwrite(n_sockfd, outbuffer, strlen(outbuffer)+1); + numbyte = tiwrite(n_sockfd, outbuffer, TERM_YES); if (numbyte == -1) { cgi_header(CGI_PLAIN); @@ -341,5 +341,5 @@ errstream = (n_cgi) ? stdout : stderr; - numbyte = iwrite(slvals->n_sockfd, slvals->outbuffer, strlen(slvals->outbuffer)+1); + numbyte = tiwrite(slvals->n_sockfd, slvals->outbuffer, TERM_YES); if (numbyte == -1) { cgi_header(CGI_PLAIN); @@ -380,5 +380,5 @@ n_read_done++; /* send back confirmation to the server */ - iwrite(slvals->n_sockfd, "POS", 4); + tiwrite(slvals->n_sockfd, "POS", TERM_YES); } @@ -398,5 +398,5 @@ } - iwrite(slvals->n_sockfd, "POS", 4); + tiwrite(slvals->n_sockfd, "POS", TERM_YES); } } while (!n_read_done); @@ -540,5 +540,5 @@ if (n_result < n_chunksize && !feof(infp)) { fprintf(errstream, "data read error. Stop.\n"); - iwrite(n_sockfd, "QUIT", 5); + tiwrite(n_sockfd, "QUIT", TERM_YES); /* read response from server */ @@ -552,5 +552,5 @@ else { /* send back confirmation to the server */ - iwrite(n_sockfd, "POS", 4); + tiwrite(n_sockfd, "POS", TERM_YES); } @@ -565,5 +565,5 @@ /* send length information to database server */ sprintf(thebytes, "%d", n_result); - numbyte = iwrite(n_sockfd, thebytes, 10); /* is 10 on the safe side? */ + numbyte = tiwrite(n_sockfd, thebytes, TERM_YES); /* is 10 on the safe side? */ /* printf("%s\n", thebytes); */ @@ -697,5 +697,5 @@ cgi_header(CGI_PLAIN); fprintf(errstream, "data read error. Stop.\n"); - iwrite(n_sockfd, "QUIT", 5); + tiwrite(n_sockfd, "QUIT", TERM_YES); return 1; } @@ -711,5 +711,5 @@ /* send length information to database server */ sprintf(thebytes, "%d", *ptr_n_setlength); - numbyte = iwrite(n_sockfd, thebytes, 10); /* is 10 on the safe side? */ + numbyte = tiwrite(n_sockfd, thebytes, TERM_YES); /* is 10 on the safe side? */ /* printf("%s\n", thebytes); */ Index: refdba.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdba.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -U2 -r1.41 -r1.42 --- refdba.c 1 Jun 2003 17:57:19 -0000 1.41 +++ refdba.c 29 Jan 2004 01:42:13 -0000 1.42 @@ -985,5 +985,5 @@ /* now send the command to the application server */ /* fprintf(stderr, "%s\n", outbuffer); */ - numbyte = iwrite(n_sockfd, outbuffer, strlen(outbuffer)+1); + numbyte = tiwrite(n_sockfd, outbuffer, TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1081,5 +1081,5 @@ } - numbyte = iwrite(n_sockfd, send_buffer, strlen(send_buffer)+1); /* incl.\0 */ + numbyte = tiwrite(n_sockfd, send_buffer, TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1107,5 +1107,5 @@ n_read_done++; /* send back confirmation to the server */ - iwrite(n_sockfd, "POS", 4); + tiwrite(n_sockfd, "POS", TERM_YES); } @@ -1349,5 +1349,5 @@ /* now send the command to the application server */ - numbyte = iwrite(n_sockfd, outbuffer, strlen(outbuffer)+1); + numbyte = tiwrite(n_sockfd, outbuffer, TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1445,5 +1445,5 @@ } - numbyte = iwrite(n_sockfd, send_buffer, strlen(send_buffer)+1); /* incl.\0 */ + numbyte = tiwrite(n_sockfd, send_buffer, TERM_YES); /* incl.\0 */ if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1471,5 +1471,5 @@ n_read_done++; /* send back confirmation to the server */ - iwrite(n_sockfd, "POS", 4); + tiwrite(n_sockfd, "POS", TERM_YES); } @@ -1706,5 +1706,5 @@ /* now send the command to the application server */ /* printf("%s\n", outbuffer); */ - numbyte = iwrite(n_sockfd, outbuffer, strlen(outbuffer)+1); + numbyte = tiwrite(n_sockfd, outbuffer, TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1777,5 +1777,5 @@ /* signal server that this file is done */ sprintf(thebytes, "%d", 0); - numbyte = iwrite(n_sockfd, thebytes, 10); + numbyte = tiwrite(n_sockfd, thebytes, TERM_YES); /* printf("%s\n", thebytes); */ if (numbyte == -1) { @@ -1826,5 +1826,5 @@ /* PHASE 6 */ /* signal server we're done */ - numbyte = iwrite(n_sockfd, "QUIT", 5); + numbyte = tiwrite(n_sockfd, "QUIT", TERM_YES); /* printf("%s\n", thebytes); */ if (numbyte == -1) { @@ -1882,5 +1882,5 @@ /* send back confirmation to the server */ - iwrite(n_sockfd, "POS", 4); + tiwrite(n_sockfd, "POS", TERM_YES); /* reset */ Index: refdbc.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbc.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -U2 -r1.63 -r1.64 --- refdbc.c 25 Jan 2004 13:25:52 -0000 1.63 +++ refdbc.c 29 Jan 2004 01:42:15 -0000 1.64 @@ -1175,5 +1175,5 @@ /* send command to application server */ - numbyte = iwrite(slvals.n_sockfd, cmd_buffer, strlen(cmd_buffer)+1); + numbyte = tiwrite(slvals.n_sockfd, cmd_buffer, TERM_YES); LOG_PRINT(LOG_DEBUG, cmd_buffer); if (numbyte == -1) { @@ -1553,5 +1553,5 @@ /* send command to application server */ - numbyte = iwrite(slvals.n_sockfd, cmd_buffer, strlen(cmd_buffer)+1); + numbyte = tiwrite(slvals.n_sockfd, cmd_buffer, TERM_YES); LOG_PRINT(LOG_DEBUG, cmd_buffer); if (numbyte == -1) { @@ -3147,5 +3147,5 @@ LOG_PRINT(LOG_DEBUG, outbuffer); - numbyte = iwrite(n_sockfd, outbuffer, strlen(outbuffer)+1); + numbyte = tiwrite(n_sockfd, outbuffer, TERM_YES); /* printf("%s\n", outbuffer); */ @@ -3248,5 +3248,5 @@ /* printf("%s\n", thebytes); */ - numbyte = iwrite(n_sockfd, thebytes, 10); + numbyte = tiwrite(n_sockfd, thebytes, TERM_YES); if (numbyte == -1) { @@ -3305,5 +3305,5 @@ /* send back confirmation to the server */ - iwrite(n_sockfd, "POS", 4); + tiwrite(n_sockfd, "POS", TERM_YES); /* reset */ @@ -3819,5 +3819,5 @@ LOG_PRINT(LOG_DEBUG, outbuffer); - numbyte = iwrite(n_sockfd, outbuffer, strlen(outbuffer)+1); + numbyte = tiwrite(n_sockfd, outbuffer, TERM_YES); /* printf("%s\n", outbuffer); */ @@ -3910,5 +3910,5 @@ /* printf("%s\n", thebytes); */ - numbyte = iwrite(n_sockfd, thebytes, 10); + numbyte = tiwrite(n_sockfd, thebytes, TERM_YES); if (numbyte == -1) { @@ -3963,5 +3963,5 @@ /* send back confirmation to the server */ - iwrite(n_sockfd, "POS", 4); + tiwrite(n_sockfd, "POS", TERM_YES); /* reset */ @@ -4271,5 +4271,5 @@ /* send command to application server */ - numbyte = iwrite(slvals.n_sockfd, cmd_buffer, strlen(cmd_buffer)+1); + numbyte = tiwrite(slvals.n_sockfd, cmd_buffer, TERM_YES); LOG_PRINT(LOG_DEBUG, cmd_buffer); if (numbyte == -1) { Index: refdbd.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbd.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -U2 -r1.70 -r1.71 --- refdbd.c 25 Jan 2004 13:28:20 -0000 1.70 +++ refdbd.c 29 Jan 2004 01:42:27 -0000 1.71 @@ -861,5 +861,5 @@ if (child_inbuffer[numbyte-1] != '\0' || strlen(child_inbuffer) > PROTOCOL_LENGTH) { /* if transmission incomplete or protocol version string too long */ LOG_PRINT(LOG_CRIT, "invalid client request"); - iwrite(ptr_child_clrequest->fd, "invalid client request", 23); + tiwrite(ptr_child_clrequest->fd, "invalid client request", TERM_YES); retval = 1; goto cleanup; @@ -882,10 +882,10 @@ /* send pseudo-random string to client */ - iwrite(ptr_child_clrequest->fd, wheelpos, strlen(wheelpos)+1); + tiwrite(ptr_child_clrequest->fd, wheelpos, TERM_YES); LOG_PRINT(LOG_DEBUG, "send pseudo-random string to client"); numbyte = tread(ptr_child_clrequest->fd, child_inbuffer, COMMAND_INBUF_LEN-1); if (child_inbuffer[numbyte-1] != '\0') { /* if transmission incomplete */ LOG_PRINT(LOG_CRIT, "incomplete client command"); - iwrite(ptr_child_clrequest->fd, "incomplete client command", 26); + tiwrite(ptr_child_clrequest->fd, "incomplete client command", TERM_YES); retval = 1; goto cleanup; @@ -905,5 +905,5 @@ if (ptr_child_clrequest->inargv == NULL) { LOG_PRINT(LOG_CRIT, outomem.text); - iwrite(ptr_child_clrequest->fd, outomem.text, outomem.length+1); + tiwrite(ptr_child_clrequest->fd, outomem.text, TERM_YES); retval = 1; goto cleanup; @@ -916,10 +916,10 @@ if (result == 1) { /* memory error */ LOG_PRINT(LOG_CRIT, outomem.text); - iwrite(ptr_child_clrequest->fd, outomem.text, outomem.length+1); + tiwrite(ptr_child_clrequest->fd, outomem.text, TERM_YES); retval = 1; goto cleanup; } else if (result == 2) { /* empty command line */ - iwrite(ptr_child_clrequest->fd, "enter a command", 16); + tiwrite(ptr_child_clrequest->fd, "enter a command", TERM_YES); retval = 1; goto cleanup; @@ -1068,9 +1068,9 @@ break; case ':': - iwrite(ptr_child_clrequest->fd, "missing option", 15); + tiwrite(ptr_child_clrequest->fd, "missing option", TERM_YES); n_cmdlinerror = 1; break; case '?': - iwrite(ptr_child_clrequest->fd, "unknown option", 15); + tiwrite(ptr_child_clrequest->fd, "unknown option", TERM_YES); n_cmdlinerror = 1; break; @@ -1261,13 +1261,13 @@ else { iwrite(ptr_child_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_child_clrequest->fd, html_head, strlen(html_head)); + tiwrite(ptr_child_clrequest->fd, html_head, TERM_NO); free(html_head); if (addresult.success) { - iwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Reference was successfully added</td></tr>", 72); + tiwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Reference was successfully added</td></tr>", TERM_NO); } else { - iwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Adding reference failed</td></tr>", 63); + tiwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Adding reference failed</td></tr>", TERM_NO); } - iwrite(ptr_child_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_child_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -1294,16 +1294,16 @@ else { iwrite(ptr_child_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_child_clrequest->fd, html_head, strlen(html_head)); + tiwrite(ptr_child_clrequest->fd, html_head, TERM_NO); free(html_head); if (addresult.updated) { - iwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Reference was successfully updated</td></tr>", 74); + tiwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Reference was successfully updated</td></tr>", TERM_NO); } else if (addresult.success) { - iwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Reference was successfully added</td></tr>", 72); + tiwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Reference was successfully added</td></tr>", TERM_NO); } else { - iwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Adding reference failed</td></tr>", 63); + tiwrite(ptr_child_clrequest->fd, "<tbody><tr><td class=\"result\">Adding reference failed</td></tr>", TERM_NO); } - iwrite(ptr_child_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_child_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -1333,5 +1333,5 @@ else { iwrite(ptr_child_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_child_clrequest->fd, html_head, strlen(html_head)); + tiwrite(ptr_child_clrequest->fd, html_head, TERM_NO); free(html_head); } @@ -1355,8 +1355,8 @@ } if (ptr_child_clrequest->n_cgi) { /* cgi output */ - iwrite(ptr_child_clrequest->fd, child_returnmsg, strlen(child_returnmsg)); + tiwrite(ptr_child_clrequest->fd, child_returnmsg, TERM_NO); child_returnmsg[0] = '\0'; /* reset return string */ - iwrite(ptr_child_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_child_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -1382,5 +1382,5 @@ else { iwrite(ptr_child_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_child_clrequest->fd, html_head, strlen(html_head)); + tiwrite(ptr_child_clrequest->fd, html_head, TERM_NO); free(html_head); } @@ -1425,8 +1425,8 @@ if (ptr_child_clrequest->n_cgi) { /* cgi output */ - iwrite(ptr_child_clrequest->fd, child_returnmsg, strlen(child_returnmsg)); + tiwrite(ptr_child_clrequest->fd, child_returnmsg, TERM_NO); child_returnmsg[0] = '\0'; /* reset return string */ - iwrite(ptr_child_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_child_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -1448,5 +1448,5 @@ sprintf(child_returnmsg, ULLSPEC" reference(s) retrieved\n", (unsigned long long)n_refs); /* terminate string */ - iwrite(ptr_child_clrequest->fd, "", 1); + tiwrite(ptr_child_clrequest->fd, "", TERM_YES); /* wait for receipt from client */ @@ -1519,5 +1519,5 @@ sprintf(child_returnmsg, ULLSPEC" note(s) retrieved\n", (unsigned long long)n_notes); /* terminate string */ - iwrite(ptr_child_clrequest->fd, "", 1); + tiwrite(ptr_child_clrequest->fd, "", TERM_YES); /* wait for receipt from client */ @@ -1699,8 +1699,8 @@ /* finish dialog with client */ if (child_returnmsg) { - iwrite(ptr_child_clrequest->fd, child_returnmsg, strlen(child_returnmsg)+1); /* include \0 */ + tiwrite(ptr_child_clrequest->fd, child_returnmsg, TERM_YES); } else { - iwrite(ptr_child_clrequest->fd, "no luck today", 14); + tiwrite(ptr_child_clrequest->fd, "no luck today", TERM_YES); } Index: refdbda.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbda.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -U2 -r1.38 -r1.39 --- refdbda.c 17 Jan 2004 23:05:57 -0000 1.38 +++ refdbda.c 29 Jan 2004 01:42:29 -0000 1.39 @@ -107,5 +107,5 @@ if (!n_remote_admin) { - iwrite(ptr_clrequest->fd, "remote administration disabled\n", 31); + tiwrite(ptr_clrequest->fd, "remote administration disabled\n", TERM_NO); return; } @@ -128,5 +128,5 @@ if (ptr_clrequest->inargc == *(ptr_clrequest->ptr_optind)+1 && strcmp(ptr_clrequest->inargv[*(ptr_clrequest->ptr_optind)], "ping") == 0) { sprintf(outbuffer, "parent PID: %d child PID: %d\n", parent_pid, getpid()); - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); free(sql_command); return; @@ -173,9 +173,9 @@ LOG_PRINT(LOG_DEBUG, sql_command); if (!dbires1) { - iwrite(ptr_clrequest->fd, "error while deleting temp tables\n", 33); + tiwrite(ptr_clrequest->fd, "error while deleting temp tables\n", TERM_NO); LOG_PRINT(LOG_WARNING, "error while deleting temp tables"); } else { - iwrite(ptr_clrequest->fd, "successfully deleted temp tables\n", 33); + tiwrite(ptr_clrequest->fd, "successfully deleted temp tables\n", TERM_NO); LOG_PRINT(LOG_INFO, "temp tables deleted"); dbi_result_free(dbires1); @@ -183,5 +183,5 @@ } else { /* no temp tables in database */ - iwrite(ptr_clrequest->fd, "nothing to do\n", 14); + tiwrite(ptr_clrequest->fd, "nothing to do\n", TERM_NO); } dbi_result_free(dbires); @@ -198,15 +198,15 @@ if ((fd_fifo = open(the_fifo, O_WRONLY)) == -1) { LOG_PRINT(LOG_WARNING, "cannot open FIFO for writing"); - iwrite(ptr_clrequest->fd, "confserv: remote configure not possible\n", 40); + tiwrite(ptr_clrequest->fd, "confserv: remote configure not possible\n", TERM_NO); return; } } else { - iwrite(ptr_clrequest->fd, "confserv: remote configure not possible\n", 40); + tiwrite(ptr_clrequest->fd, "confserv: remote configure not possible\n", TERM_NO); return; } #else if (access(the_fifo, F_OK) != -1) { /* old file still exists */ - iwrite(ptr_clrequest->fd, "confserv: appserver busy, try again later\n", 42); + tiwrite(ptr_clrequest->fd, "confserv: appserver busy, try again later\n", TERM_NO); return; } @@ -214,5 +214,5 @@ if ((fd_fifo = open(the_fifo, O_WRONLY|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR)) == -1) { LOG_PRINT(LOG_WARNING, "cannot open FIFO for writing"); - iwrite(ptr_clrequest->fd, "confserv: remote configure not possible\n", 40); + tiwrite(ptr_clrequest->fd, "confserv: remote configure not possible\n", TERM_NO); return; } @@ -223,5 +223,5 @@ an optional argument */ if (ptr_clrequest->inargc == *(ptr_clrequest->ptr_optind)) { /* no argument given */ - iwrite(ptr_clrequest->fd, "confserv: wrong or incomplete command\n", 38); + tiwrite(ptr_clrequest->fd, "confserv: wrong or incomplete command\n", TERM_NO); } @@ -229,14 +229,14 @@ if (strcmp(ptr_clrequest->inargv[*(ptr_clrequest->ptr_optind)], "stop") == 0) { if (write(fd_fifo, "1stop", 6) == -1) { - iwrite(ptr_clrequest->fd, "write error in FIFO\n", 20); + tiwrite(ptr_clrequest->fd, "write error in FIFO\n", TERM_NO); LOG_PRINT(LOG_WARNING, "write error in FIFO"); } else { - iwrite(ptr_clrequest->fd, "application server stop submitted\n", 34); + tiwrite(ptr_clrequest->fd, "application server stop submitted\n", TERM_NO); LOG_PRINT(LOG_INFO, "application server stop submitted"); } } else { - iwrite(ptr_clrequest->fd, "confserv: wrong or incomplete command\n", 38); + tiwrite(ptr_clrequest->fd, "confserv: wrong or incomplete command\n", TERM_NO); } } @@ -245,9 +245,9 @@ strcpy(ptr_clrequest->server_ip, ptr_clrequest->inargv[*(ptr_clrequest->ptr_optind)+1]); sprintf(outbuffer, "set serverip to %s submitted\n", ptr_clrequest->server_ip); - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); sprintf(outbuffer, "2serverip %s", ptr_clrequest->server_ip); if (write(fd_fifo, outbuffer, strlen(outbuffer) + 1) == -1) { - iwrite(ptr_clrequest->fd, "write error in FIFO\n", 20); + tiwrite(ptr_clrequest->fd, "write error in FIFO\n", TERM_NO); LOG_PRINT(LOG_WARNING, "write error in FIFO"); } @@ -260,9 +260,9 @@ n_refdb_timeout = atoi(refdb_timeout); sprintf(outbuffer, "set timeout to %d seconds submitted\n", n_refdb_timeout); - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); sprintf(outbuffer, "2timeout %s", refdb_timeout); if (write(fd_fifo, outbuffer, strlen(outbuffer) + 1) == -1) { - iwrite(ptr_clrequest->fd, "write error in FIFO\n", 20); + tiwrite(ptr_clrequest->fd, "write error in FIFO\n", TERM_NO); LOG_PRINT(LOG_WARNING, "write error in FIFO"); } @@ -274,9 +274,9 @@ strcpy(log_file, ptr_clrequest->inargv[*(ptr_clrequest->ptr_optind)+1]); sprintf(outbuffer, "set logfile to %s submitted\n", log_file); - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); sprintf(outbuffer, "2logfile %s", log_file); if (write(fd_fifo, outbuffer, strlen(outbuffer) + 1) == -1) { - iwrite(ptr_clrequest->fd, "write error in FIFO\n", 20); + tiwrite(ptr_clrequest->fd, "write error in FIFO\n", TERM_NO); LOG_PRINT(LOG_WARNING, "write error in FIFO"); } @@ -289,9 +289,9 @@ n_log_dest = atoi(log_dest); sprintf(outbuffer, "set logdest to %d\n", n_log_dest); - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); sprintf(outbuffer, "2logdest %s", log_dest); if (write(fd_fifo, outbuffer, strlen(outbuffer) + 1) == -1) { - iwrite(ptr_clrequest->fd, "write error in FIFO\n", 20); + tiwrite(ptr_clrequest->fd, "write error in FIFO\n", TERM_NO); LOG_PRINT(LOG_WARNING, "write error in FIFO"); } @@ -304,9 +304,9 @@ n_log_level = atoi(log_level); sprintf(outbuffer, "set loglevel to %d submitted\n", n_log_level); - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); sprintf(outbuffer, "2loglevel %s", log_level); if (write(fd_fifo, outbuffer, strlen(outbuffer) + 1) == -1) { - iwrite(ptr_clrequest->fd, "write error in FIFO\n", 20); + tiwrite(ptr_clrequest->fd, "write error in FIFO\n", TERM_NO); LOG_PRINT(LOG_WARNING, "write error in FIFO"); } @@ -316,5 +316,5 @@ } else { - iwrite(ptr_clrequest->fd, "confserv: wrong or incomplete command\n", 38); + tiwrite(ptr_clrequest->fd, "confserv: wrong or incomplete command\n", TERM_NO); } } @@ -510,5 +510,5 @@ } - iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)); + tiwrite(ptr_clrequest->fd, outbuffer, TERM_NO); dbi_conn_close(conn); } @@ -552,5 +552,5 @@ if (!html_head || !html_foot) { iwrite(ptr_clrequest->fd, cgihead_plain.text, cgihead_plain.length); - iwrite(ptr_clrequest->fd, "could not load cgi templates\n", 29); + tiwrite(ptr_clrequest->fd, "could not load cgi templates\n", TERM_NO); free(html_head); free(html_foot); @@ -565,6 +565,6 @@ if (ptr_clrequest->n_cgi) { iwrite(ptr_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_clrequest->fd, html_head, strlen(html_head)); - iwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Current Database</th></tr></thead><tbody><tr><td class=\"result\">", 94); + tiwrite(ptr_clrequest->fd, html_head, TERM_NO); + tiwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Current Database</th></tr></thead><tbody><tr><td class=\"result\">", TERM_NO); free(html_head); } @@ -583,17 +583,17 @@ } else { - iwrite(ptr_clrequest->fd, "not a RefDB database\n", 21); + tiwrite(ptr_clrequest->fd, "not a RefDB database\n", TERM_NO); } } else { - iwrite(ptr_clrequest->fd, "not a RefDB database\n", 21); + tiwrite(ptr_clrequest->fd, "not a RefDB database\n", TERM_NO); } } else { - iwrite(ptr_clrequest->fd, "database does not exist\n", 24); + tiwrite(ptr_clrequest->fd, "database does not exist\n", TERM_NO); } if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "</td></tr>", 10); - iwrite(ptr_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_clrequest->fd, "</td></tr>", TERM_NO); + tiwrite(ptr_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -603,6 +603,6 @@ if (ptr_clrequest->n_cgi) { iwrite(ptr_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_clrequest->fd, html_head, strlen(html_head)); - iwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Available Databases</th></tr></thead><tbody><tr><td><input type=\"button\" value=\"Select database\" onclick=\"seldb()\"></td></tr>", 156); + tiwrite(ptr_clrequest->fd, html_head, TERM_NO); + tiwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Available Databases</th></tr></thead><tbody><tr><td><input type=\"button\" value=\"Select database\" onclick=\"seldb()\"></td></tr>", TERM_NO); free(html_head); } @@ -612,18 +612,18 @@ if (is_reference_database(ptr_clrequest, NULL, dbname)) { if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "<tr><td class=\"result\"><input type=\"radio\" name=\"selectdb\" value=\"", 66); + tiwrite(ptr_clrequest->fd, "<tr><td class=\"result\"><input type=\"radio\" name=\"selectdb\" value=\"", TERM_NO); } - iwrite(ptr_clrequest->fd, dbname, strlen(dbname)); + tiwrite(ptr_clrequest->fd, dbname, TERM_NO); if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "\">", 2); - iwrite(ptr_clrequest->fd, dbname, strlen(dbname)); - iwrite(ptr_clrequest->fd, "</td></tr>", 10); + tiwrite(ptr_clrequest->fd, "\">", TERM_NO); + tiwrite(ptr_clrequest->fd, dbname, TERM_NO); + tiwrite(ptr_clrequest->fd, "</td></tr>", TERM_NO); } - iwrite(ptr_clrequest->fd, "\n", sizeof(char)); + tiwrite(ptr_clrequest->fd, "\n", TERM_NO); } } } if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -751,6 +751,6 @@ username = dbi_result_get_string(dbires, "user_name"); if (username) { - iwrite(ptr_clrequest->fd, username, strlen(username)); - iwrite(ptr_clrequest->fd, "\n", sizeof(char)); + tiwrite(ptr_clrequest->fd, username, TERM_NO); + tiwrite(ptr_clrequest->fd, "\n", TERM_NO); } } @@ -815,6 +815,6 @@ wordname = dbi_result_get_string(dbires, "name"); if (wordname) { - iwrite(ptr_clrequest->fd, wordname, strlen(wordname)); - iwrite(ptr_clrequest->fd, "\n", sizeof(char)); + tiwrite(ptr_clrequest->fd, wordname, TERM_NO); + tiwrite(ptr_clrequest->fd, "\n", TERM_NO); } } @@ -892,5 +892,5 @@ if (dbires == NULL) { - iwrite(ptr_clrequest->fd, "createdb failed\n", 16); + tiwrite(ptr_clrequest->fd, "createdb failed\n", TERM_NO); free(sql_command); dbi_conn_close(conn); @@ -906,5 +906,5 @@ error = dbi_conn_select_db(conn, dbname); if (error) { - iwrite(ptr_clrequest->fd, "selectdb failed\n", 16); + tiwrite(ptr_clrequest->fd, "selectdb failed\n", TERM_NO); dbi_conn_close(conn); free(sql_command); @@ -961,5 +961,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "insert into t_meta failed\n", 26); + tiwrite(ptr_clrequest->fd, "insert into t_meta failed\n", TERM_NO); LOG_PRINT(LOG_ERR, "insert into t_meta failed"); free(sql_command); @@ -1026,5 +1026,5 @@ if (unlink(sql_command)) { - iwrite(ptr_clrequest->fd, "failed to delete database file\n", 31); + tiwrite(ptr_clrequest->fd, "failed to delete database file\n", TERM_NO); free(sql_command); return 0; @@ -1044,5 +1044,5 @@ dbires = dbi_conn_query(conn, sql_command); if (!dbires) { - iwrite(ptr_clrequest->fd, "deletedb failed\n", 16); + tiwrite(ptr_clrequest->fd, "deletedb failed\n", TERM_NO); dbi_conn_close(conn); free(sql_command); @@ -1064,5 +1064,5 @@ dbires = dbi_conn_query(conn, sql_command); if (error) { - iwrite(ptr_clrequest->fd, "DROP GROUP failed\n", 18); + tiwrite(ptr_clrequest->fd, "DROP GROUP failed\n", TERM_NO); dbi_conn_close(conn); free(sql_command); @@ -1145,5 +1145,5 @@ /* send back confirmation to the client */ - numbyte = iwrite(ptr_clrequest->fd, positive.text, positive.length+1); + numbyte = tiwrite(ptr_clrequest->fd, positive.text, TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1211,5 +1211,5 @@ /* use localhost if no host was specified */ if (!*user_host) { - iwrite(ptr_clrequest->fd, "use localhost as host\n", 22); + tiwrite(ptr_clrequest->fd, "use localhost as host\n", TERM_NO); user_host = localhost; } @@ -1451,5 +1451,5 @@ } else { /* driver does not support SQL-based access control */ - iwrite(ptr_clrequest->fd, "access control not supported", 29); + tiwrite(ptr_clrequest->fd, "access control not supported", TERM_NO); LOG_PRINT(LOG_WARNING, "access control not supported"); } @@ -1467,5 +1467,5 @@ sprintf(sql_command, "%d user entries added, %d failed\n", num_users, failed); } - iwrite(ptr_clrequest->fd, sql_command, strlen(sql_command)); + tiwrite(ptr_clrequest->fd, sql_command, TERM_NO); delete_all_lilimem(&sentinel); return 1; @@ -1523,5 +1523,5 @@ /* send back confirmation to the client */ - numbyte = iwrite(ptr_clrequest->fd, positive.text, positive.length+1); + numbyte = tiwrite(ptr_clrequest->fd, positive.text, TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -1614,5 +1614,5 @@ sprintf(sql_command, "%d word entries added, %d failed\n", num_words, failed); } - iwrite(ptr_clrequest->fd, sql_command, strlen(sql_command)); + tiwrite(ptr_clrequest->fd, sql_command, TERM_NO); delete_all_lilimem(&sentinel); return 1; @@ -1725,5 +1725,5 @@ iwrite(ptr_clrequest->fd, cgihead_plain.text, cgihead_plain.length); } - iwrite(ptr_clrequest->fd, "getfoo failed\n", 14); + tiwrite(ptr_clrequest->fd, "getfoo failed\n", TERM_NO); dbi_conn_close(conn); free(sql_command); @@ -1739,5 +1739,5 @@ if (!html_head || !html_foot) { iwrite(ptr_clrequest->fd, cgihead_plain.text, cgihead_plain.length); - iwrite(ptr_clrequest->fd, "could not load cgi templates\n", 29); + tiwrite(ptr_clrequest->fd, "could not load cgi templates\n", TERM_NO); free(html_head); free(html_foot); @@ -1747,8 +1747,9 @@ } iwrite(ptr_clrequest->fd, cgihead_html.text, cgihead_html.length); - iwrite(ptr_clrequest->fd, html_head, strlen(html_head)); + tiwrite(ptr_clrequest->fd, html_head, TERM_NO); + switch (type) { case 1: - iwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Matching keywords</th></tr></thead><tbody>", 72); + tiwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Matching keywords</th></tr></thead><tbody>", TERM_NO); break; case 2: /* fall through for all journal types */ @@ -1756,5 +1757,5 @@ case 4: case 5: - iwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Matching journals</th></tr></thead><tbody>", 72); + tiwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Matching journals</th></tr></thead><tbody>", TERM_NO); break; case 6: /* fall through for all author/editor types */ @@ -1762,5 +1763,5 @@ case 0: default: /* author is default */ - iwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Matching authors</th></tr></thead><tbody>", 71); + tiwrite(ptr_clrequest->fd, "<thead><tr><th class=\"result\">Matching authors</th></tr></thead><tbody>", TERM_NO); break; } @@ -1775,9 +1776,9 @@ if (foostring) { if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "<tr><td class=\"result\">", 23); + tiwrite(ptr_clrequest->fd, "<tr><td class=\"result\">", TERM_NO); } iwrite(ptr_clrequest->fd, foostring, strlen(foostring)); if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "</td></tr>", 10); + tiwrite(ptr_clrequest->fd, "</td></tr>", TERM_NO); } } @@ -1789,36 +1790,36 @@ if (foostring) { if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "<tr><td class=\"result\">", 23); + tiwrite(ptr_clrequest->fd, "<tr><td class=\"result\">", TERM_NO); } - iwrite(ptr_clrequest->fd, foostring, strlen(foostring)); + tiwrite(ptr_clrequest->fd, foostring, TERM_NO); } - iwrite(ptr_clrequest->fd, ":", 1); + tiwrite(ptr_clrequest->fd, ":", TERM_NO); foostring = dbi_result_get_string_idx(dbires, 2); /* 1-base index */ if (foostring) { - iwrite(ptr_clrequest->fd, foostring, strlen(foostring)); + tiwrite(ptr_clrequest->fd, foostring, TERM_NO); } - iwrite(ptr_clrequest->fd, ":", 1); + tiwrite(ptr_clrequest->fd, ":", TERM_NO); foostring = dbi_result_get_string_idx(dbires, 3); /* 1-base index */ if (foostring) { - iwrite(ptr_clrequest->fd, foostring, strlen(foostring)); + tiwrite(ptr_clrequest->fd, foostring, TERM_NO); } - iwrite(ptr_clrequest->fd, ":", 1); + tiwrite(ptr_clrequest->fd, ":", TERM_NO); foostring = dbi_result_get_string_idx(dbires, 4); /* 1-base index */ if (foostring) { - iwrite(ptr_clrequest->fd, foostring, strlen(foostring)); + tiwrite(ptr_clrequest->fd, foostring, TERM_NO); } - iwrite(ptr_clrequest->fd, "|", 1); + tiwrite(ptr_clrequest->fd, "|", TERM_NO); if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, "</td></tr>", 10); + tiwrite(ptr_clrequest->fd, "</td></tr>", TERM_NO); } } - iwrite(ptr_clrequest->fd, "\n", sizeof(char)); + tiwrite(ptr_clrequest->fd, "\n", TERM_NO); } if (ptr_clrequest->n_cgi) { - iwrite(ptr_clrequest->fd, html_foot, strlen(html_foot)); + tiwrite(ptr_clrequest->fd, html_foot, TERM_NO); free(html_foot); } @@ -1873,5 +1874,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "access denied\n", 14); + tiwrite(ptr_clrequest->fd, "access denied\n", TERM_NO); sprintf(outbuffer, "unauthorized administration attempt by %s detected", ptr_clrequest->username); LOG_PRINT(LOG_WARNING, outbuffer); Index: refdbdbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdbib.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -U2 -r1.32 -r1.33 --- refdbdbib.c 22 Jan 2004 01:11:55 -0000 1.32 +++ refdbdbib.c 29 Jan 2004 01:42:33 -0000 1.33 @@ -268,5 +268,5 @@ if (conv_descriptor == (iconv_t)(-1)) { LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor"); - iwrite(ptr_clrequest->fd, "cannot set conversion descriptor\n", 33); + tiwrite(ptr_clrequest->fd, "cannot set conversion descriptor\n", TERM_NO); delete_all_lilimem(&sentinel); close_dbi_connections(&bibconns, drivername); @@ -309,5 +309,5 @@ if (n_send_stylespec) { /* send back confirmation to the client */ - numbyte = iwrite(ptr_clrequest->fd, "SPEC", 5); + numbyte = tiwrite(ptr_clrequest->fd, "SPEC", TERM_YES); if (numbyte == -1) { delete_all_lilimem(&sentinel); @@ -321,5 +321,5 @@ if (!send_stylespec(ptr_clrequest->fd, bibconns.conn_refdb, myjournal, n_ref_format)) { - iwrite(ptr_clrequest->fd, "", 1); /* terminate whatever was sent */ + tiwrite(ptr_clrequest->fd, "", TERM_YES); /* terminate whatever was sent */ /* read the client reply */ @@ -334,5 +334,5 @@ return 0; } - iwrite(ptr_clrequest->fd, "style spec error", 16); + tiwrite(ptr_clrequest->fd, "style spec error", TERM_NO); close_dbi_connections(&bibconns, drivername); delete_all_lilimem(&sentinel); @@ -427,5 +427,5 @@ } else { - iwrite(ptr_clrequest->fd, "driver not supported\n", 21); + tiwrite(ptr_clrequest->fd, "driver not supported\n", TERM_NO); LOG_PRINT(LOG_ERR, "driver not supported"); close_dbi_connections(&bibconns, drivername); @@ -444,9 +444,9 @@ dbi_conn_error(bibconns.conn, &sql_errmsg); if (sql_errmsg) { - iwrite(ptr_clrequest->fd, sql_errmsg, strlen(sql_errmsg)); + tiwrite(ptr_clrequest->fd, sql_errmsg, TERM_NO); LOG_PRINT(LOG_WARNING, (char*)sql_errmsg); } else { - iwrite(ptr_clrequest->fd, "create table error", 18); + tiwrite(ptr_clrequest->fd, "create table error", TERM_NO); LOG_PRINT(LOG_WARNING, "create table error"); } @@ -478,5 +478,5 @@ /* tell client that we're ready for XML data */ - numbyte = iwrite(ptr_clrequest->fd, positive.text, positive.length+1); + numbyte = tiwrite(ptr_clrequest->fd, positive.text, TERM_YES); if (numbyte == -1) { LOG_PRINT(LOG_WARNING, "could not write to client"); @@ -492,6 +492,6 @@ dbi_conn_error(bibconns.conn, &sql_errmsg); LOG_PRINT(LOG_WARNING, (char*)sql_errmsg); - iwrite(ptr_clrequest->fd, "xml processing error:", 21); - iwrite(ptr_clrequest->fd, sql_errmsg, strlen(sql_errmsg)); + tiwrite(ptr_clrequest->fd, "xml processing error:", TERM_NO); + tiwrite(ptr_clrequest->fd, sql_errmsg, TERM_NO); sprintf(sql_command, "DROP TABLE %s", table_name); LOG_PRINT(LOG_DEBUG, sql_command); @@ -510,5 +510,5 @@ } else if (nmem_error) { - iwrite(ptr_clrequest->fd, "out of memory while reading xml file\n", 37); + tiwrite(ptr_clrequest->fd, "out of memory while reading xml file\n", TERM_NO); LOG_PRINT(LOG_WARNING, "out of memory while reading xml file"); delete_all_lilimem(&sentinel); @@ -522,7 +522,7 @@ dbi_conn_error(bibconns.conn, &sql_errmsg); LOG_PRINT(LOG_WARNING, (char*)sql_errmsg); - iwrite(ptr_clrequest->fd, "database error while reading xml file: ", 38); - iwrite(ptr_clrequest->fd, sql_errmsg, strlen(sql_errmsg)); - iwrite(ptr_clrequest->fd, "\n", 1); + tiwrite(ptr_clrequest->fd, "database error while reading xml file: ", TERM_NO); + tiwrite(ptr_clrequest->fd, sql_errmsg, TERM_NO); + tiwrite(ptr_clrequest->fd, "\n", TERM_NO); delete_all_lilimem(&sentinel); close_dbi_connections(&bibconns, drivername); @@ -534,5 +534,5 @@ /* tell client that data are ready */ - numbyte = iwrite(ptr_clrequest->fd, positive.text, positive.length+1); + numbyte = tiwrite(ptr_clrequest->fd, positive.text, TERM_YES); if (numbyte == -1) { LOG_PRINT(LOG_WARNING, "could not write to client"); @@ -576,5 +576,5 @@ if (!dbires) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, "obtaining format information failed: ", bibconns.conn_refdb)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -585,5 +585,5 @@ if (dbi_result_next_row(dbires) == 0) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, "could not access format information: ", bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -601,5 +601,5 @@ if (!bibsequence || !strcmp(bibsequence, "ERROR")) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, "could not access format information: ", bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -636,5 +636,5 @@ dbires = dbi_conn_query(bibconns.conn, sql_command); if (!dbires) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, notempselectcolon.text, bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -656,5 +656,5 @@ if (!dbires_cit) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, "CITSTYLE select failed: ", bibconns.conn_refdb)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -666,5 +666,5 @@ if (dbi_result_next_row(dbires_cit) == 0) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, "CITSTYLE select failed: ", bibconns.conn_refdb)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -691,5 +691,5 @@ if (!dbires_intext) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, "INTEXT select failed: ", bibconns.conn_refdb)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -727,5 +727,5 @@ dbires = dbi_conn_query(bibconns.conn, sql_command); if (!dbires) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, notempselectcolon.text, bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -744,5 +744,5 @@ id_string = my_dbi_result_get_string_copy(dbires, "entry_id"); if (!id_string || !strcmp(id_string, "ERROR") || insert_lilimem(&sentinel, (void**)&id_string, "id_string")) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, notempselectcolon.text, bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -757,5 +757,5 @@ if (!dbires1) { nfailed++; - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, noformatupdatecolon.text, bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -823,5 +823,5 @@ if (!dbires1) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); nfailed++; if (!assemble_return_msg(ptr_addresult, notempselectcolon.text, bibconns.conn_source)) { @@ -834,5 +834,5 @@ if (dbi_result_next_row(dbires1) == 0) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); nfailed++; if (!assemble_return_msg(ptr_addresult, "could not retrieve query results: ", bibconns.conn)) { @@ -847,5 +847,5 @@ ptr_biblio_info->entry_id = my_dbi_result_get_string_copy(dbires, "entry_id"); if (!ptr_biblio_info->entry_id || !strcmp(ptr_biblio_info->entry_id, "ERROR") || insert_lilimem(&sentinel, (void**)&(ptr_biblio_info->entry_id), "id_string")) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, notempselectcolon.text, bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -863,5 +863,5 @@ item = my_dbi_result_get_string_copy(dbires, "author_concat"); if ((!item && dbi_conn_error_flag(bibconns.conn)) || (item && !strcmp(item, "ERROR"))) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); if (!assemble_return_msg(ptr_addresult, notempselectcolon.text, bibconns.conn)) { LOG_PRINT(LOG_WARNING, ptr_addresult->msg); @@ -894,5 +894,5 @@ if ((new_outbuffer = render_dbib(&outbuffer, &outbuffer_len, &bibconns, dbires1 /* reference info */, item /* database */, ptr_biblio_info, ptr_clrequest->username, "", nref_counter)) == NULL) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); nfailed++; ptr_addresult->msg = strdup("could not format data: "); @@ -939,13 +939,13 @@ if (iconv(conv_descriptor, &my_instring, &inlength, &my_outbuffer, &outlength) == (size_t)(-1)) { if (errno == EILSEQ) { - iwrite(ptr_clrequest->fd, "iconv: invalid input character sequence\n", 40); + tiwrite(ptr_clrequest->fd, "iconv: invalid input character sequence\n", TERM_YES); LOG_PRINT(LOG_WARNING, "iconv: invalid input character sequence"); } else if (errno == E2BIG) { - iwrite(ptr_clrequest->fd, "iconv: output buffer too small\n", 31); + tiwrite(ptr_clrequest->fd, "iconv: output buffer too small\n", TERM_YES); LOG_PRINT(LOG_WARNING, "iconv: output buffer too small"); } else if (errno == EINVAL) { - iwrite(ptr_clrequest->fd, "iconv: incomplete input character\n", 34); + tiwrite(ptr_clrequest->fd, "iconv: incomplete input character\n", TERM_YES); LOG_PRINT(LOG_WARNING, "iconv: incomplete input character"); } @@ -979,5 +979,5 @@ if ((new_outbuffer = finish_render_dbib(&outbuffer, &outbuffer_len, &bibconns, ptr_biblio_info, table_name, ptr_clrequest)) == NULL) { - iwrite(ptr_clrequest->fd, "", 1); + tiwrite(ptr_clrequest->fd, "", TERM_YES); nfailed++; ptr_addresult->msg = strdup("could not create footer: "); @@ -993,5 +993,5 @@ } - n_writeresult = iwrite(ptr_clrequest->fd, outbuffer, strlen(outbuffer)+1); + n_writeresult = tiwrite(ptr_clrequest->fd, outbuffer, TERM_YES); /* printf("n_writeresult=%d<<\n", n... [truncated message content] |
From: Markus H. <mho...@us...> - 2004-01-29 03:51:05
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18550 Modified Files: refdb.h Log Message: new defines for client-server communication Index: refdb.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdb.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -U2 -r1.12 -r1.13 --- refdb.h 19 Feb 2003 21:49:20 -0000 1.12 +++ refdb.h 29 Jan 2004 01:35:59 -0000 1.13 @@ -52,3 +52,9 @@ }; +/* the length of the poly-\0 sequence used to terminate a + client/server message */ +#define TERM_LEN 1 +/* whether or not to terminate a client/server message */ +#define TERM_YES 1 +#define TERM_NO 0 |
From: Markus H. <mho...@us...> - 2004-01-29 01:48:37
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18405 Modified Files: noteshandler.c Log Message: inserting link with missing target is no longer an error but a warning Index: noteshandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/noteshandler.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -U2 -r1.13 -r1.14 --- noteshandler.c 25 Jan 2004 13:23:38 -0000 1.13 +++ noteshandler.c 29 Jan 2004 01:35:27 -0000 1.14 @@ -722,5 +722,5 @@ result = insert_link(type, target, ptr_andata->conn, ptr_andata->driver, ptr_andata->n_note_id); - if (result > 0 && result < 7) { + if (result == 1 /* out of memory */) { LOG_PRINT(LOG_WARNING, outomem.text); if ((new_msgpool = mstrcat(ptr_andata->msgpool, outomem_n.text, &(ptr_andata->msgpool_len), 0)) == NULL) { @@ -734,4 +734,62 @@ return; } + else if (result == 2 /* incorrect link type */) { + LOG_PRINT(LOG_WARNING, "insert_link(): incorrect link type"); + if ((new_msgpool = mstrcat(ptr_andata->msgpool, "incorrect link type\n", &(ptr_andata->msgpool_len), 0)) == NULL) { + (ptr_andata->nmem_error)++; + return; + } + else { + ptr_andata->msgpool = new_msgpool; + } + (ptr_andata->ndb_error)++; + return; + } + else if (result == 3 /* xref query failed */) { + LOG_PRINT(LOG_WARNING, "insert_link(): xref query failed"); + if ((new_msgpool = mstrcat(ptr_andata->msgpool, "xref query failed\n", &(ptr_andata->msgpool_len), 0)) == NULL) { + (ptr_andata->nmem_error)++; + return; + } + else { + ptr_andata->msgpool = new_msgpool; + } + (ptr_andata->ndb_error)++; + return; + } + else if (result == 4 /* missing target */) { + LOG_PRINT(LOG_INFO, "insert_link(): missing link target"); + if ((new_msgpool = mstrcat(ptr_andata->msgpool, "missing link target\n", &(ptr_andata->msgpool_len), 0)) == NULL) { + (ptr_andata->nmem_error)++; + return; + } + else { + ptr_andata->msgpool = new_msgpool; + } + } + else if (result == 5 /* xnote query failed */) { + LOG_PRINT(LOG_WARNING, "insert_link(): xnote query failed"); + if ((new_msgpool = mstrcat(ptr_andata->msgpool, "xnote query failed\n", &(ptr_andata->msgpool_len), 0)) == NULL) { + (ptr_andata->nmem_error)++; + return; + } + else { + ptr_andata->msgpool = new_msgpool; + } + (ptr_andata->ndb_error)++; + return; + } + else if (result == 6 /* insert into t_xnote failed */) { + LOG_PRINT(LOG_WARNING, "insert_link(): insert into t_xnote failed"); + if ((new_msgpool = mstrcat(ptr_andata->msgpool, "insert into t_xnote failed\n", &(ptr_andata->msgpool_len), 0)) == NULL) { + (ptr_andata->nmem_error)++; + return; + } + else { + ptr_andata->msgpool = new_msgpool; + } + (ptr_andata->ndb_error)++; + return; + } /* else: all fine */ } |
From: Michael S. <xm...@us...> - 2004-01-28 03:09:04
|
Update of /cvsroot/refdb/elisp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21013 Modified Files: refdb-mode.el Log Message: added to TODO list Index: refdb-mode.el =================================================================== RCS file: /cvsroot/refdb/elisp/refdb-mode.el,v retrieving revision 1.7 retrieving revision 1.8 diff -u -U2 -r1.7 -r1.8 --- refdb-mode.el 28 Dec 2003 12:02:07 -0000 1.7 +++ refdb-mode.el 28 Jan 2004 03:07:57 -0000 1.8 @@ -200,4 +200,22 @@ ;; ------------------------------------------------------------------- ;; +;; - Updating references +;; Add support for deleting references via updateref and pickref +;; +;; - Deleting personal references via pickref +;; +;; - Caching data +;; - run queries at RefDB startup to build an in-memory local +;; cache of authors, titles, etc. data +;; +;; - have a 'Refresh Data Cache' menu (`refdb-refresh-data-cache' +;; command) that you can manually run to update the local cache +;; +;; - Getting references using completion +;; When getting references, should prompt user with completion; +;; for example, if you select "Get References > Author...", Emacs +;; will prompt you for completion against the current list of +;; author names in its data cache. +;; ;; - Creating documents ;; Add a "Create Document" command and submenu, with menu items @@ -227,18 +245,4 @@ ;; corresponding params. ;; -;; - Caching data - -;; - run queries at RefDB startup to build an in-memory local -;; cache of authors, titles, etc. data -;; -;; - have a 'Refresh Data Cache' menu (`refdb-refresh-data-cache' -;; command) that you can manually run to update the local cache -;; -;; - Getting references using completion -;; When getting references, should prompt user with completion; -;; for example, if you select "Get References > Author...", Emacs -;; will prompt you for completion against the current list of -;; author names in its data cache. -;; ;; ------------------------------------------------------------------- ;;; Error Messages |
From: Markus H. <mho...@us...> - 2004-01-28 00:20:16
|
Update of /cvsroot/refdb/refdb/dtd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13879/dtd Modified Files: Makefile.am Log Message: make sure catalog gets installed Index: Makefile.am =================================================================== RCS file: /cvsroot/refdb/refdb/dtd/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -U2 -r1.9 -r1.10 --- Makefile.am 17 Jan 2004 00:05:16 -0000 1.9 +++ Makefile.am 28 Jan 2004 00:19:09 -0000 1.10 @@ -14,5 +14,5 @@ install-data-local: $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/dtd - @for f in $(objects); do \ + @for f in $(install_objects); do \ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(pkgdatadir)/dtd/$$f; \ done |
From: Markus H. <mho...@us...> - 2004-01-28 00:19:21
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13543 Modified Files: backend-html.c backendn-html.c Log Message: added div elements Index: backend-html.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-html.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -U2 -r1.23 -r1.24 --- backend-html.c 22 Jan 2004 01:08:13 -0000 1.23 +++ backend-html.c 28 Jan 2004 00:18:14 -0000 1.24 @@ -227,4 +227,13 @@ } + /* each reference is wrapped in a div element */ + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "<div class=\"record\">\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_WARNING, outomem.text); + return NULL; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + /* misuse date_buffer */ if (is_in_list(ptr_rendinfo->dbires, ptr_rendinfo->username) == 1) { @@ -1149,6 +1158,6 @@ } else { - /* finish with a line */ - if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), hr_buffer, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + /* finish div */ + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "</div>\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); return NULL; @@ -1157,4 +1166,12 @@ *(ptr_rendinfo->ptr_ref) = new_ref; } + +/* if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), hr_buffer, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { */ +/* LOG_PRINT(LOG_WARNING, outomem.text); */ +/* return NULL; */ +/* } */ +/* else { */ +/* *(ptr_rendinfo->ptr_ref) = new_ref; */ +/* } */ } Index: backendn-html.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backendn-html.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -U2 -r1.4 -r1.5 --- backendn-html.c 4 Jan 2004 01:55:50 -0000 1.4 +++ backendn-html.c 28 Jan 2004 00:18:15 -0000 1.5 @@ -123,4 +123,12 @@ if (*id) { + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "<div class=\"record\">\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_WARNING, outomem.text); + return NULL; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "<h2 class='ID'>Note ID:", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); @@ -377,4 +385,12 @@ } + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "</div>\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_WARNING, outomem.text); + return NULL; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + /* printf("%s\n", ref); */ return new_ref; |
From: Markus H. <mho...@us...> - 2004-01-27 13:16:00
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26193 Modified Files: refdbdnote.c refdbdref.c Log Message: improved log output if iconv_open() fails Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -U2 -r1.17 -r1.18 --- refdbdnote.c 22 Jan 2004 01:13:46 -0000 1.17 +++ refdbdnote.c 25 Jan 2004 13:30:39 -0000 1.18 @@ -132,10 +132,10 @@ if (andata.conv_descriptor == (iconv_t)(-1)) { andata.conv_descriptor = NULL; - LOG_PRINT(LOG_WARNING, "cannot set output encoding"); + LOG_PRINT(LOG_WARNING, "cannot set output encoding (database):"); } else { LOG_PRINT(LOG_DEBUG, "encoding is now:"); - LOG_PRINT(LOG_DEBUG, db_encoding); } + LOG_PRINT(LOG_DEBUG, db_encoding); } else { @@ -700,5 +700,7 @@ conv_descriptor = iconv_open(!strcmp(ptr_biblio_info->encoding, "US-ASCII") ? "ASCII" : ptr_biblio_info->encoding, !strcmp(db_encoding, "US-ASCII") ? "ASCII" : db_encoding); if (conv_descriptor == (iconv_t)(-1)) { - LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor"); + LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor (database/output):"); + LOG_PRINT(LOG_DEBUG, db_encoding); + LOG_PRINT(LOG_DEBUG, ptr_biblio_info->encoding); iwrite(ptr_clrequest->fd, "cannot set conversion descriptor\n", 33); delete_all_lilimem(&sentinel); Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -U2 -r1.55 -r1.56 --- refdbdref.c 22 Jan 2004 01:16:43 -0000 1.55 +++ refdbdref.c 25 Jan 2004 13:30:39 -0000 1.56 @@ -346,5 +346,7 @@ if (ardata.conv_descriptor == (iconv_t)(-1)) { ardata.conv_descriptor = NULL; - LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor"); + LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor (input/database):"); + LOG_PRINT(LOG_DEBUG, input_encoding); + LOG_PRINT(LOG_DEBUG, db_encoding); } else { @@ -2216,5 +2218,7 @@ conv_descriptor = iconv_open(!strcmp(ptr_biblio_info->encoding, "US-ASCII") ? "ASCII" : ptr_biblio_info->encoding, !strcmp(db_encoding, "US-ASCII") ? "ASCII" : db_encoding); if (conv_descriptor == (iconv_t)(-1)) { - LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor"); + LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor (database/output):"); + LOG_PRINT(LOG_DEBUG, db_encoding); + LOG_PRINT(LOG_DEBUG, ptr_biblio_info->encoding); if (ptr_clrequest->n_cgi) { /* cgi output */ iwrite(ptr_clrequest->fd, cgihead_plain.text, cgihead_plain.length); |
From: Markus H. <mho...@us...> - 2004-01-27 10:32:43
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25674 Modified Files: refdbd.c Log Message: changed default input encoding to ISO-8859-1; leave output encoding blank for getref and getnote unless user requests an encoding Index: refdbd.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbd.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -U2 -r1.69 -r1.70 --- refdbd.c 23 Jan 2004 00:13:17 -0000 1.69 +++ refdbd.c 25 Jan 2004 13:28:20 -0000 1.70 @@ -110,5 +110,5 @@ char upper_citekey[PREFS_BUF_LEN] = ""; /* whether to uppercase citation keys */ char default_db_encoding[PREFS_BUF_LEN] = ""; /* default char encoding for new databases */ -char default_input_encoding[PREFS_BUF_LEN] = "UTF-8"; /* default char encoding for input data */ +char default_input_encoding[PREFS_BUF_LEN] = "ISO-8859-1"; /* default char encoding for input data */ char keyword_scan[PREFS_BUF_LEN] = ""; /* run automatic keyword scan if 't' */ @@ -1437,7 +1437,7 @@ unsigned long long n_refs; - if (!*db_encoding) { - strcpy(db_encoding, default_input_encoding); - } +/* if (!*db_encoding) { */ +/* strcpy(db_encoding, default_input_encoding); */ +/* } */ biblio_info.encoding = db_encoding; @@ -1508,7 +1508,7 @@ unsigned long long n_notes; - if (!*db_encoding) { - strcpy(db_encoding, default_input_encoding); - } +/* if (!*db_encoding) { */ +/* strcpy(db_encoding, default_input_encoding); */ +/* } */ biblio_info.encoding = db_encoding; |
From: Markus H. <mho...@us...> - 2004-01-27 08:14:56
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26594 Modified Files: risdb.c risdb.h Log Message: get_unique_citekey() got another argument to select reference or note keys Index: risdb.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/risdb.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -U2 -r1.37 -r1.38 --- risdb.c 6 Jan 2004 15:39:21 -0000 1.37 +++ risdb.c 25 Jan 2004 13:31:57 -0000 1.38 @@ -1286,5 +1286,5 @@ /* insert a default citekey if none was specified */ if (!n_have_citekey && create_new) { - citekey = get_unique_citekey(conn, first_author, year, n_refdb_id); + citekey = get_unique_citekey(conn, first_author, year, n_refdb_id, 0 /* refs */); if (citekey && set_risdata_field(ptr_risdata, "citekey", citekey, driver) != 0) { @@ -1359,4 +1359,5 @@ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ get_unique_citekey(): creates a unique citekey for a given reference + or note const char* get_unique_citekey returns a citekey string in @@ -1372,6 +1373,7 @@ unsigned long long n_refdb_id id of the current reference + int type 0 = references 1 = notes ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -const char* get_unique_citekey(dbi_conn conn, const char* first_author, int year, unsigned long long n_refdb_id) { +const char* get_unique_citekey(dbi_conn conn, const char* first_author, int year, unsigned long long n_refdb_id, int type) { char *citekey; char *sep; @@ -1428,5 +1430,11 @@ /* now check whether the citekey already exists */ - sprintf(sql_command, "SELECT refdb_id FROM t_refdb WHERE refdb_citekey=\'%s\'", citekey); + if (!type) { + sprintf(sql_command, "SELECT refdb_id FROM t_refdb WHERE refdb_citekey=\'%s\'", citekey); + } + else { + sprintf(sql_command, "SELECT note_id FROM t_note WHERE note_key=\'%s\'", citekey); + } + LOG_PRINT(LOG_DEBUG, sql_command); Index: risdb.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/risdb.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -U2 -r1.10 -r1.11 --- risdb.h 19 Oct 2003 00:03:41 -0000 1.10 +++ risdb.h 25 Jan 2004 13:31:57 -0000 1.11 @@ -32,5 +32,5 @@ int process_ris_set(char* set, dbi_conn conn, dbi_conn conn_refdb, int replace_ref, char* set_owner, struct CLIENT_REQUEST* ptr_clrequest, int n_keep_id, Lilid* ptr_sentinel); char* preprocess_citekey (char* string); -const char* get_unique_citekey(dbi_conn conn, const char* first_author, int year, unsigned long long n_refdb_id); +const char* get_unique_citekey(dbi_conn conn, const char* first_author, int year, unsigned long long n_refdb_id, int type); int remove_keyword_entries(unsigned long long ref_id, dbi_conn conn, int mode); int remove_author_entries(unsigned long long ref_id, dbi_conn conn); |
From: Markus H. <mho...@us...> - 2004-01-27 03:57:17
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1827/src Modified Files: Makefile.am Log Message: fixed iconv test Index: Makefile.am =================================================================== RCS file: /cvsroot/refdb/refdb/src/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -u -U2 -r1.20 -r1.21 --- Makefile.am 17 Jan 2004 00:09:59 -0000 1.20 +++ Makefile.am 25 Jan 2004 19:34:27 -0000 1.21 @@ -30,5 +30,5 @@ refdba_LDADD = @refdba_LDADD@ refdbc_LDADD = @refdbc_LDADD@ -refdbd_LDADD = @refdbd_LDADD@ +refdbd_LDADD = @refdbd_LDADD@ @LIBICONV@ bib2ris_LDADD = @bib2ris_LDADD@ |