[Refdb-cvs] CVS: refdb/src refdbd.c,1.74.2.13,1.74.2.14 refdbd.h.in,1.7.2.7,1.7.2.8 refdbdnote.c,1.2
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-05-29 19:35:47
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21740 Modified Files: Tag: Release_0_9_5_stable refdbd.c refdbd.h.in refdbdnote.c refdbdref.c Log Message: move db_encoding to CLIENT_REQUEST Index: refdbd.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbd.c,v retrieving revision 1.74.2.13 retrieving revision 1.74.2.14 diff -u -U2 -r1.74.2.13 -r1.74.2.14 --- refdbd.c 5 May 2005 17:21:25 -0000 1.74.2.13 +++ refdbd.c 29 May 2005 19:35:37 -0000 1.74.2.14 @@ -778,5 +778,5 @@ char cgi_url[_POSIX_PATH_MAX+1] = ""; char set_owner[PREFS_BUF_LEN] = ""; - char db_encoding[PREFS_BUF_LEN] = ""; +/* char db_encoding[PREFS_BUF_LEN] = ""; */ char user_host[HOSTNAME_LENGTH] = ""; char newuser_passwd[PASSWD_LENGTH+1] = ""; @@ -1000,5 +1000,5 @@ *sort_string = '\0'; /* strcpy(db_encoding, default_db_encoding); */ - *db_encoding = '\0'; + *(ptr_child_clrequest->db_encoding) = '\0'; n_privatelist = 0; n_remove = 0; @@ -1023,7 +1023,7 @@ case 'E': /* used for both createdb and getref */ - strncpy(db_encoding, optarg, PREFS_BUF_LEN); - db_encoding[PREFS_BUF_LEN-1] = '\0'; - strup(db_encoding); + strncpy(ptr_child_clrequest->db_encoding, optarg, PREFS_BUF_LEN); + ptr_child_clrequest->db_encoding[PREFS_BUF_LEN-1] = '\0'; + strup(ptr_child_clrequest->db_encoding); break; case 'G': @@ -1352,6 +1352,6 @@ else if (strcmp((ptr_child_clrequest->inargv)[0], "createdb") == 0) { - if (!*db_encoding) { - strcpy(db_encoding, default_db_encoding); + if (!*(ptr_child_clrequest->db_encoding)) { + strcpy(ptr_child_clrequest->db_encoding, default_db_encoding); } @@ -1363,5 +1363,5 @@ } - retval = createdb(ptr_child_clrequest, db_encoding, ptr_addresult, optind); + retval = createdb(ptr_child_clrequest, ptr_addresult, optind); if (retval != 1) { @@ -1424,8 +1424,8 @@ /*********************************************** addref ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "addref") == 0) { - if (!*db_encoding) { - strcpy(db_encoding, default_input_encoding); + if (!*(ptr_child_clrequest->db_encoding)) { + strcpy(ptr_child_clrequest->db_encoding, default_input_encoding); } - retval = addref(ptr_child_clrequest, set_owner, ptr_addresult, 0, n_keep_id, format_string, &id_sentinel, db_encoding); + retval = addref(ptr_child_clrequest, set_owner, ptr_addresult, 0, n_keep_id, format_string, &id_sentinel); /* let the client know what happened */ @@ -1462,8 +1462,8 @@ /*********************************************** updateref ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "updateref") == 0) { - if (!*db_encoding) { - strcpy(db_encoding, default_input_encoding); + if (!*(ptr_child_clrequest->db_encoding)) { + strcpy(ptr_child_clrequest->db_encoding, default_input_encoding); } - retval = addref(ptr_child_clrequest, set_owner, ptr_addresult, n_personal, n_keep_id, format_string, &id_sentinel, db_encoding); + retval = addref(ptr_child_clrequest, set_owner, ptr_addresult, n_personal, n_keep_id, format_string, &id_sentinel); /* let the client know what happened */ @@ -1547,5 +1547,5 @@ /*********************************************** getref ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getref") == 0) { - ptr_biblio_info->encoding = db_encoding; + ptr_biblio_info->encoding = ptr_child_clrequest->db_encoding; retval = getref(ptr_child_clrequest, ptr_biblio_info, ref_format, n_privatelist, pdfroot, cgi_url, ptr_addresult); @@ -1560,8 +1560,5 @@ /*********************************************** addnote ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "addnote") == 0) { - if (!*db_encoding) { - strcpy(db_encoding, default_input_encoding); - } - retval = addnote(ptr_child_clrequest, set_owner, ptr_addresult, 0, &id_sentinel, db_encoding); + retval = addnote(ptr_child_clrequest, set_owner, ptr_addresult, 0, &id_sentinel); /* let the client know what happened */ @@ -1576,8 +1573,5 @@ /*********************************************** updatenote ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "updatenote") == 0) { - if (!*db_encoding) { - strcpy(db_encoding, default_input_encoding); - } - retval = addnote(ptr_child_clrequest, set_owner, ptr_addresult, 1, &id_sentinel, db_encoding); + retval = addnote(ptr_child_clrequest, set_owner, ptr_addresult, 1, &id_sentinel); /* let the client know what happened */ @@ -1612,5 +1606,5 @@ /*********************************************** getnote ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getnote") == 0) { - ptr_biblio_info->encoding = db_encoding; + ptr_biblio_info->encoding = ptr_child_clrequest->db_encoding; retval = getnote(ptr_child_clrequest, ptr_biblio_info, ref_format, n_privatelist, cgi_url, ptr_addresult); @@ -1643,5 +1637,5 @@ /*********************************************** getau *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getau") == 0) { - retval = getfoo(ptr_child_clrequest, GETAU, 0, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETAU, 0, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1655,5 +1649,5 @@ /*********************************************** geted *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "geted") == 0) { - retval = getfoo(ptr_child_clrequest, GETED, 0, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETED, 0, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1667,5 +1661,5 @@ /*********************************************** getas *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getas") == 0) { - retval = getfoo(ptr_child_clrequest, GETAS, 0, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETAS, 0, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1679,5 +1673,5 @@ /*********************************************** getkw *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getkw") == 0) { - retval = getfoo(ptr_child_clrequest, GETKW, 0, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETKW, 0, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1691,5 +1685,5 @@ /*********************************************** getjo *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getjo") == 0) { - retval = getfoo(ptr_child_clrequest, GETJO, n_all, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETJO, n_all, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1703,5 +1697,5 @@ /*********************************************** getjf *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getjf") == 0) { - retval = getfoo(ptr_child_clrequest, GETJF, n_all, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETJF, n_all, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1715,5 +1709,5 @@ /*********************************************** getj1 *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getj1") == 0) { - retval = getfoo(ptr_child_clrequest, GETJ1, n_all, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETJ1, n_all, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1727,5 +1721,5 @@ /*********************************************** getj2 *****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getj2") == 0) { - retval = getfoo(ptr_child_clrequest, GETJ2, n_all, db_encoding, ptr_addresult); + retval = getfoo(ptr_child_clrequest, GETJ2, n_all, ptr_child_clrequest->db_encoding, ptr_addresult); if (retval != 1) { n_client_status = read_status(ptr_child_clrequest->fd); @@ -1775,5 +1769,5 @@ /*********************************************** getbib ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "getbib") == 0) { - ptr_biblio_info->encoding = db_encoding; + ptr_biblio_info->encoding = ptr_child_clrequest->db_encoding; retval = getbib(ptr_child_clrequest, ptr_biblio_info, ref_format, n_send_stylespec, ptr_addresult); @@ -1804,5 +1798,5 @@ /*********************************************** gettexbib ****/ else if (strcmp((ptr_child_clrequest->inargv)[0], "gettexbib") == 0) { - ptr_biblio_info->encoding = db_encoding; + ptr_biblio_info->encoding = ptr_child_clrequest->db_encoding; retval = gettexbib(ptr_child_clrequest, ptr_biblio_info, ptr_addresult); Index: refdbd.h.in =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbd.h.in,v retrieving revision 1.7.2.7 retrieving revision 1.7.2.8 diff -u -U2 -r1.7.2.7 -r1.7.2.8 --- refdbd.h.in 17 Apr 2005 00:05:04 -0000 1.7.2.7 +++ refdbd.h.in 29 May 2005 19:35:37 -0000 1.7.2.8 @@ -52,4 +52,5 @@ char current_db[DBNAME_LENGTH+1]; /* name of reference database */ char db_path[PREFS_BUF_LEN]; /* path of dir containing databases */ + char db_encoding[PREFS_BUF_LEN]; /* input or output encoding */ char client_ip[16]; /* IP address of client */ char* argument; /* additional unparsed command arguments */ @@ -105,10 +106,10 @@ int getstyle(struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult); int whichdb(struct CLIENT_REQUEST* ptr_clrequest); -int createdb(struct CLIENT_REQUEST* ptr_clrequest, const char* db_encoding, struct ADDRESULT* ptr_addresult, int optind); -int real_createdb(struct CLIENT_REQUEST* ptr_clrequest, const char* dbname, const char* db_encoding, struct ADDRESULT* ptr_addresult); +int createdb(struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult, int optind); +int real_createdb(struct CLIENT_REQUEST* ptr_clrequest, const char* db_encoding, struct ADDRESULT* ptr_addresult); int deletedb(struct CLIENT_REQUEST* ptr_clrequest, int optind, struct ADDRESULT* ptr_addresult); int child_confserv(struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult); void confserv(char *command, char *server_ip); -int addref(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_ref, int n_keep_id, const char* reftype, Lilid* ptr_sentinel, char* input_encoding); +int addref(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_ref, int n_keep_id, const char* reftype, Lilid* ptr_sentinel); int deleteref(struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult); int delete_ref_by_id(unsigned long long idval, dbi_conn conn, struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult); @@ -127,5 +128,5 @@ int is_refdb_admin(struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult); int run_keyword_scan(struct CLIENT_REQUEST* ptr_clrequest, Lilid* ptr_sentinel, int mode); -int addnote(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_note, Lilid* ptr_sentinel, char* input_encoding); +int addnote(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_note, Lilid* ptr_sentinel); int deletenote(struct CLIENT_REQUEST* ptr_clrequest, struct ADDRESULT* ptr_addresult); int getnote(struct CLIENT_REQUEST* ptr_clrequest, struct bibinfo *ptr_biblio_info, int ref_format, int n_privatelist, char *cgi_url, struct ADDRESULT* ptr_addresult); Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.25.2.5 retrieving revision 1.25.2.6 diff -u -U2 -r1.25.2.5 -r1.25.2.6 --- refdbdnote.c 5 May 2005 17:30:22 -0000 1.25.2.5 +++ refdbdnote.c 29 May 2005 19:35:37 -0000 1.25.2.6 @@ -76,8 +76,6 @@ added ID values - char* input_encoding encoding of the input data - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -int addnote(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_note, Lilid* ptr_sentinel, char* input_encoding) { +int addnote(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_note, Lilid* ptr_sentinel) { dbi_conn conn; dbi_conn conn_refdb = NULL; Index: refdbdref.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdref.c,v retrieving revision 1.65.2.9 retrieving revision 1.65.2.10 diff -u -U2 -r1.65.2.9 -r1.65.2.10 --- refdbdref.c 5 May 2005 17:28:37 -0000 1.65.2.9 +++ refdbdref.c 29 May 2005 19:35:37 -0000 1.65.2.10 @@ -289,8 +289,6 @@ added ID values - char* input_encoding encoding of the input data - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -int addref(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_ref, int n_keep_id, const char* reftype, Lilid* ptr_sentinel, char* input_encoding) { +int addref(struct CLIENT_REQUEST* ptr_clrequest, char* set_owner, struct ADDRESULT* ptr_addresult, int replace_ref, int n_keep_id, const char* reftype, Lilid* ptr_sentinel) { dbi_conn conn; dbi_conn conn_refdb = NULL; @@ -344,10 +342,10 @@ /* if we need to convert, create a conversion descriptor for iconv() */ - if (db_encoding && strcmp(db_encoding, !strcmp(reftype, "risx") ? "UTF-8" : input_encoding)) { - ardata.conv_descriptor = iconv_open(!strcmp(db_encoding, "US-ASCII") ? "ASCII" : db_encoding, !strcmp(reftype, "risx") ? "UTF-8" : input_encoding); + if (db_encoding && strcmp(db_encoding, !strcmp(reftype, "risx") ? "UTF-8" : ptr_clrequest->db_encoding)) { + ardata.conv_descriptor = iconv_open(!strcmp(db_encoding, "US-ASCII") ? "ASCII" : db_encoding, !strcmp(reftype, "risx") ? "UTF-8" : ptr_clrequest->db_encoding); if (ardata.conv_descriptor == (iconv_t)(-1)) { ardata.conv_descriptor = NULL; LOG_PRINT(LOG_WARNING, "cannot set conversion descriptor (input/database):"); - LOG_PRINT(LOG_DEBUG, input_encoding); + LOG_PRINT(LOG_DEBUG, ptr_clrequest->db_encoding); LOG_PRINT(LOG_DEBUG, db_encoding); iconv_init_status = 701; @@ -355,5 +353,5 @@ else { LOG_PRINT(LOG_DEBUG, "input encoding is:"); - LOG_PRINT(LOG_DEBUG, input_encoding); + LOG_PRINT(LOG_DEBUG, ptr_clrequest->db_encoding); } } |