From fa411b75ed22e3ead631084a964a3a55a8db1f66 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 9 Jun 2008 09:43:52 +0000 Subject: [PATCH] Release 2.7.4 SVN revision: 2111 --- Makefile | 2 +- doc/ChangeLog | 24 + doc/index.html | 2 +- resources/eloglang.brazilian | 3 + resources/eloglang.bulgarian | 3 + resources/eloglang.czech | 3 + resources/eloglang.danish | 3 + resources/eloglang.dutch | 7 + resources/eloglang.french | 3 + resources/eloglang.german | 3 + resources/eloglang.italian | 3 + resources/eloglang.japanese | 3 + resources/eloglang.ru_CP1251 | 3 + resources/eloglang.spanish | 7 + resources/eloglang.swedish | 3 + resources/eloglang.turkish | 3 + resources/eloglang.zh_CN-GB2312 | 3 + resources/eloglang.zh_CN-UTF8 | 3 + src/elog.c | 28 +- src/elogd.c | 3110 ++++++++++++++++--------------- 20 files changed, 1703 insertions(+), 1516 deletions(-) diff --git a/Makefile b/Makefile index 22f19b0c..1e7c829d 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ SDESTDIR = $(ROOT)$(PREFIX)/sbin RCDIR = $(ROOT)/etc/rc.d/init.d # flag for SSL support -#USE_SSL = 1 +USE_SSL = 1 ############################################################# diff --git a/doc/ChangeLog b/doc/ChangeLog index 35140e7e..377ce311 100755 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,27 @@ +Version 2.7.4, released June 9th, 2008 +====================================== + +- Fixed 'next day' in quick filter with 'date' attributes not showing up correctly +- Fixed 'preview attachments' with images +- Made '$entry date' subsitutions work with datetime attributes +- Replaced 'install -D' by 'mkdir -p' (flag not recognized on some systems) +- Implemented conditional attributes in find form +- Fixed 'preset text' under condition with top groups +- Show localized date on edit form +- Added SSL libs for elog +- Show nuber of attachments in summary view if >5 +- Stealing of lock now works in other languages +- Display attachment icon with "thread display" +- Implemented attachment icons in summary/threaded list +- Implemented 'style = ...' +- Added -%d argument for all conversions +- Fixed problem with auto index and missing attribute +- Added timezone for CYGWIN +- Calculate index for automatically incremented preset attributes by searching all old messages for the highest used index +- Fixed display of inline images and truncated ASCII attachments in list mode +- Made 'ID' work for quick filter +- Implemented 'attachment lines' + Version 2.7.3, released Feb. 22th, 2008 ======================================= diff --git a/doc/index.html b/doc/index.html index c554b801..5f77e73e 100755 --- a/doc/index.html +++ b/doc/index.html @@ -28,7 +28,7 @@  [Links]  * 

Home of the Electronic Logbook package by Stefan Ritt

-
Current version is : 2.7.3
+
Current version is : 2.7.4
certificate
diff --git a/resources/eloglang.brazilian b/resources/eloglang.brazilian index 0075684a..3947efa9 100755 --- a/resources/eloglang.brazilian +++ b/resources/eloglang.brazilian @@ -464,3 +464,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.bulgarian b/resources/eloglang.bulgarian index 2245e8d3..a3da5fcb 100755 --- a/resources/eloglang.bulgarian +++ b/resources/eloglang.bulgarian @@ -464,3 +464,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.czech b/resources/eloglang.czech index 3ee519ba..ad83dbbd 100644 --- a/resources/eloglang.czech +++ b/resources/eloglang.czech @@ -462,3 +462,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.danish b/resources/eloglang.danish index fc592a7d..e6c07b00 100755 --- a/resources/eloglang.danish +++ b/resources/eloglang.danish @@ -462,3 +462,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.dutch b/resources/eloglang.dutch index 3dd77870..c0e9b5ad 100755 --- a/resources/eloglang.dutch +++ b/resources/eloglang.dutch @@ -461,3 +461,10 @@ Rotate right = Rechts draaien Delete attachment = Verwijder bijlage Cannot create thumbnail, please check ImageMagick installation = Kan geen voorbeeld maken, controleer de ImageMagick installatie + +# +#---- please translate following items and then remove this comment ----# +# +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.french b/resources/eloglang.french index 3eef5352..3a70c9ba 100755 --- a/resources/eloglang.french +++ b/resources/eloglang.french @@ -462,3 +462,6 @@ Rotate left = Rotation Rotate right = Rotation à droite Delete attachment = Supprimer la pièce jointe Cannot create thumbnail, please check ImageMagick installation = Impossible de créer l'aperçu, merci de vérifier l'installation de ImageMagick +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.german b/resources/eloglang.german index a855d103..e619358c 100755 --- a/resources/eloglang.german +++ b/resources/eloglang.german @@ -457,3 +457,6 @@ Rotate left = Links rotieren Rotate right = Rechts rotieren Delete attachment = Anhang löschen Cannot create thumbnail, please check ImageMagick installation = Kann Vorschau nicht erstellen, bitte ImageMagick Installation überprüfen +Please log on by clicking on following link and change your password = Bitte durck klicken auf den folgenden link anmelden und Kennwort ändern +Attachments = Anhänge +Error: Content length (%d) larger than maximum content length (%d) = Fehler: Datengröße (%d) ist größer als maximal erlaubte Datengröße (%d) diff --git a/resources/eloglang.italian b/resources/eloglang.italian index 018c5e43..9bc47d8a 100755 --- a/resources/eloglang.italian +++ b/resources/eloglang.italian @@ -460,3 +460,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.japanese b/resources/eloglang.japanese index f0e87c38..bc6f5e17 100755 --- a/resources/eloglang.japanese +++ b/resources/eloglang.japanese @@ -460,3 +460,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.ru_CP1251 b/resources/eloglang.ru_CP1251 index 1f203e1c..426ac9fc 100644 --- a/resources/eloglang.ru_CP1251 +++ b/resources/eloglang.ru_CP1251 @@ -465,3 +465,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.spanish b/resources/eloglang.spanish index dfd14170..3e03dfca 100755 --- a/resources/eloglang.spanish +++ b/resources/eloglang.spanish @@ -458,3 +458,10 @@ Rotate left = Girar a la izquierda Rotate right = Girar a la derecha Delete attachment = Borrar adjunto Cannot create thumbnail, please check ImageMagick installation = No se puede crear thumbnail, por favor verifique la instalacion de ImageMagick + +# +#---- please translate following items and then remove this comment ----# +# +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.swedish b/resources/eloglang.swedish index 13555feb..31fca3fd 100644 --- a/resources/eloglang.swedish +++ b/resources/eloglang.swedish @@ -468,3 +468,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.turkish b/resources/eloglang.turkish index 2c512596..9a87ff22 100755 --- a/resources/eloglang.turkish +++ b/resources/eloglang.turkish @@ -464,3 +464,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.zh_CN-GB2312 b/resources/eloglang.zh_CN-GB2312 index 3819971d..9ad119e1 100644 --- a/resources/eloglang.zh_CN-GB2312 +++ b/resources/eloglang.zh_CN-GB2312 @@ -463,3 +463,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/resources/eloglang.zh_CN-UTF8 b/resources/eloglang.zh_CN-UTF8 index cf928fca..757e807c 100644 --- a/resources/eloglang.zh_CN-UTF8 +++ b/resources/eloglang.zh_CN-UTF8 @@ -463,3 +463,6 @@ Rotate left = Rotate right = Delete attachment = Cannot create thumbnail, please check ImageMagick installation = +Please log on by clicking on following link and change your password = +Attachments = +Error: Content length (%d) larger than maximum content length (%d) = diff --git a/src/elog.c b/src/elog.c index e065fd2b..85cfb78f 100755 --- a/src/elog.c +++ b/src/elog.c @@ -326,7 +326,7 @@ int elog_connect(char *host, int port) /*------------------------------------------------------------------*/ #ifdef HAVE_SSL -int ssl_connect(int sock, SSL **ssl_con) +int ssl_connect(int sock, SSL ** ssl_con) { SSL_METHOD *meth; SSL_CTX *ctx; @@ -383,9 +383,9 @@ INT retrieve_elog(char *host, int port, char *subdir, int ssl, char *experiment, SSL *ssl_con; #endif - if (ssl) /* avoid compiler warning */ + if (ssl) /* avoid compiler warning */ sock = 0; - + sock = elog_connect(host, port); if (sock < 0) return sock; @@ -449,7 +449,7 @@ INT retrieve_elog(char *host, int port, char *subdir, int ssl, char *experiment, SSL_write(ssl_con, request, strlen(request)); else #endif - send(sock, request, strlen(request), 0); + send(sock, request, strlen(request), 0); if (verbose) { printf("Request sent to host:\n"); puts(request); @@ -459,10 +459,10 @@ INT retrieve_elog(char *host, int port, char *subdir, int ssl, char *experiment, memset(response, 0, sizeof(response)); #ifdef HAVE_SSL if (ssl) - i = SSL_read(ssl_con, response, sizeof(response)-1); + i = SSL_read(ssl_con, response, sizeof(response) - 1); else #endif - i = recv(sock, response, sizeof(response)-1, 0); + i = recv(sock, response, sizeof(response) - 1, 0); if (i < 0) { perror("Cannot receive response"); return -1; @@ -472,10 +472,10 @@ INT retrieve_elog(char *host, int port, char *subdir, int ssl, char *experiment, while (i > 0) { #ifdef HAVE_SSL if (ssl) - i = SSL_read(ssl_con, response + n, sizeof(response)-1-n); + i = SSL_read(ssl_con, response + n, sizeof(response) - 1 - n); else #endif - i = recv(sock, response + n, sizeof(response)-1-n, 0); + i = recv(sock, response + n, sizeof(response) - 1 - n, 0); if (i > 0) n += i; } @@ -899,7 +899,7 @@ INT submit_elog(char *host, int port, int ssl, char *subdir, char *experiment, SSL_write(ssl_con, request, header_length); else #endif - send(sock, request, header_length, 0); + send(sock, request, header_length, 0); if (verbose) { printf("Request sent to host:\n"); puts(request); @@ -911,7 +911,7 @@ INT submit_elog(char *host, int port, int ssl, char *subdir, char *experiment, SSL_write(ssl_con, content, content_length); else #endif - send(sock, content, content_length, 0); + send(sock, content, content_length, 0); if (verbose) { printf("Content sent to host:\n"); puts(content); @@ -921,10 +921,10 @@ INT submit_elog(char *host, int port, int ssl, char *subdir, char *experiment, memset(response, 0, sizeof(response)); #ifdef HAVE_SSL if (ssl) - i = SSL_read(ssl_con, response, sizeof(response)-1); + i = SSL_read(ssl_con, response, sizeof(response) - 1); else #endif - i = recv(sock, response, sizeof(response)-1, 0); + i = recv(sock, response, sizeof(response) - 1, 0); if (i < 0) { perror("Cannot receive response"); return -1; @@ -935,10 +935,10 @@ INT submit_elog(char *host, int port, int ssl, char *subdir, char *experiment, while (i > 0) { #ifdef HAVE_SSL if (ssl) - i = SSL_read(ssl_con, response + n, sizeof(response)-1-n); + i = SSL_read(ssl_con, response + n, sizeof(response) - 1 - n); else #endif - i = recv(sock, response + n, sizeof(response)-1-n, 0); + i = recv(sock, response + n, sizeof(response) - 1 - n, 0); if (i > 0) n += i; } diff --git a/src/elogd.c b/src/elogd.c index ac9ae7e8..4a11c905 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -9,7 +9,7 @@ \********************************************************************/ /* Version of ELOG */ -#define VERSION "2.7.3" +#define VERSION "2.7.4" char svn_revision[] = "$Id$"; /* ELOG identification */ @@ -114,9 +114,9 @@ typedef int BOOL; #define stricmp(s1, s2) strcasecmp(s1, s2) #endif -gid_t orig_gid; /* Original effective GID before dropping privilege */ -uid_t orig_uid; /* Original effective UID before dropping privilege */ -char pidfile[256]; /* Pidfile name */ +gid_t orig_gid; /* Original effective GID before dropping privilege */ +uid_t orig_uid; /* Original effective UID before dropping privilege */ +char pidfile[256]; /* Pidfile name */ #endif /* OS_UNIX */ @@ -134,12 +134,12 @@ long _timezone; #include "mxml.h" #include "strlcpy.h" -BOOL running_as_daemon; /* Running as a daemon/service? */ -int elog_tcp_port; /* Server's TCP port */ +BOOL running_as_daemon; /* Running as a daemon/service? */ +int elog_tcp_port; /* Server's TCP port */ -static void (*printf_handler)(const char *); /* Handler to printf for logging */ -static void (*fputs_handler)(const char *); /* Handler to fputs for logging */ -static FILE *current_output_stream= NULL; /* Currently used output stream */ +static void (*printf_handler) (const char *); /* Handler to printf for logging */ +static void (*fputs_handler) (const char *); /* Handler to fputs for logging */ +static FILE *current_output_stream = NULL; /* Currently used output stream */ #define SYSLOG_PRIORITY LOG_NOTICE /* Default priority for syslog facility */ @@ -211,22 +211,23 @@ char _mtext[TEXT_SIZE]; char _cmdline[CMD_SIZE]; char *_attachment_buffer; int _attachment_size; -int _max_content_length= MAX_CONTENT_LENGTH; +int _max_content_length = MAX_CONTENT_LENGTH; struct in_addr rem_addr; char rem_host[256]; char rem_host_ip[256]; int _sock; -BOOL use_keepalive, enable_execute= FALSE; +BOOL use_keepalive, enable_execute = FALSE; BOOL fckedit_exist, image_magick_exist; int verbose, _current_message_id; int _logging_level, _ssl_flag; char *mname[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", - "October", "November", "December" }; + "October", "November", "December" +}; char type_list[MAX_N_LIST][NAME_LENGTH] = { "Routine", "Other" }; -char category_list[MAX_N_LIST][NAME_LENGTH] = { "General", "Other", +char category_list[MAX_N_LIST][NAME_LENGTH] = { "General", "Other", }; char author_list[MAX_N_LIST][NAME_LENGTH] = { "" }; @@ -261,8 +262,9 @@ int attr_flags[MAX_N_ATTR]; char attr_list_default[][NAME_LENGTH] = { "Author", "Type", "Category", "Subject", "" }; -char attr_options_default[][MAX_N_LIST][NAME_LENGTH] = { { "" }, { "Routine", "Other" }, - { "General", "Other" }, { "" } }; +char attr_options_default[][MAX_N_LIST][NAME_LENGTH] = { {""}, {"Routine", "Other"}, +{"General", "Other"}, {""} +}; int attr_flags_default[] = { AF_REQUIRED, 0, 0, 0 }; @@ -271,24 +273,55 @@ struct { char type[32]; } filetype[] = { -{ ".AI", "application/postscript" }, { ".ASC", "text/plain" }, { ".BZ2", "application/x-bzip2" }, { ".CFG", - "text/plain" }, { ".CHRT", "application/x-kchart" }, { ".CONF", "text/plain" }, { ".CSH", - "application/x-csh" }, { ".CSS", "text/css" }, { ".DOC", "application/msword" }, { ".DVI", - "application/x-dvi" }, { ".EPS", "application/postscript" }, { ".GIF", "image/gif" }, { ".GZ", - "application/x-gzip" }, { ".HTM", "text/html" }, { ".HTML", "text/html" }, { ".ICO", "image/x-icon" }, - { ".JPEG", "image/jpeg" }, { ".JPG", "image/jpeg" }, { ".JS", "application/x-javascript" }, { ".KPR", - "application/x-kpresenter" }, { ".KSP", "application/x-kspread" }, { ".KWD", - "application/x-kword" }, { ".MP3", "audio/mpeg" }, { ".OGG", "application/x-ogg" }, { ".PDF", - "application/pdf" }, { ".PNG", "image/png" }, { ".PS", "application/postscript" }, { ".RAM", - "audio/x-pn-realaudio" }, { ".RM", "audio/x-pn-realaudio" }, { ".RM", "audio/x-pn-realaudio" }, { - ".RM", "audio/x-pn-realaudio" }, { ".RPM", "application/x-rpm" }, { ".RTF", "application/rtf" }, - { ".SH", "application/x-sh" }, { ".TAR", "application/x-tar" }, { ".TCL", "application/x-tcl" }, { - ".TEX", "application/x-tex" }, { ".TGZ", "application/x-gzip" }, { ".TIF", "image/tiff" }, { - ".TIFF", "image/tiff" }, { ".TXT", "text/plain" }, { ".WAV", "audio/x-wav" }, { ".XLS", - "application/x-msexcel" }, { ".XML", "text/xml" }, { ".XSL", "text/xml" }, { ".ZIP", - "application/x-zip-compressed" }, { + { + ".AI", "application/postscript"}, { + ".ASC", "text/plain"}, { + ".BZ2", "application/x-bzip2"}, { + ".CFG", "text/plain"}, { + ".CHRT", "application/x-kchart"}, { + ".CONF", "text/plain"}, { + ".CSH", "application/x-csh"}, { + ".CSS", "text/css"}, { + ".DOC", "application/msword"}, { + ".DVI", "application/x-dvi"}, { + ".EPS", "application/postscript"}, { + ".GIF", "image/gif"}, { + ".GZ", "application/x-gzip"}, { + ".HTM", "text/html"}, { + ".HTML", "text/html"}, { + ".ICO", "image/x-icon"}, { + ".JPEG", "image/jpeg"}, { + ".JPG", "image/jpeg"}, { + ".JS", "application/x-javascript"}, { + ".KPR", "application/x-kpresenter"}, { + ".KSP", "application/x-kspread"}, { + ".KWD", "application/x-kword"}, { + ".MP3", "audio/mpeg"}, { + ".OGG", "application/x-ogg"}, { + ".PDF", "application/pdf"}, { + ".PNG", "image/png"}, { + ".PS", "application/postscript"}, { + ".RAM", "audio/x-pn-realaudio"}, { + ".RM", "audio/x-pn-realaudio"}, { + ".RM", "audio/x-pn-realaudio"}, { + ".RM", "audio/x-pn-realaudio"}, { + ".RPM", "application/x-rpm"}, { + ".RTF", "application/rtf"}, { + ".SH", "application/x-sh"}, { + ".TAR", "application/x-tar"}, { + ".TCL", "application/x-tcl"}, { + ".TEX", "application/x-tex"}, { + ".TGZ", "application/x-gzip"}, { + ".TIF", "image/tiff"}, { + ".TIFF", "image/tiff"}, { + ".TXT", "text/plain"}, { + ".WAV", "audio/x-wav"}, { + ".XLS", "application/x-msexcel"}, { + ".XML", "text/xml"}, { + ".XSL", "text/xml"}, { + ".ZIP", "application/x-zip-compressed"}, { - "", "" }, }; +"", ""},}; typedef struct { int message_id; @@ -332,7 +365,7 @@ typedef struct { int in_reply_to; } MSG_LIST; -LOGBOOK *lb_list= NULL; +LOGBOOK *lb_list = NULL; #ifdef OS_WINNT int run_service(void); @@ -341,10 +374,10 @@ int run_service(void); void show_error(char *error); BOOL enum_user_line(LOGBOOK * lbs, int n, char *user, int size); int get_user_line(LOGBOOK * lbs, char *user, char *password, char *full_name, char *email, - BOOL email_notify[1000], time_t * last_access); + BOOL email_notify[1000], time_t * last_access); int strbreak(char *str, char list[][NAME_LENGTH], int size, char *brk, BOOL ignore_quotes); int execute_shell(LOGBOOK * lbs, int message_id, char attrib[MAX_N_ATTR][NAME_LENGTH], - char att_file[MAX_ATTACHMENTS][256], char *sh_cmd); + char att_file[MAX_ATTACHMENTS][256], char *sh_cmd); BOOL isparam(char *param); char *getparam(char *param); void write_logfile(LOGBOOK * lbs, const char *str); @@ -362,7 +395,7 @@ int change_config_line(LOGBOOK * lbs, char *option, char *old_value, char *new_v int read_password(char *pwd, int size); int getcfg(char *group, char *param, char *value, int vsize); int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_LENGTH], - char attrib[][NAME_LENGTH], BOOL format_date); + char attrib[][NAME_LENGTH], BOOL format_date); void highlight_searchtext(regex_t * re_buf, char *src, char *dst, BOOL hidden); int parse_config_file(char *config_file); PMXML_NODE load_password_file(LOGBOOK * lbs, char *error, int error_size); @@ -576,7 +609,8 @@ void get_rfc2822_date(char *date, int size, time_t ltime) offset = (-(int) my_timezone()); if (ts->tm_isdst) offset += 3600; - snprintf(date, size - 1, "%s %+03d%02d", buf, (int) (offset / 3600), (int) ((abs((int) offset) / 60) % 60)); + snprintf(date, size - 1, "%s %+03d%02d", buf, (int) (offset / 3600), + (int) ((abs((int) offset) / 60) % 60)); } /*---- Safe malloc wrappers with out of memory checking from GNU ---*/ @@ -704,7 +738,7 @@ static int int_vasprintf(char **result, const char *format, va_list args) { const char *p = format; /* Add one to make sure that it is never zero, which might cause malloc - to return NULL. */ + to return NULL. */ int total_width = strlen(format) + 1; va_list ap; @@ -739,34 +773,34 @@ static int int_vasprintf(char **result, const char *format, va_list args) */ total_width += 30; switch (*p) { - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - case 'c': - (void) va_arg(ap, int); - break; - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - (void) va_arg(ap, double); - /* - * Since an ieee double can have an exponent of 307, we'll - * make the buffer wide enough to cover the gross case. - */ - total_width += 307; - break; - case 's': - total_width += strlen(va_arg(ap, char *)); - break; - case 'p': - case 'n': - (void) va_arg(ap, char *); - break; + case 'd': + case 'i': + case 'o': + case 'u': + case 'x': + case 'X': + case 'c': + (void) va_arg(ap, int); + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + (void) va_arg(ap, double); + /* + * Since an ieee double can have an exponent of 307, we'll + * make the buffer wide enough to cover the gross case. + */ + total_width += 307; + break; + case 's': + total_width += strlen(va_arg(ap, char *)); + break; + case 'p': + case 'n': + (void) va_arg(ap, char *); + break; } p++; } @@ -827,7 +861,7 @@ void eprintf(const char *format, ...) xvasprintf(&msg, format, ap); va_end(ap); - (*printf_handler)(msg); + (*printf_handler) (msg); free(msg); } @@ -835,7 +869,7 @@ void eprintf(const char *format, ...) /* Driver for fputs_handler, drop-in replacement for fputs(buf, fd) */ void efputs(const char *buf) { - (*fputs_handler)(buf); + (*fputs_handler) (buf); } /* Dump with the newline, drop-in replacement for puts(buf) */ @@ -847,7 +881,7 @@ void eputs(const char *buf) strcpy(p, buf); strcat(p, "\n"); - (*fputs_handler)(p); + (*fputs_handler) (p); xfree(p); } @@ -954,7 +988,7 @@ int my_shell(char *cmd, char *result, int size) #ifdef OS_WINNT HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup, - hChildStdoutRd, hChildStdoutWr, hChildStderrRd, hChildStderrWr, hSaveStdin, hSaveStdout, hSaveStderr; + hChildStdoutRd, hChildStdoutWr, hChildStderrRd, hChildStderrWr, hSaveStdin, hSaveStdout, hSaveStderr; SECURITY_ATTRIBUTES saAttr; PROCESS_INFORMATION piProcInfo; @@ -972,38 +1006,38 @@ int my_shell(char *cmd, char *result, int size) /* Create a pipe for the child's STDOUT. */ if (!CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) - return 0; + return 0; /* Set a write handle to the pipe to be STDOUT. */ if (!SetStdHandle(STD_OUTPUT_HANDLE, hChildStdoutWr)) - return 0; + return 0; /* Save the handle to the current STDERR. */ hSaveStderr = GetStdHandle(STD_ERROR_HANDLE); /* Create a pipe for the child's STDERR. */ if (!CreatePipe(&hChildStderrRd, &hChildStderrWr, &saAttr, 0)) - return 0; + return 0; /* Set a read handle to the pipe to be STDERR. */ if (!SetStdHandle(STD_ERROR_HANDLE, hChildStderrWr)) - return 0; + return 0; /* Save the handle to the current STDIN. */ hSaveStdin = GetStdHandle(STD_INPUT_HANDLE); /* Create a pipe for the child's STDIN. */ if (!CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) - return 0; + return 0; /* Set a read handle to the pipe to be STDIN. */ if (!SetStdHandle(STD_INPUT_HANDLE, hChildStdinRd)) - return 0; + return 0; /* Duplicate the write handle to the pipe so it is not inherited. */ - if (!DuplicateHandle(GetCurrentProcess(), hChildStdinWr, GetCurrentProcess(), &hChildStdinWrDup, 0, FALSE, /* not inherited */ - DUPLICATE_SAME_ACCESS)) - return 0; + if (!DuplicateHandle(GetCurrentProcess(), hChildStdinWr, GetCurrentProcess(), &hChildStdinWrDup, 0, FALSE, /* not inherited */ + DUPLICATE_SAME_ACCESS)) + return 0; CloseHandle(hChildStdinWr); @@ -1019,16 +1053,16 @@ int my_shell(char *cmd, char *result, int size) /* command to execute */ sprintf(buffer, "cmd /q /c %s", cmd); - if (!CreateProcess(NULL, buffer, /* command line */ - NULL, /* process security attributes */ - NULL, /* primary thread security attributes */ - TRUE, /* handles are inherited */ - 0, /* creation flags */ - NULL, /* use parent's environment */ - NULL, /* use parent's current directory */ - &siStartInfo, /* STARTUPINFO pointer */ - &piProcInfo)) /* receives PROCESS_INFORMATION */ - return 0; + if (!CreateProcess(NULL, buffer, /* command line */ + NULL, /* process security attributes */ + NULL, /* primary thread security attributes */ + TRUE, /* handles are inherited */ + 0, /* creation flags */ + NULL, /* use parent's environment */ + NULL, /* use parent's current directory */ + &siStartInfo, /* STARTUPINFO pointer */ + &piProcInfo)) /* receives PROCESS_INFORMATION */ + return 0; /* After process creation, restore the saved STDIN and STDOUT. */ SetStdHandle(STD_INPUT_HANDLE, hSaveStdin); @@ -1041,35 +1075,35 @@ int my_shell(char *cmd, char *result, int size) /* query stdout */ do { if (!PeekNamedPipe(hChildStdoutRd, buffer, 256, &dwRead, &dwAvail, NULL)) - break; + break; if (dwRead > 0) { ReadFile(hChildStdoutRd, buffer, 256, &dwRead, NULL); buffer[dwRead] = 0; strlcat(result, buffer, size); } - }while (dwAvail > 0); + } while (dwAvail > 0); /* query stderr */ do { if (!PeekNamedPipe(hChildStderrRd, buffer, 256, &dwRead, &dwAvail, NULL)) - break; + break; if (dwRead > 0) { ReadFile(hChildStderrRd, buffer, 256, &dwRead, NULL); buffer[dwRead] = 0; strlcat(result, buffer, size); } - }while (dwAvail > 0); + } while (dwAvail > 0); /* check if subprocess still alive */ if (!GetExitCodeProcess(piProcInfo.hProcess, &i)) - break; + break; if (i != STILL_ACTIVE) - break; + break; /* give some CPU to subprocess */ Sleep(10); - }while (TRUE); + } while (TRUE); CloseHandle(hChildStdinWrDup); CloseHandle(hChildStdinRd); @@ -1078,7 +1112,7 @@ int my_shell(char *cmd, char *result, int size) /* strip trailing CR/LF */ while (strlen(result) > 0 && (result[strlen(result) - 1] == '\r' || result[strlen(result) - 1] == '\n')) - result[strlen(result) - 1] = 0; + result[strlen(result) - 1] = 0; return 1; @@ -1187,10 +1221,9 @@ void strsubst_list(char *string, int size, char name[][NAME_LENGTH], char value[ /* extract name */ strlcpy(str, p, sizeof(str)); for (j = 0; j < (int) strlen(str); j++) - str[j] = toupper(str[j]) -; + str[j] = toupper(str[j]); /* do shell substituion at the end, so that shell parameter can - contain substituted attributes */ + contain substituted attributes */ if (strncmp(str, "SHELL(", 6) == 0) { strlcpy(pt, "$shell(", sizeof(tmp) - (pt - tmp)); ps += 7; @@ -1202,10 +1235,10 @@ void strsubst_list(char *string, int size, char name[][NAME_LENGTH], char value[ for (i = 0; i < n; i++) { strlcpy(uattr, name[i], sizeof(uattr)); for (j = 0; j < (int) strlen(uattr); j++) - uattr[j] = toupper(uattr[j]); + uattr[j] = toupper(uattr[j]); if (strncmp(str, uattr, strlen(uattr)) == 0) - break; + break; } /* copy value */ @@ -1232,7 +1265,7 @@ void strsubst_list(char *string, int size, char name[][NAME_LENGTH], char value[ /* copy leading characters */ j = (int) (p - ps); if (j >= (int) sizeof(tmp)) - return; + return; memcpy(pt, ps, j); pt += j; p++; @@ -1240,34 +1273,34 @@ void strsubst_list(char *string, int size, char name[][NAME_LENGTH], char value[ /* extract name */ strlcpy(str, p, sizeof(str)); for (j = 0; j < (int) strlen(str); j++) - str[j] = toupper(str[j]); + str[j] = toupper(str[j]); if (strncmp(str, "SHELL(", 6) == 0) { ps += 7; if (strrchr(p, '\"')) { ps += strrchr(p, '\"') - p - 5; if (strchr(ps, ')')) - ps = strchr(ps, ')') + 1; + ps = strchr(ps, ')') + 1; } else { if (strchr(ps, ')')) - ps = strchr(ps, ')') + 1; + ps = strchr(ps, ')') + 1; } if (str[6] == '"') { strcpy(str, p + 7); if (strrchr(str, '\"')) - *strrchr(str, '\"') = 0; + *strrchr(str, '\"') = 0; } else { strcpy(str, p + 6); if (strrchr(str, ')')) - *strrchr(str, ')') = 0; + *strrchr(str, ')') = 0; } if (!enable_execute) { strlcpy(result, loc("Shell execution not enabled via -x flag"), sizeof(result)); eprintf("Shell execution not enabled via -x flag.\n"); } else - my_shell(str, result, sizeof(result)); + my_shell(str, result, sizeof(result)); strlcpy(pt, result, sizeof(tmp) - (pt - tmp)); pt += strlen(pt); @@ -1440,7 +1473,7 @@ void stou(char *str) int i; for (i = 0; i < (int) strlen(str); i++) - if (str[i] == ' ' || str[i] == '.' || str[i] == '/' || + if (str[i] == ' ' || str[i] == '.' || str[i] == '/' || str[i] == '\\' || str[i] == '-' || str[i] == '(' || str[i] == ')') str[i] = '_'; } @@ -1566,9 +1599,9 @@ void do_crypt(char *s, char *d, int size) \*------------------------------------------------------------------*/ typedef struct { - unsigned int state[4]; // state (ABCD) - unsigned int count[2]; // number of bits, modulo 2^64 (lsb first) - unsigned char buffer[64]; // input buffer + unsigned int state[4]; // state (ABCD) + unsigned int count[2]; // number of bits, modulo 2^64 (lsb first) + unsigned char buffer[64]; // input buffer } MD5_CONTEXT; /*------------------------------------------------------------------*/ @@ -1623,8 +1656,9 @@ void MD5_checksum(const void *pdata, unsigned int len, unsigned char digest[16]) /* to allow multithreading we have to locate the padding memory here */ unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + }; memset(&ctx, 0, sizeof(MD5_CONTEXT)); ctx.count[0] = ctx.count[1] = 0; @@ -1698,76 +1732,76 @@ void _MD5_transform(unsigned int state[4], unsigned char block[64]) _MD5_decode(x, block, 64); /* round 1 */ - FF(lA, lB, lC, lD, x[0], 7, 0xd76aa478); // 1 - FF(lD, lA, lB, lC, x[1], 12, 0xe8c7b756); // 2 - FF(lC, lD, lA, lB, x[2], 17, 0x242070db); // 3 - FF(lB, lC, lD, lA, x[3], 22, 0xc1bdceee); // 4 - FF(lA, lB, lC, lD, x[4], 7, 0xf57c0faf); // 5 - FF(lD, lA, lB, lC, x[5], 12, 0x4787c62a); // 6 - FF(lC, lD, lA, lB, x[6], 17, 0xa8304613); // 7 - FF(lB, lC, lD, lA, x[7], 22, 0xfd469501); // 8 - FF(lA, lB, lC, lD, x[8], 7, 0x698098d8); // 9 - FF(lD, lA, lB, lC, x[9], 12, 0x8b44f7af); // 10 - FF(lC, lD, lA, lB, x[10], 17, 0xffff5bb1); // 11 - FF(lB, lC, lD, lA, x[11], 22, 0x895cd7be); // 12 - FF(lA, lB, lC, lD, x[12], 7, 0x6b901122); // 13 - FF(lD, lA, lB, lC, x[13], 12, 0xfd987193); // 14 - FF(lC, lD, lA, lB, x[14], 17, 0xa679438e); // 15 - FF(lB, lC, lD, lA, x[15], 22, 0x49b40821); // 16 + FF(lA, lB, lC, lD, x[0], 7, 0xd76aa478); // 1 + FF(lD, lA, lB, lC, x[1], 12, 0xe8c7b756); // 2 + FF(lC, lD, lA, lB, x[2], 17, 0x242070db); // 3 + FF(lB, lC, lD, lA, x[3], 22, 0xc1bdceee); // 4 + FF(lA, lB, lC, lD, x[4], 7, 0xf57c0faf); // 5 + FF(lD, lA, lB, lC, x[5], 12, 0x4787c62a); // 6 + FF(lC, lD, lA, lB, x[6], 17, 0xa8304613); // 7 + FF(lB, lC, lD, lA, x[7], 22, 0xfd469501); // 8 + FF(lA, lB, lC, lD, x[8], 7, 0x698098d8); // 9 + FF(lD, lA, lB, lC, x[9], 12, 0x8b44f7af); // 10 + FF(lC, lD, lA, lB, x[10], 17, 0xffff5bb1); // 11 + FF(lB, lC, lD, lA, x[11], 22, 0x895cd7be); // 12 + FF(lA, lB, lC, lD, x[12], 7, 0x6b901122); // 13 + FF(lD, lA, lB, lC, x[13], 12, 0xfd987193); // 14 + FF(lC, lD, lA, lB, x[14], 17, 0xa679438e); // 15 + FF(lB, lC, lD, lA, x[15], 22, 0x49b40821); // 16 /* round 2 */ - GG(lA, lB, lC, lD, x[1], 5, 0xf61e2562); // 17 - GG(lD, lA, lB, lC, x[6], 9, 0xc040b340); // 18 - GG(lC, lD, lA, lB, x[11], 14, 0x265e5a51); // 19 - GG(lB, lC, lD, lA, x[0], 20, 0xe9b6c7aa); // 20 - GG(lA, lB, lC, lD, x[5], 5, 0xd62f105d); // 21 - GG(lD, lA, lB, lC, x[10], 9, 0x2441453); // 22 - GG(lC, lD, lA, lB, x[15], 14, 0xd8a1e681); // 23 - GG(lB, lC, lD, lA, x[4], 20, 0xe7d3fbc8); // 24 - GG(lA, lB, lC, lD, x[9], 5, 0x21e1cde6); // 25 - GG(lD, lA, lB, lC, x[14], 9, 0xc33707d6); // 26 - GG(lC, lD, lA, lB, x[3], 14, 0xf4d50d87); // 27 - GG(lB, lC, lD, lA, x[8], 20, 0x455a14ed); // 28 - GG(lA, lB, lC, lD, x[13], 5, 0xa9e3e905); // 29 - GG(lD, lA, lB, lC, x[2], 9, 0xfcefa3f8); // 30 - GG(lC, lD, lA, lB, x[7], 14, 0x676f02d9); // 31 - GG(lB, lC, lD, lA, x[12], 20, 0x8d2a4c8a); // 32 + GG(lA, lB, lC, lD, x[1], 5, 0xf61e2562); // 17 + GG(lD, lA, lB, lC, x[6], 9, 0xc040b340); // 18 + GG(lC, lD, lA, lB, x[11], 14, 0x265e5a51); // 19 + GG(lB, lC, lD, lA, x[0], 20, 0xe9b6c7aa); // 20 + GG(lA, lB, lC, lD, x[5], 5, 0xd62f105d); // 21 + GG(lD, lA, lB, lC, x[10], 9, 0x2441453); // 22 + GG(lC, lD, lA, lB, x[15], 14, 0xd8a1e681); // 23 + GG(lB, lC, lD, lA, x[4], 20, 0xe7d3fbc8); // 24 + GG(lA, lB, lC, lD, x[9], 5, 0x21e1cde6); // 25 + GG(lD, lA, lB, lC, x[14], 9, 0xc33707d6); // 26 + GG(lC, lD, lA, lB, x[3], 14, 0xf4d50d87); // 27 + GG(lB, lC, lD, lA, x[8], 20, 0x455a14ed); // 28 + GG(lA, lB, lC, lD, x[13], 5, 0xa9e3e905); // 29 + GG(lD, lA, lB, lC, x[2], 9, 0xfcefa3f8); // 30 + GG(lC, lD, lA, lB, x[7], 14, 0x676f02d9); // 31 + GG(lB, lC, lD, lA, x[12], 20, 0x8d2a4c8a); // 32 /* round 3 */ - HH(lA, lB, lC, lD, x[5], 4, 0xfffa3942); // 33 - HH(lD, lA, lB, lC, x[8], 11, 0x8771f681); // 34 - HH(lC, lD, lA, lB, x[11], 16, 0x6d9d6122); // 35 - HH(lB, lC, lD, lA, x[14], 23, 0xfde5380c); // 36 - HH(lA, lB, lC, lD, x[1], 4, 0xa4beea44); // 37 - HH(lD, lA, lB, lC, x[4], 11, 0x4bdecfa9); // 38 - HH(lC, lD, lA, lB, x[7], 16, 0xf6bb4b60); // 39 - HH(lB, lC, lD, lA, x[10], 23, 0xbebfbc70); // 40 - HH(lA, lB, lC, lD, x[13], 4, 0x289b7ec6); // 41 - HH(lD, lA, lB, lC, x[0], 11, 0xeaa127fa); // 42 - HH(lC, lD, lA, lB, x[3], 16, 0xd4ef3085); // 43 - HH(lB, lC, lD, lA, x[6], 23, 0x4881d05); // 44 - HH(lA, lB, lC, lD, x[9], 4, 0xd9d4d039); // 45 - HH(lD, lA, lB, lC, x[12], 11, 0xe6db99e5); // 46 - HH(lC, lD, lA, lB, x[15], 16, 0x1fa27cf8); // 47 - HH(lB, lC, lD, lA, x[2], 23, 0xc4ac5665); // 48 + HH(lA, lB, lC, lD, x[5], 4, 0xfffa3942); // 33 + HH(lD, lA, lB, lC, x[8], 11, 0x8771f681); // 34 + HH(lC, lD, lA, lB, x[11], 16, 0x6d9d6122); // 35 + HH(lB, lC, lD, lA, x[14], 23, 0xfde5380c); // 36 + HH(lA, lB, lC, lD, x[1], 4, 0xa4beea44); // 37 + HH(lD, lA, lB, lC, x[4], 11, 0x4bdecfa9); // 38 + HH(lC, lD, lA, lB, x[7], 16, 0xf6bb4b60); // 39 + HH(lB, lC, lD, lA, x[10], 23, 0xbebfbc70); // 40 + HH(lA, lB, lC, lD, x[13], 4, 0x289b7ec6); // 41 + HH(lD, lA, lB, lC, x[0], 11, 0xeaa127fa); // 42 + HH(lC, lD, lA, lB, x[3], 16, 0xd4ef3085); // 43 + HH(lB, lC, lD, lA, x[6], 23, 0x4881d05); // 44 + HH(lA, lB, lC, lD, x[9], 4, 0xd9d4d039); // 45 + HH(lD, lA, lB, lC, x[12], 11, 0xe6db99e5); // 46 + HH(lC, lD, lA, lB, x[15], 16, 0x1fa27cf8); // 47 + HH(lB, lC, lD, lA, x[2], 23, 0xc4ac5665); // 48 /* round 4 */ - II(lA, lB, lC, lD, x[0], 6, 0xf4292244); // 49 - II(lD, lA, lB, lC, x[7], 10, 0x432aff97); // 50 - II(lC, lD, lA, lB, x[14], 15, 0xab9423a7); // 51 - II(lB, lC, lD, lA, x[5], 21, 0xfc93a039); // 52 - II(lA, lB, lC, lD, x[12], 6, 0x655b59c3); // 53 - II(lD, lA, lB, lC, x[3], 10, 0x8f0ccc92); // 54 - II(lC, lD, lA, lB, x[10], 15, 0xffeff47d); // 55 - II(lB, lC, lD, lA, x[1], 21, 0x85845dd1); // 56 - II(lA, lB, lC, lD, x[8], 6, 0x6fa87e4f); // 57 - II(lD, lA, lB, lC, x[15], 10, 0xfe2ce6e0); // 58 - II(lC, lD, lA, lB, x[6], 15, 0xa3014314); // 59 - II(lB, lC, lD, lA, x[13], 21, 0x4e0811a1); // 60 - II(lA, lB, lC, lD, x[4], 6, 0xf7537e82); // 61 - II(lD, lA, lB, lC, x[11], 10, 0xbd3af235); // 62 - II(lC, lD, lA, lB, x[2], 15, 0x2ad7d2bb); // 63 - II(lB, lC, lD, lA, x[9], 21, 0xeb86d391); // 64 + II(lA, lB, lC, lD, x[0], 6, 0xf4292244); // 49 + II(lD, lA, lB, lC, x[7], 10, 0x432aff97); // 50 + II(lC, lD, lA, lB, x[14], 15, 0xab9423a7); // 51 + II(lB, lC, lD, lA, x[5], 21, 0xfc93a039); // 52 + II(lA, lB, lC, lD, x[12], 6, 0x655b59c3); // 53 + II(lD, lA, lB, lC, x[3], 10, 0x8f0ccc92); // 54 + II(lC, lD, lA, lB, x[10], 15, 0xffeff47d); // 55 + II(lB, lC, lD, lA, x[1], 21, 0x85845dd1); // 56 + II(lA, lB, lC, lD, x[8], 6, 0x6fa87e4f); // 57 + II(lD, lA, lB, lC, x[15], 10, 0xfe2ce6e0); // 58 + II(lC, lD, lA, lB, x[6], 15, 0xa3014314); // 59 + II(lB, lC, lD, lA, x[13], 21, 0x4e0811a1); // 60 + II(lA, lB, lC, lD, x[4], 6, 0xf7537e82); // 61 + II(lD, lA, lB, lC, x[11], 10, 0xbd3af235); // 62 + II(lC, lD, lA, lB, x[2], 15, 0x2ad7d2bb); // 63 + II(lB, lC, lD, lA, x[9], 21, 0xeb86d391); // 64 state[0] += lA; state[1] += lB; @@ -1804,7 +1838,8 @@ void _MD5_decode(unsigned int *pout, unsigned char *pin, unsigned int len) for (i = 0, j = 0; j < len; i++, j += 4) pout[i] = ((unsigned int) pin[j]) | (((unsigned int) pin[j + 1]) << 8) | (((unsigned int) pin[j + 2]) - << 16) | (((unsigned int) pin[j + 3]) << 24); + << 16) | (((unsigned int) + pin[j + 3]) << 24); } /*------------------------------------------------------------------*/ @@ -1846,8 +1881,13 @@ double date2serialdate(int day, int month, int year) int serialdate; serialdate = (int) ((1461 * (year + 4800 + (int) ((month - 14) / 12))) / 4) + (int) ((367 * (month - 2 - - 12 * ((month - 14) / 12))) / 12) - (int) ((3 * ((int) ((year + 4900 + (int) ((month - 14) / 12)) - / 100))) / 4) + day - 2415019 - 32075; + - + 12 * + ((month - + 14) / + 12))) / 12) - + (int) ((3 * ((int) ((year + 4900 + (int) ((month - 14) / 12)) + / 100))) / 4) + day - 2415019 - 32075; return serialdate; } @@ -1868,8 +1908,7 @@ int setegroup(char *str) else { eprintf("Cannot set effective GID to group \"%s\"\n", gr->gr_name); eprintf("setgroup: %s\n", strerror(errno)); - } - else + } else eprintf("Group \"%s\" not found\n", str); return -1; @@ -1892,8 +1931,7 @@ int seteuser(char *str) } else { eprintf("Cannot set effective UID to user \"%s\"\n", str); eprintf("setuser: %s\n", strerror(errno)); - } - else + } else eprintf("User \"%s\" not found\n", str); return -1; @@ -1916,8 +1954,7 @@ int setgroup(char *str) else { eprintf("Cannot set effective GID to group \"%s\"\n", gr->gr_name); eprintf("setgroup: %s\n", strerror(errno)); - } - else + } else eprintf("Group \"%s\" not found\n", str); return -1; @@ -1940,8 +1977,7 @@ int setuser(char *str) else { eprintf("Cannot set effective UID to user \"%s\"\n", str); eprintf("setuser: %s\n", strerror(errno)); - } - else + } else eprintf("User \"%s\" not found\n", str); return -1; @@ -1993,7 +2029,8 @@ int recv_string(int sock, char *buffer, int buffer_size, int millisec) /*-------------------------------------------------------------------*/ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, char *url, char *mail_text, - int size, int mail_encoding, int n_attachments, char *multipart_boundary, int message_id, int reply_id) + int size, int mail_encoding, int n_attachments, char *multipart_boundary, + int message_id, int reply_id) { char buffer[256], charset[256], subject_enc[5000]; char buf[80], str[256]; @@ -2028,7 +2065,7 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, ch efputs(str); } snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "Date: %s %+03d%02d\r\n", buf, - (int) (offset / 3600), (int) ((abs((int) offset) / 60) % 60)); + (int) (offset / 3600), (int) ((abs((int) offset) / 60) % 60)); getcfg("global", "Language", str, sizeof(str)); if (str[0]) @@ -2044,8 +2081,8 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, ch strlcat(mail_text, "\r\n", size); snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "From: %s\r\n", from); - snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "User-Agent: Elog Version %s\r\n", - VERSION); + snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "User-Agent: Elog Version %s\r\n", + VERSION); if (multipart) strlcat(mail_text, "MIME-Version: 1.0\r\n", size); @@ -2065,12 +2102,12 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, ch strlcat(subject_enc, charset, sizeof(subject_enc)); strlcat(subject_enc, "?B?", sizeof(subject_enc)); base64_encode((unsigned char *) buffer, (unsigned char *) (subject_enc + strlen(subject_enc)), - sizeof(subject_enc) - strlen(subject_enc)); + sizeof(subject_enc) - strlen(subject_enc)); strlcat(subject_enc, "?=", sizeof(subject_enc)); if (strlen(subject + i) < 40) break; - strlcat(subject_enc, "\r\n ", sizeof(subject_enc)); // another encoded-word + strlcat(subject_enc, "\r\n ", sizeof(subject_enc)); // another encoded-word } } else strlcpy(subject_enc, subject, sizeof(subject_enc)); @@ -2086,10 +2123,10 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, ch if (message_id) snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "Message-ID: <%s-%d@%s>\r\n", - lbs->name_enc, message_id, str); + lbs->name_enc, message_id, str); if (reply_id) snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "In-Reply-To: <%s-%d@%s>\r\n", - lbs->name_enc, reply_id, str); + lbs->name_enc, reply_id, str); if (url) snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, "X-Elog-URL: %s\r\n", url); @@ -2100,14 +2137,14 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, ch sprintf(multipart_boundary, "------------%04X%04X%04X", rand(), rand(), rand()); snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, - "Content-Type: multipart/alternative;\r\n boundary=\"%s\"\r\n\r\n", multipart_boundary); + "Content-Type: multipart/alternative;\r\n boundary=\"%s\"\r\n\r\n", multipart_boundary); strlcat(mail_text, "This is a multi-part message in MIME format.\r\n", size); } else { if (n_attachments) { sprintf(multipart_boundary, "------------%04X%04X%04X", rand(), rand(), rand()); snprintf(mail_text + strlen(mail_text), size - strlen(mail_text) - 1, - "Content-Type: multipart/mixed;\r\n boundary=\"%s\"\r\n\r\n", multipart_boundary); + "Content-Type: multipart/mixed;\r\n boundary=\"%s\"\r\n\r\n", multipart_boundary); strlcat(mail_text, "This is a multi-part message in MIME format.\r\n", size); } else { @@ -2374,7 +2411,7 @@ int sendmail(LOGBOOK * lbs, char *smtp_host, char *from, char *to, char *text, c xfree(str); return 1; - smtp_error: + smtp_error: closesocket(s); xfree(str); @@ -2460,7 +2497,7 @@ int retrieve_url(const char *url, char **buffer, char *rpwd) sock = 0; } - if (sock) { // keep-alive does not yet work, requires evaluation of Content-Length !!! + if (sock) { // keep-alive does not yet work, requires evaluation of Content-Length !!! closesocket(sock); sock = 0; } @@ -2528,7 +2565,7 @@ int retrieve_url(const char *url, char **buffer, char *rpwd) FD_ZERO(&readfds); FD_SET(sock, &readfds); - timeout.tv_sec = 30; /* 30 sec. timeout */ + timeout.tv_sec = 30; /* 30 sec. timeout */ timeout.tv_usec = 0; select(FD_SETSIZE, (void *) &readfds, NULL, NULL, (void *) &timeout); @@ -2575,12 +2612,12 @@ int ss_daemon_init() if ((pid = fork()) < 0) return FAILURE; else if (pid != 0) - _exit(EXIT_SUCCESS); /* parent finished, exit without atexit hook */ + _exit(EXIT_SUCCESS); /* parent finished, exit without atexit hook */ /* child continues here */ /* try and use up stdin, stdout and stderr, so other - routines writing to stdout etc won't cause havoc. Copied from smbd */ + routines writing to stdout etc won't cause havoc. Copied from smbd */ for (i = 0; i < 3; i++) { close(i); fd = open("/dev/null", O_RDWR, 0); @@ -2596,9 +2633,9 @@ int ss_daemon_init() } } - setsid(); /* become session leader */ - chdir("/"); /* change working direcotry (not on NFS!) */ - umask(0); /* clear our file mode creation mask */ + setsid(); /* become session leader */ + chdir("/"); /* change working direcotry (not on NFS!) */ + umask(0); /* clear our file mode creation mask */ #endif @@ -2621,7 +2658,7 @@ typedef struct { CONFIG_PARAM *config_param; } LB_CONFIG; -LB_CONFIG *lb_config= NULL; +LB_CONFIG *lb_config = NULL; int n_lb_config = 0; char _topgroup[256]; @@ -2875,16 +2912,15 @@ int parse_config_file(char *file_name) lb_config[n_lb_config].config_param = xmalloc(sizeof(CONFIG_PARAM)); else lb_config[n_lb_config].config_param = xrealloc(lb_config[n_lb_config].config_param, - sizeof(CONFIG_PARAM) * (lb_config[n_lb_config].n_params + 1)); + sizeof(CONFIG_PARAM) * + (lb_config[n_lb_config].n_params + 1)); lb_config[n_lb_config].config_param[i].param = xmalloc(strlen(str) + 1); lb_config[n_lb_config].config_param[i].uparam = xmalloc(strlen(str) + 1); strcpy(lb_config[n_lb_config].config_param[i].param, str); for (j = 0; j < (int) strlen(str); j++) - lb_config[n_lb_config].config_param[i].uparam[j] = - toupper(str[j]) -; - lb_config[n_lb_config].config_param[i].uparam[j] = 0; + lb_config[n_lb_config].config_param[i].uparam[j] = toupper(str[j]); + lb_config[n_lb_config].config_param[i].uparam[j] = 0; p++; while (*p == ' ' || *p == '\t') @@ -3133,7 +3169,7 @@ int exist_top_group() /*-------------------------------------------------------------------*/ -char *_locbuffer= NULL; +char *_locbuffer = NULL; char **_porig, **_ptrans; time_t _locfile_mtime = 0; @@ -3516,7 +3552,7 @@ void el_enum_attr(char *message, int n, char *attr_name, char *attr_value) p = strchr(p, '\n'); if (!p) { - str[0] = 0; /* not a valid line */ + str[0] = 0; /* not a valid line */ break; } while (*p == '\n' || *p == '\r') @@ -3527,8 +3563,8 @@ void el_enum_attr(char *message, int n, char *attr_name, char *attr_value) *strchr(tmp, ':') = 0; if (strieq(tmp, "$@MID@$") || strieq(tmp, "Date") || strieq(tmp, "Attachment") || strieq(tmp, - "Reply To") || strieq(tmp, "In Reply To") || strieq(tmp, "Encoding") || strieq(tmp, - "Locked by")) + "Reply To") + || strieq(tmp, "In Reply To") || strieq(tmp, "Encoding") || strieq(tmp, "Locked by")) i--; } } @@ -3556,36 +3592,36 @@ int fnmatch1(const char *pattern, const char *string) for (stringstart = string;;) switch (c = *pattern++) { - case EOS: - return (*string == EOS ? 0 : 1); - case '?': - if (*string == EOS) - return (1); - ++string; - break; - case '*': - c = *pattern; - /* Collapse multiple stars. */ - while (c == '*') - c = *++pattern; - - /* Optimize for pattern with * at end or before /. */ - if (c == EOS) - return (0); - - /* General case, use recursion. */ - while ((test = *string) != EOS) { - if (!fnmatch1(pattern, string)) - return (0); - ++string; - } + case EOS: + return (*string == EOS ? 0 : 1); + case '?': + if (*string == EOS) return (1); - /* FALLTHROUGH */ - default: - if (c != *string) - return (1); - string++; - break; + ++string; + break; + case '*': + c = *pattern; + /* Collapse multiple stars. */ + while (c == '*') + c = *++pattern; + + /* Optimize for pattern with * at end or before /. */ + if (c == EOS) + return (0); + + /* General case, use recursion. */ + while ((test = *string) != EOS) { + if (!fnmatch1(pattern, string)) + return (0); + ++string; + } + return (1); + /* FALLTHROUGH */ + default: + if (c != *string) + return (1); + string++; + break; } } @@ -3645,7 +3681,7 @@ int ss_file_find(char *path, char *pattern, char **plist) *plist = (char *) xmalloc(MAX_PATH_LENGTH); pffile = FindFirstFile(str, lpfdata); if (pffile == INVALID_HANDLE_VALUE) - return 0; + return 0; first = 0; *plist = (char *) xrealloc(*plist, (i + 1) * MAX_PATH_LENGTH); strncpy(*plist + (i * MAX_PATH_LENGTH), lpfdata->cFileName, strlen(lpfdata->cFileName)); @@ -3680,7 +3716,7 @@ int el_build_index(LOGBOOK * lbs, BOOL rebuild) /* scan all ??????a.log files and build an index table in eli[] */ { char *file_list, str[256], error_str[256], date[256], dir[256], file_name[MAX_PATH_LENGTH], *buffer, *p, - *pn, in_reply_to[80]; + *pn, in_reply_to[80]; int index, n, length; int i, fh, len; unsigned char digest[16]; @@ -3806,8 +3842,8 @@ int el_build_index(LOGBOOK * lbs, BOOL rebuild) if (lbs->el_index[*lbs->n_el_index].message_id > 0) { if (verbose > 1) { eprintf(" ID %3d, %s, ofs %5d, %s, MD5=", lbs->el_index[*lbs->n_el_index].message_id, - str, lbs->el_index[*lbs->n_el_index].offset, - lbs->el_index[*lbs->n_el_index].in_reply_to ? "reply" : "thead"); + str, lbs->el_index[*lbs->n_el_index].offset, + lbs->el_index[*lbs->n_el_index].in_reply_to ? "reply" : "thead"); for (i = 0; i < 16; i++) eprintf("%02X", lbs->el_index[*lbs->n_el_index].md5_digest[i]); @@ -3837,7 +3873,7 @@ int el_build_index(LOGBOOK * lbs, BOOL rebuild) eprintf("After sort:\n"); for (i = 0; i < *lbs->n_el_index; i++) eprintf(" ID %3d, %s, ofs %5d\n", lbs->el_index[i].message_id, lbs->el_index[i].file_name, - lbs->el_index[i].offset); + lbs->el_index[i].offset); } return EL_SUCCESS; @@ -3918,7 +3954,7 @@ int el_index_logbooks() else strlcat(data_dir, str, sizeof(data_dir)); } else - strlcat(data_dir, logbook, sizeof(data_dir)); /* use logbook name as default */ + strlcat(data_dir, logbook, sizeof(data_dir)); /* use logbook name as default */ } if (data_dir[strlen(data_dir) - 1] != DIR_SEPARATOR) @@ -4078,10 +4114,10 @@ int el_search_message(LOGBOOK * lbs, int mode, int message_id, BOOL head_only) break; if (i == *lbs->n_el_index) - return 0; // message not found + return 0; // message not found if (i == *lbs->n_el_index - 1) - return 0; // last message + return 0; // last message if (head_only) { for (i++; i < *lbs->n_el_index; i++) @@ -4100,10 +4136,10 @@ int el_search_message(LOGBOOK * lbs, int mode, int message_id, BOOL head_only) break; if (i == *lbs->n_el_index) - return 0; // message not found + return 0; // message not found if (i == 0) - return 0; // first message + return 0; // first message if (head_only) { for (i--; i >= 0; i--) @@ -4122,8 +4158,9 @@ int el_search_message(LOGBOOK * lbs, int mode, int message_id, BOOL head_only) /*------------------------------------------------------------------*/ int el_retrieve(LOGBOOK * lbs, int message_id, char *date, char attr_list[MAX_N_ATTR][NAME_LENGTH], - char attrib[MAX_N_ATTR][NAME_LENGTH], int n_attr, char *text, int *textsize, char *in_reply_to, - char *reply_to, char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], char *encoding, char *locked_by) + char attrib[MAX_N_ATTR][NAME_LENGTH], int n_attr, char *text, int *textsize, + char *in_reply_to, char *reply_to, char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], + char *encoding, char *locked_by) /******************************************************************** Routine: el_retrieve @@ -4180,7 +4217,7 @@ int el_retrieve(LOGBOOK * lbs, int message_id, char *date, char attr_list[MAX_N_ /* file might have been deleted, rebuild index */ el_build_index(lbs, TRUE); return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr, text, textsize, in_reply_to, - reply_to, attachment, encoding, locked_by); + reply_to, attachment, encoding, locked_by); } message = xmalloc(TEXT_SIZE + 1000); @@ -4201,7 +4238,7 @@ int el_retrieve(LOGBOOK * lbs, int message_id, char *date, char attr_list[MAX_N_ /* file might have been edited, rebuild index */ el_build_index(lbs, TRUE); return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr, text, textsize, in_reply_to, - reply_to, attachment, encoding, locked_by); + reply_to, attachment, encoding, locked_by); } /* check for correct ID */ @@ -4311,7 +4348,7 @@ int el_retrieve(LOGBOOK * lbs, int message_id, char *date, char attr_list[MAX_N_ /*------------------------------------------------------------------*/ int el_submit_attachment(LOGBOOK * lbs, const char *afilename, const char *buffer, int buffer_size, - char *full_name) + char *full_name) { char file_name[MAX_PATH_LENGTH], ext_file_name[MAX_PATH_LENGTH + 100], str[MAX_PATH_LENGTH], *p; int fh; @@ -4324,9 +4361,9 @@ int el_submit_attachment(LOGBOOK * lbs, const char *afilename, const char *buffe while (strchr(p, ':')) p = strchr(p, ':') + 1; while (strchr(p, '\\')) - p = strchr(p, '\\') + 1; /* NT */ + p = strchr(p, '\\') + 1; /* NT */ while (strchr(p, '/')) - p = strchr(p, '/') + 1; /* Unix */ + p = strchr(p, '/') + 1; /* Unix */ strlcpy(file_name, p, sizeof(file_name)); /* assemble ELog filename */ @@ -4339,7 +4376,7 @@ int el_submit_attachment(LOGBOOK * lbs, const char *afilename, const char *buffe memcpy(&tms, localtime(&now), sizeof(struct tm)); sprintf(ext_file_name, "%02d%02d%02d_%02d%02d%02d_%s", tms.tm_year % 100, tms.tm_mon + 1, - tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec, file_name); + tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec, file_name); } if (full_name) @@ -4476,8 +4513,9 @@ int el_retrieve_attachment(LOGBOOK * lbs, int message_id, int n, char name[MAX_P /*------------------------------------------------------------------*/ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_name[MAX_N_ATTR][NAME_LENGTH], - char attr_value[MAX_N_ATTR][NAME_LENGTH], int n_attr, char *text, char *in_reply_to, char *reply_to, - char *encoding, char afilename[MAX_ATTACHMENTS][256], BOOL mark_original, char *locked_by) + char attr_value[MAX_N_ATTR][NAME_LENGTH], int n_attr, char *text, char *in_reply_to, + char *reply_to, char *encoding, char afilename[MAX_ATTACHMENTS][256], BOOL mark_original, + char *locked_by) /******************************************************************** Routine: el_submit @@ -4510,8 +4548,8 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n { int n, i, j, size, fh, index, tail_size, orig_size, delta, reply_id; char file_name[256], dir[256], str[NAME_LENGTH], date1[256], attrib[MAX_N_ATTR][NAME_LENGTH], - reply_to1[MAX_REPLY_TO * 10], in_reply_to1[MAX_REPLY_TO * 10], encoding1[80], *message, *p, - *old_text, *buffer; + reply_to1[MAX_REPLY_TO * 10], in_reply_to1[MAX_REPLY_TO * 10], encoding1[80], *message, *p, + *old_text, *buffer; char attachment_all[64 * MAX_ATTACHMENTS]; time_t ltime; @@ -4559,7 +4597,7 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n /* file might have been edited, rebuild index */ el_build_index(lbs, TRUE); return el_submit(lbs, message_id, bedit, date, attr_name, attrib, n_attr, text, in_reply_to, - reply_to, encoding, afilename, mark_original, locked_by); + reply_to, encoding, afilename, mark_original, locked_by); } /* check for correct ID */ @@ -4746,7 +4784,7 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n break; for (j = i + 1; j < *lbs->n_el_index && strieq(lbs->el_index[i].file_name, - lbs->el_index[j].file_name); j++) + lbs->el_index[j].file_name); j++) lbs->el_index[j].offset += delta; } @@ -4761,12 +4799,12 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n if (mark_original && in_reply_to[0] && !bedit && atoi(in_reply_to) > 0) { char date[80], attr[MAX_N_ATTR][NAME_LENGTH], enc[80], att[MAX_ATTACHMENTS][256], - reply_to[MAX_REPLY_TO * 10], in_reply_to[MAX_REPLY_TO * 10], lock[256]; + reply_to[MAX_REPLY_TO * 10], in_reply_to[MAX_REPLY_TO * 10], lock[256]; /* retrieve original message */ size = TEXT_SIZE + 100; el_retrieve(lbs, reply_id, date, attr_list, attr, n_attr, message, &size, in_reply_to, reply_to, att, - enc, lock); + enc, lock); if (reply_to[0]) strcat(reply_to, ", "); @@ -4774,7 +4812,7 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n /* write modified message */ el_submit(lbs, reply_id, TRUE, date, attr_list, attr, n_attr, message, in_reply_to, reply_to, enc, att, - TRUE, lock); + TRUE, lock); } xfree(message); @@ -4786,14 +4824,14 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n void remove_reference(LOGBOOK * lbs, int message_id, int remove_id, BOOL reply_to_flag) { char date[80], attr[MAX_N_ATTR][NAME_LENGTH], enc[80], in_reply_to[80], reply_to[MAX_REPLY_TO * 10], - att[MAX_ATTACHMENTS][256], lock[256], *p, *ps, *message; + att[MAX_ATTACHMENTS][256], lock[256], *p, *ps, *message; int size, status; /* retrieve original message */ size = TEXT_SIZE + 1000; message = xmalloc(size); status = el_retrieve(lbs, message_id, date, attr_list, attr, lbs->n_attr, message, &size, in_reply_to, - reply_to, att, enc, lock); + reply_to, att, enc, lock); if (status != EL_SUCCESS) return; @@ -4822,7 +4860,7 @@ void remove_reference(LOGBOOK * lbs, int message_id, int remove_id, BOOL reply_t /* write modified message */ el_submit(lbs, message_id, TRUE, date, attr_list, attr, lbs->n_attr, message, in_reply_to, reply_to, enc, - att, TRUE, lock); + att, TRUE, lock); xfree(message); } @@ -4830,7 +4868,8 @@ void remove_reference(LOGBOOK * lbs, int message_id, int remove_id, BOOL reply_t /*------------------------------------------------------------------*/ int el_delete_message(LOGBOOK * lbs, int message_id, BOOL delete_attachments, - char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], BOOL delete_bw_ref, BOOL delete_reply_to) + char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], BOOL delete_bw_ref, + BOOL delete_reply_to) /******************************************************************** Routine: el_delete_message @@ -4893,7 +4932,7 @@ int el_delete_message(LOGBOOK * lbs, int message_id, BOOL delete_attachments, /* file might have been edited, rebuild index */ el_build_index(lbs, TRUE); return el_delete_message(lbs, message_id, delete_attachments, attachment, delete_bw_ref, - delete_reply_to); + delete_reply_to); } /* check for correct ID */ @@ -5041,14 +5080,14 @@ int el_correct_links(LOGBOOK * lbs, int old_id, int new_id) att_file = xmalloc(MAX_ATTACHMENTS * 256); el_retrieve(lbs, new_id, date, attr_list, (void *) attrib, lbs->n_attr, NULL, 0, in_reply_to, reply_to, - (void *) att_file, encoding, locked_by); + (void *) att_file, encoding, locked_by); /* go through in_reply_to list */ n = strbreak(in_reply_to, list, MAX_N_ATTR, ",", FALSE); for (i = 0; i < n; i++) { size = TEXT_SIZE; el_retrieve(lbs, atoi(list[i]), date, attr_list, (void *) attrib, lbs->n_attr, text, &size, - in_reply_to, reply_to, (void *) att_file, encoding, locked_by); + in_reply_to, reply_to, (void *) att_file, encoding, locked_by); n1 = strbreak(reply_to, list1, MAX_N_ATTR, ",", FALSE); reply_to[0] = 0; @@ -5064,18 +5103,18 @@ int el_correct_links(LOGBOOK * lbs, int old_id, int new_id) } el_submit(lbs, atoi(list[i]), TRUE, date, attr_list, (void *) attrib, lbs->n_attr, text, in_reply_to, - reply_to, encoding, (void *) att_file, TRUE, locked_by); + reply_to, encoding, (void *) att_file, TRUE, locked_by); } el_retrieve(lbs, new_id, date, attr_list, (void *) attrib, lbs->n_attr, NULL, 0, in_reply_to, reply_to, - (void *) att_file, encoding, locked_by); + (void *) att_file, encoding, locked_by); /* go through reply_to list */ n = strbreak(reply_to, list, MAX_N_ATTR, ",", FALSE); for (i = 0; i < n; i++) { size = sizeof(text); el_retrieve(lbs, atoi(list[i]), date, attr_list, (void *) attrib, lbs->n_attr, text, &size, - in_reply_to, reply_to, (void *) att_file, encoding, locked_by); + in_reply_to, reply_to, (void *) att_file, encoding, locked_by); n1 = strbreak(in_reply_to, list1, MAX_N_ATTR, ",", FALSE); in_reply_to[0] = 0; @@ -5091,7 +5130,7 @@ int el_correct_links(LOGBOOK * lbs, int old_id, int new_id) } el_submit(lbs, atoi(list[i]), TRUE, date, attr_list, (void *) attrib, lbs->n_attr, text, in_reply_to, - reply_to, encoding, (void *) att_file, TRUE, locked_by); + reply_to, encoding, (void *) att_file, TRUE, locked_by); } xfree(text); @@ -5107,7 +5146,7 @@ int el_move_message_thread(LOGBOOK * lbs, int message_id) { int i, n, size, new_id; char date[80], attrib[MAX_N_ATTR][NAME_LENGTH], *text, in_reply_to[80], reply_to[MAX_REPLY_TO * 10], - encoding[80], locked_by[256]; + encoding[80], locked_by[256]; char list[MAX_N_ATTR][NAME_LENGTH], str[256]; char att_file[MAX_ATTACHMENTS][256]; @@ -5115,12 +5154,12 @@ int el_move_message_thread(LOGBOOK * lbs, int message_id) text = xmalloc(TEXT_SIZE); size = TEXT_SIZE; el_retrieve(lbs, message_id, date, attr_list, attrib, lbs->n_attr, text, &size, in_reply_to, reply_to, - att_file, encoding, locked_by); + att_file, encoding, locked_by); /* submit as new message */ date[0] = 0; new_id = el_submit(lbs, 0, FALSE, date, attr_list, attrib, lbs->n_attr, text, in_reply_to, reply_to, - encoding, att_file, FALSE, locked_by); + encoding, att_file, FALSE, locked_by); xfree(text); @@ -5148,19 +5187,19 @@ int el_move_message(LOGBOOK * lbs, int old_id, int new_id) { int status, size; char date[80], attrib[MAX_N_ATTR][NAME_LENGTH], *text, in_reply_to[80], reply_to[MAX_REPLY_TO * 10], - encoding[80], locked_by[256], att_file[MAX_ATTACHMENTS][256]; + encoding[80], locked_by[256], att_file[MAX_ATTACHMENTS][256]; /* retrieve message */ text = xmalloc(TEXT_SIZE); size = TEXT_SIZE; status = el_retrieve(lbs, old_id, date, attr_list, attrib, lbs->n_attr, text, &size, in_reply_to, - reply_to, att_file, encoding, locked_by); + reply_to, att_file, encoding, locked_by); if (status != EL_SUCCESS) return 0; /* submit as new message */ status = el_submit(lbs, new_id, FALSE, date, attr_list, attrib, lbs->n_attr, text, in_reply_to, reply_to, - encoding, att_file, FALSE, locked_by); + encoding, att_file, FALSE, locked_by); xfree(text); @@ -5183,17 +5222,17 @@ int el_lock_message(LOGBOOK * lbs, int message_id, char *user) { int size; char date[80], attrib[MAX_N_ATTR][NAME_LENGTH], text[TEXT_SIZE], in_reply_to[80], - reply_to[MAX_REPLY_TO * 10], encoding[80], locked_by[256]; + reply_to[MAX_REPLY_TO * 10], encoding[80], locked_by[256]; char att_file[MAX_ATTACHMENTS][256]; /* retrieve message */ size = sizeof(text); el_retrieve(lbs, message_id, date, attr_list, attrib, lbs->n_attr, text, &size, in_reply_to, reply_to, - att_file, encoding, locked_by); + att_file, encoding, locked_by); /* submit message, unlocked if user==NULL */ el_submit(lbs, message_id, TRUE, date, attr_list, attrib, lbs->n_attr, text, in_reply_to, reply_to, - encoding, att_file, FALSE, user); + encoding, att_file, FALSE, user); return EL_SUCCESS; } @@ -5249,9 +5288,9 @@ void write_logfile(LOGBOOK * lbs, const char *text) strlcat(buf, text, sizeof(buf) - 1); #ifdef OS_WINNT if (strlen(buf) > 0 && buf[strlen(buf) - 1] != '\n') - strlcat(buf, "\r\n", sizeof(buf)); + strlcat(buf, "\r\n", sizeof(buf)); else if (strlen(buf) > 1 && buf[strlen(buf) - 2] != '\r') - strlcpy(buf + strlen(buf) - 2, "\r\n", sizeof(buf) - (strlen(buf) - 2)); + strlcpy(buf + strlen(buf) - 2, "\r\n", sizeof(buf) - (strlen(buf) - 2)); #else if (strlen(buf) > 1 && buf[strlen(buf) - 1] != '\n') @@ -5308,9 +5347,8 @@ int is_html(char *s) str = xstrdup(s); for (i = 0; i < (int) strlen(s); i++) - str[i] = toupper(s[i]) -; - str[i] = 0; + str[i] = toupper(s[i]); + str[i] = 0; for (i = 0; html_tags[i][0]; i++) { p = strstr(str, html_tags[i]); @@ -5349,9 +5387,8 @@ int is_full_html(char *file_name) str = xstrdup((char *) buf); for (i = 0; i < (int) strlen((char *) buf); i++) - str[i] = toupper(buf[i]) -; - str[i] = 0; + str[i] = toupper(buf[i]); + str[i] = 0; xfree(buf); @@ -5402,7 +5439,7 @@ int is_ascii(char *file_name) int is_image(char *att) { return (stristr(att, ".GIF") != NULL) || (stristr(att, ".JPG") != NULL) || (stristr(att, ".JPEG") != NULL) - || (stristr(att, ".PNG") != NULL); + || (stristr(att, ".PNG") != NULL); } /*------------------------------------------------------------------*/ @@ -5504,7 +5541,7 @@ void replace_inline_img(LOGBOOK * lbs, char *str) /*------------------------------------------------------------------*/ void convert_elog_link(LOGBOOK * lbs, char *link, char *link_text, char *result, int absolute_link, - int message_id) + int message_id) { char str[256], base_url[256]; int i; @@ -5530,7 +5567,7 @@ void convert_elog_link(LOGBOOK * lbs, char *link, char *link_text, char *result, else base_url[0] = 0; sprintf(result, "elog:%s", base_url, lbs->name_enc, message_id, link, - link_text); + link_text); } else { if (absolute_link) compose_base_url(lbs, base_url, sizeof(base_url), FALSE); @@ -5622,18 +5659,18 @@ void rsputs2(LOGBOOK * lbs, int absolute_link, const char *str) for (n = 0; n < (int) strlen(link_text); n++) { switch (link_text[n]) { /* the translation for the search highliting */ - case '\001': - link_text[n] = '<'; - break; - case '\002': - link_text[n] = '>'; - break; - case '\003': - link_text[n] = '\"'; - break; - case '\004': - link_text[n] = ' '; - break; + case '\001': + link_text[n] = '<'; + break; + case '\002': + link_text[n] = '>'; + break; + case '\003': + link_text[n] = '\"'; + break; + case '\004': + link_text[n] = ' '; + break; } } @@ -5675,45 +5712,45 @@ void rsputs2(LOGBOOK * lbs, int absolute_link, const char *str) i += 3; } else switch (str[i]) { - case '&': - strcat(return_buffer, "&"); - j += 5; - break; - case '<': - strcat(return_buffer, "<"); - j += 4; - break; - case '>': - strcat(return_buffer, ">"); - j += 4; - break; + case '&': + strcat(return_buffer, "&"); + j += 5; + break; + case '<': + strcat(return_buffer, "<"); + j += 4; + break; + case '>': + strcat(return_buffer, ">"); + j += 4; + break; - /* suppress escape character '\' in front of HTML or ELCode tag */ - case '\\': - if (str[i + 1] != '<' && str[i + 1] != '[') - return_buffer[j++] = str[i]; - break; - - /* the translation for the search highliting */ - case '\001': - strcat(return_buffer, "<"); - j++; - break; - case '\002': - strcat(return_buffer, ">"); - j++; - break; - case '\003': - strcat(return_buffer, "\""); - j++; - break; - case '\004': - strcat(return_buffer, " "); - j++; - break; - - default: + /* suppress escape character '\' in front of HTML or ELCode tag */ + case '\\': + if (str[i + 1] != '<' && str[i + 1] != '[') return_buffer[j++] = str[i]; + break; + + /* the translation for the search highliting */ + case '\001': + strcat(return_buffer, "<"); + j++; + break; + case '\002': + strcat(return_buffer, ">"); + j++; + break; + case '\003': + strcat(return_buffer, "\""); + j++; + break; + case '\004': + strcat(return_buffer, " "); + j++; + break; + + default: + return_buffer[j++] = str[i]; } } } @@ -5732,22 +5769,22 @@ void rsputs3(const char *text) str[1] = 0; for (i = 0; i < (int) strlen(text); i++) { switch (text[i]) { - case '<': - rsputs("<"); - break; - case '>': - rsputs(">"); - break; - case '&': - rsputs("&"); - break; - case '\"': - rsputs("""); - break; + case '<': + rsputs("<"); + break; + case '>': + rsputs(">"); + break; + case '&': + rsputs("&"); + break; + case '\"': + rsputs("""); + break; - default: - str[0] = text[i]; - rsputs(str); + default: + str[0] = text[i]; + rsputs(str); } } } @@ -5759,110 +5796,116 @@ typedef struct { char *subst; } PATTERN_LIST; -PATTERN_LIST - pattern_list[] = { +PATTERN_LIST pattern_list[] = { - /* smileys */ - { ":))", "\"Happy\"" }, - { ":-))", "\"Happy\"" }, - { ":)", "\"Smile\"" }, - { ":-)", "\"Smile\"" }, - { ":(", "\"Frown\"" }, - { ":-(", "\"Frown\"" }, - { ";)", "\"Wink\"" }, - { ";-)", "\"Wink\"" }, - { ":d", "\"Big" }, - { "?-)", "\"Confused\"" }, - { ";(", "\"Crying\"" }, - { ";-(", "\"Crying\"" }, - { ":]", "\"Pleased\"" }, - { ":-]", "\"Pleased\"" }, - { ":o", "\"Yawn\"" }, - { ":-o", "\"Yawn\"" }, - { "8-)", "\"Cool\"" }, - { "8o", "\"Astonished\"" }, - { "x-(", "\"Mad\"" }, - { ":p", "\"Tongue\"" }, - { ":-p", "\"Tongue\"" }, - - /* formatting */ - { "[b]", "" }, - { "[/b]", "" }, - { "[u]", "" }, - { "[/u]", "" }, - { "[i]", "" }, - { "[/i]", "" }, - - { "[center]", "
" }, - { "[/center]", "
" }, - { "[color=", "" }, - { "[/color]", "" }, - { "[size=", "" }, - { "[/size]", "" }, - { "[font=", "" }, - { "[/font]", "" }, - { "\r\n[code]", "
" },
-            { "[code]", "
" },
-            { "[/code]\r\n", "
" }, - { "[/code]", "
" }, - { "\r\n[code1]", "
" },
-            { "[code1]", "
" },
-            { "[/code1]\r\n", "
" }, - { "[/code1]", "
" }, - - /* lists */ - { "[list]\r", "
    " }, - { "[list]", "
      " }, - { "[*]", "
    • " }, - { "[/list]\r", "" }, // either
    or - { "[/list]", "" }, - { "[list=", "
      " }, - - /* headings */ - { "[h1]", "

      " }, - { "[/h1]", "

      " }, - { "[h2]", "

      " }, - { "[/h2]", "

      " }, - { "[h3]", "

      " }, - { "[/h3]", "

      " }, - - /* URLs */ - { "[url=", "%s" }, - { "[url]", "%s" }, - { "[/url]", "" }, - { "[email]", "%s" }, - { "[/email]", "" }, - { "[img]", "" }, - { "[/img]", "" }, - - /* quote */ - { - "[quote=", - "
      %s:
      " }, - { - "[quote]", - "
      %s:
      " }, - { "[/quote]\r", "

      \r\n" }, { "[/quote]", "
      \r\n" }, - - /* table */ - { "[table]", "
      " }, { "[table ", "
      " }, { "|-", - "
      " }, { "|", "" }, { "[/table]", "
      " }, - - /* horizontal line */ - { "[line]", "
      " }, - - /* anchor */ - { "[anchor]", "" }, { "[/anchor]", "" }, { "", "" } }; + /* smileys */ + { + ":))", "\"Happy\""}, { + ":-))", "\"Happy\""}, { + ":)", "\"Smile\""}, { + ":-)", "\"Smile\""}, { + ":(", "\"Frown\""}, { + ":-(", "\"Frown\""}, { + ";)", "\"Wink\""}, { + ";-)", "\"Wink\""}, { + ":d", "\"Big"}, { + "?-)", "\"Confused\""}, { + ";(", "\"Crying\""}, { + ";-(", "\"Crying\""}, { + ":]", "\"Pleased\""}, { + ":-]", "\"Pleased\""}, { + ":o", "\"Yawn\""}, { + ":-o", "\"Yawn\""}, { + "8-)", "\"Cool\""}, { + "8o", "\"Astonished\""}, { + "x-(", "\"Mad\""}, { + ":p", "\"Tongue\""}, { + ":-p", "\"Tongue\""}, + /* formatting */ + { + "[b]", ""}, { + "[/b]", ""}, { + "[u]", ""}, { + "[/u]", ""}, { + "[i]", ""}, { + "[/i]", ""}, { + "[center]", "
      "}, { + "[/center]", "
      "}, { + "[color=", ""}, { + "[/color]", ""}, { + "[size=", ""}, { + "[/size]", ""}, { + "[font=", ""}, { + "[/font]", ""}, { + "\r\n[code]", "
      "}, {
      +   "[code]", "
      "}, {
      +   "[/code]\r\n", "
      "}, { + "[/code]", "
      "}, { + "\r\n[code1]", "
      "}, {
      +   "[code1]", "
      "}, {
      +   "[/code1]\r\n", "
      "}, { + "[/code1]", "
      "}, + /* lists */ + { + "[list]\r", "
        "}, { + "[list]", "
          "}, { + "[*]", "
        • "}, { + "[/list]\r", ""}, // either
        or + { + "[/list]", ""}, { + "[list=", "
          "}, + /* headings */ + { + "[h1]", "

          "}, { + "[/h1]", "

          "}, { + "[h2]", "

          "}, { + "[/h2]", "

          "}, { + "[h3]", "

          "}, { + "[/h3]", "

          "}, + /* URLs */ + { + "[url=", "%s"}, { + "[url]", "%s"}, { + "[/url]", ""}, { + "[email]", "%s"}, { + "[/email]", ""}, { + "[img]", ""}, { + "[/img]", ""}, + /* quote */ + { + "[quote=", + "
          %s:
          "}, + { + "[quote]", + "
          %s:
          "}, + { + "[/quote]\r", "

          \r\n"}, { + "[/quote]", "
          \r\n"}, + /* table */ + { + "[table]", "\n\n"); /*---- entry form ----*/ @@ -9767,7 +9811,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL for (i = 0; i < n_attr; i++) { if (attr_flags[i] & AF_REQUIRED) { rsprintf("\n", - loc("Fields marked with"), loc("are required")); + loc("Fields marked with"), loc("are required")); break; } } @@ -9887,7 +9931,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* if attribute cannot be changed, just display text */ if ((attr_flags[index] & AF_LOCKED) || ((bedit && !breedit && !bupload) && (attr_flags[index] - & AF_FIXED_EDIT)) || (message_id && !bedit && (attr_flags[index] & AF_FIXED_REPLY))) { + & AF_FIXED_EDIT)) + || (message_id && !bedit && (attr_flags[index] & AF_FIXED_REPLY))) { if (attr_flags[index] & AF_DATE) { @@ -10060,13 +10105,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL break; if (j < n_moptions) - rsprintf( - "\n", - str, str, full_name); + rsprintf + ("\n", + str, str, full_name); else - rsprintf( - "\n", - str, str, full_name); + rsprintf + ("\n", + str, str, full_name); rsprintf("\n", str, full_name); rsprintf("\n"); @@ -10097,13 +10142,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL break; if (j < n_moptions) - rsprintf( - "\n", - str, str, user_email); + rsprintf + ("\n", + str, str, user_email); else - rsprintf( - "\n", - str, str, user_email); + rsprintf + ("\n", + str, str, user_email); rsprintf("\n", str, user_email); rsprintf("\n"); @@ -10150,9 +10195,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("", title, class_value); strencode2(str, attrib[index], sizeof(str)); - rsprintf( - "\n", - input_size, input_maxlen, ua, str); + rsprintf + ("\n", + input_size, input_maxlen, ua, str); rsprintf("\n"); } @@ -10166,35 +10211,35 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL sprintf(str, "%s_0", ua); rsprintf("\n"); rsprintf("\n", str, - ua); + ua); rsprintf("\n", str); rsprintf("\n"); sprintf(str, "%s_1", ua); rsprintf("\n"); rsprintf("\n", str, - ua); + ua); rsprintf("\n", str); rsprintf("\n"); sprintf(str, "%s_2", ua); rsprintf("\n"); - rsprintf( - "\" checked onChange=\"mod();\">\n", - str, ua); + rsprintf + ("\" checked onChange=\"mod();\">\n", + str, ua); rsprintf("\n", str, loc("keep original values")); rsprintf("\n"); } /* display checkbox */ else if (atoi(attrib[index]) == 1) - rsprintf( - "\n", - title, class_value, ua); + rsprintf + ("\n", + title, class_value, ua); else - rsprintf( - "\n", - title, class_value, ua); + rsprintf + ("\n", + title, class_value, ua); } else { sprintf(str, "extend_%d", index); @@ -10206,13 +10251,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf(" : \n"); if (attr_flags[index] & (AF_MULTI | AF_MUSERLIST | AF_MUSEREMAIL)) - rsprintf( - "\n", - input_maxlen, ua, attrib[index]); + rsprintf + ("\n", + input_maxlen, ua, attrib[index]); else - rsprintf( - "\n", - input_maxlen, ua, attrib[index]); + rsprintf + ("\n", + input_maxlen, ua, attrib[index]); rsprintf("\n", index); rsprintf("\n"); @@ -10226,9 +10271,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (isparam("nsel") && strieq(attrib[index], str)) { rsprintf("\n"); sprintf(str, "%s_keep", ua); - rsprintf( - "\" checked onChange=\"mod();\">\n", - str, ua); + rsprintf + ("\" checked onChange=\"mod();\">\n", + str, ua); rsprintf("\n", str, loc("keep original values")); rsprintf("\n"); @@ -10251,13 +10296,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL break; if (j < n_moptions) - rsprintf( - "\n", - str, str, attr_options[index][i]); + rsprintf + ("\n", + str, str, attr_options[index][i]); else - rsprintf( - "\n", - str, str, attr_options[index][i]); + rsprintf + ("\n", + str, str, attr_options[index][i]); rsprintf("\n", str, attr_options[index][i]); rsprintf("\n"); @@ -10268,9 +10313,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (attr_flags[index] & AF_EXTENDABLE) { sprintf(str, loc("Add %s"), attr_list[index]); - rsprintf( - "\n", - index, str); + rsprintf + ("\n", + index, str); } rsprintf("\n"); @@ -10294,13 +10339,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL strencode2(enc_attr, attrib[index], sizeof(enc_attr)); if (strstr(attrib[index], attr_options[index][i]) || strieq(str, enc_attr)) - rsprintf( - "\n", - str, ua, str); + rsprintf + ("\n", + str, ua, str); else - rsprintf( - "\n", - str, ua, str); + rsprintf + ("\n", + str, ua, str); rsprintf("\n", str, str); @@ -10312,9 +10357,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (attr_flags[index] & AF_EXTENDABLE) { sprintf(str, loc("Add %s"), attr_list[index]); - rsprintf( - "\n", - index, str); + rsprintf + ("\n", + index, str); } rsprintf("\n"); @@ -10326,22 +10371,22 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL for (i = 0; i < MAX_N_LIST && attr_options[index][i][0]; i++) { if (strstr(attrib[index], attr_options[index][i])) - rsprintf( - "\n"); if ((format_flags[index] & AFF_MULTI_LINE) && attr_options[index][i + 1][0]) { @@ -10393,9 +10438,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (attr_flags[index] & AF_EXTENDABLE) { sprintf(str, loc("Add %s"), attr_list[index]); - rsprintf( - "\n", - index, str); + rsprintf + ("\n", + index, str); } rsprintf("\n"); @@ -10470,13 +10515,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL ricon("code", loc("Insert code CTRL+O"), "elcode(document.form1.Text, 'CODE','')"); if (show_smileys) - rsprintf( - " \"%s\"\n"); @@ -10657,10 +10702,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (enc_selected == 1) /* use hard wrapping only for plain text */ rsprintf("
          "}, { + "[table ", "
          "}, { + "|-", "
          "}, { + "|", ""}, { + "[/table]", "
          "}, + /* horizontal line */ + { + "[line]", "
          "}, + /* anchor */ + { + "[anchor]", ""}, { + "[/anchor]", ""}, { +"", ""}}; char - *email_quote_table = - "\n", - loc("New passwords do not match, please retype")); + loc("New passwords do not match, please retype")); rsprintf("\n"); rsprintf("", - loc("Submit")); + loc("Submit")); rsprintf("
          %s:
          "; +*email_quote_table = + "\n\n"); rsprintf("\n\n"); rsprintf("
          %s:
          "; void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) { int i, j, k, l, m, elcode_disabled, elcode_disabled1, escape_char, ordered_list, substituted, inside_table; char *p, *pd, link[1000], link_text[1000], tmp[1000], attrib[1000], hattrib[1000], value[1000], - subst[1000], base_url[256], param[256], *lstr; + subst[1000], base_url[256], param[256], *lstr; if (strlen_retbuf + (int) (2 * strlen(str) + 1000) >= return_buffer_size) { return_buffer = xrealloc(return_buffer, return_buffer_size + 100000); @@ -5881,8 +5924,8 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) /* make lower case copy of str */ lstr = xmalloc(strlen(str) + 1); for (pd = lstr, p = (char *) str; *p; p++, pd++) - *pd = tolower(*p) -; *pd = 0; + *pd = tolower(*p); + *pd = 0; for (i = 0; i < (int) strlen(str); i++) { @@ -5899,7 +5942,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) p = (char *) (str + i + strlen(key_list[l])); i += strlen(key_list[l]); for (k = 0; *p && strcspn(p, " \t\n\r({[)}]\"") && k < (int) sizeof(link); k++, i++) - link[k] = *p++; + link[k] = *p++; link[k] = 0; i--; @@ -5918,7 +5961,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) /* skip everything between '<' and '>' */ pd = p; while (*pd && *pd != '\002') - *p = *pd++; + *p = *pd++; strcpy(p, pd + 1); @@ -5928,7 +5971,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) pd = p; while (*pd && *pd != '\002') - *p = *pd++; + *p = *pd++; strcpy(p, pd + 1); } @@ -5937,31 +5980,31 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) if (strcmp(key_list[l], "elog:") == 0) { strlcpy(tmp, link, sizeof(tmp)); if (strchr(tmp, '/')) - *strchr(tmp, '/') = 0; + *strchr(tmp, '/') = 0; for (m = 0; m < (int) strlen(tmp); m++) - if (!isdigit(tmp[m])) - break; + if (!isdigit(tmp[m])) + break; if (m < (int) strlen(tmp) && tmp[m] != '#') { /* if link contains reference to other logbook, put logbook explicitly */ if (email_notify) - compose_base_url(NULL, base_url, sizeof(base_url), TRUE); + compose_base_url(NULL, base_url, sizeof(base_url), TRUE); else - strcpy(base_url, "../"); + strcpy(base_url, "../"); sprintf(return_buffer + j, "elog:%s", base_url, link, link_text); } else if (link[0] == '/') { if (email_notify) - compose_base_url(NULL, base_url, sizeof(base_url), TRUE); + compose_base_url(NULL, base_url, sizeof(base_url), TRUE); else - base_url[0] = 0; + base_url[0] = 0; sprintf(return_buffer + j, "elog:%s", base_url, lbs->name_enc, - _current_message_id, link, link_text); + _current_message_id, link, link_text); } else { if (email_notify) - compose_base_url(lbs, base_url, sizeof(base_url), TRUE); + compose_base_url(lbs, base_url, sizeof(base_url), TRUE); else - base_url[0] = 0; + base_url[0] = 0; sprintf(return_buffer + j, "elog:%s", base_url, link, link_text); } } else if (strcmp(key_list[l], "mailto:") == 0) { @@ -5990,7 +6033,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) } } if (key_list[l][0]) - continue; + continue; substituted = FALSE; @@ -5998,9 +6041,9 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) if (strncmp(lstr + i, pattern_list[l].pattern, strlen(pattern_list[l].pattern)) == 0) { if (stristr(pattern_list[l].pattern, "[/code]")) - elcode_disabled = FALSE; + elcode_disabled = FALSE; if (stristr(pattern_list[l].pattern, "[/code1]")) - elcode_disabled1 = FALSE; + elcode_disabled1 = FALSE; /* check for escape character */ if (i > 0 && str[i - 1] == '\\') { @@ -6008,7 +6051,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) j--; strcpy(return_buffer + j, pattern_list[l].pattern); j += strlen(pattern_list[l].pattern); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... substituted = TRUE; break; @@ -6019,12 +6062,12 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) substituted = TRUE; if (stristr(pattern_list[l].pattern, "[list=")) - ordered_list = TRUE; + ordered_list = TRUE; if (stristr(pattern_list[l].pattern, "[table")) - inside_table++; + inside_table++; if (stristr(pattern_list[l].pattern, "[/table]")) - inside_table--; + inside_table--; if (stristr(pattern_list[l].pattern, "[quote")) { if (pattern_list[l].pattern[strlen(pattern_list[l].pattern) - 1] == '=') { @@ -6033,23 +6076,23 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) i += strlen(attrib); if (attrib[0] == '\"') - strcpy(attrib, attrib + 1); + strcpy(attrib, attrib + 1); if (attrib[strlen(attrib) - 1] == '\"') - attrib[strlen(attrib) - 1] = 0; + attrib[strlen(attrib) - 1] = 0; sprintf(value, loc("%s wrote"), attrib); if (email_notify) - sprintf(return_buffer + j, email_quote_table, value); + sprintf(return_buffer + j, email_quote_table, value); else - sprintf(return_buffer + j, pattern_list[l].subst, value); + sprintf(return_buffer + j, pattern_list[l].subst, value); j += strlen(return_buffer + j); } else { if (email_notify) - sprintf(return_buffer + j, email_quote_table, loc("Quote")); + sprintf(return_buffer + j, email_quote_table, loc("Quote")); else - sprintf(return_buffer + j, pattern_list[l].subst, loc("Quote")); + sprintf(return_buffer + j, pattern_list[l].subst, loc("Quote")); j += strlen(return_buffer + j); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... } } @@ -6062,30 +6105,30 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) strextract(str + i, ']', attrib, sizeof(attrib)); i += strlen(attrib) + 1; - if (strncmp(attrib, "elog:", 5) == 0) { /* eval elog: */ + if (strncmp(attrib, "elog:", 5) == 0) { /* eval elog: */ strlcpy(tmp, attrib + 5, sizeof(tmp)); if (strchr(tmp, '/')) - *strchr(tmp, '/') = 0; + *strchr(tmp, '/') = 0; for (m = 0; m < (int) strlen(tmp); m++) - if (!isdigit(tmp[m])) - break; + if (!isdigit(tmp[m])) + break; if (m < (int) strlen(tmp)) - /* if link contains reference to other logbook, add ".." in front */ - sprintf(hattrib, "../%s", attrib + 5); + /* if link contains reference to other logbook, add ".." in front */ + sprintf(hattrib, "../%s", attrib + 5); else if (attrib[5] == '/') - sprintf(hattrib, "%d%s", _current_message_id, attrib + 5); + sprintf(hattrib, "%d%s", _current_message_id, attrib + 5); else - sprintf(hattrib, "%s", attrib + 5); + sprintf(hattrib, "%s", attrib + 5); - } else if (strstr(attrib, "://") == 0 && attrib[0] != '#') { /* add http:// if missing */ + } else if (strstr(attrib, "://") == 0 && attrib[0] != '#') { /* add http:// if missing */ if (_ssl_flag) - sprintf(hattrib, "https://%s", attrib); + sprintf(hattrib, "https://%s", attrib); else - sprintf(hattrib, "http://%s", attrib); + sprintf(hattrib, "http://%s", attrib); } else - strlcpy(hattrib, attrib, sizeof(hattrib)); + strlcpy(hattrib, attrib, sizeof(hattrib)); strextract(str + i, '[', value, sizeof(value)); i += strlen(value) - 1; @@ -6108,24 +6151,24 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) retrieve_email_from(lbs, link, NULL, NULL); p = strchr(attrib, '/'); if (p) - m = atoi(p + 1) - 1; + m = atoi(p + 1) - 1; if (strchr(link, '@')) - p = strchr(link, '@') + 1; + p = strchr(link, '@') + 1; else - p = link; + p = link; sprintf(hattrib, "cid:att%d@%s", m, p); } else { if (email_notify) - compose_base_url(lbs, hattrib, sizeof(hattrib), TRUE); + compose_base_url(lbs, hattrib, sizeof(hattrib), TRUE); else - hattrib[0] = 0; + hattrib[0] = 0; if (attrib[5] == '/') { if (_current_message_id == 0) { sprintf(param, "attachment%d", atoi(attrib + 6) - 1); if (isparam(param)) - strlcat(hattrib, getparam(param), sizeof(hattrib)); + strlcat(hattrib, getparam(param), sizeof(hattrib)); } else - sprintf(hattrib + strlen(hattrib), "%d%s", _current_message_id, attrib + 5); + sprintf(hattrib + strlen(hattrib), "%d%s", _current_message_id, attrib + 5); } else { strlcat(hattrib, attrib + 5, sizeof(hattrib)); } @@ -6134,13 +6177,13 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) /* add http:// if missing */ else if ((!strnieq(attrib, "http://", 7) && !strnieq(attrib, "https://", 8)) && - strstr(pattern_list[l].subst, "mailto") == NULL && - strstr(pattern_list[l].subst, "img") == NULL && - strncmp(pattern_list[l].subst, ""); + strcpy(subst, ""); else - strcpy(subst, ""); + strcpy(subst, ""); ordered_list = FALSE; strcpy(return_buffer + j, subst); j += strlen(subst); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... } else if (strncmp(pattern_list[l].pattern, "|", 1) == 0) { @@ -6186,19 +6229,19 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) if (strstr(link, "%s")) { strcpy(tmp, link); if (email_notify) - compose_base_url(lbs, base_url, sizeof(base_url), TRUE); + compose_base_url(lbs, base_url, sizeof(base_url), TRUE); else - base_url[0] = 0; + base_url[0] = 0; sprintf(link, tmp, base_url); } strcpy(return_buffer + j, link); j += strlen(link); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... } else { strcpy(return_buffer + j, pattern_list[l].pattern); j += strlen(pattern_list[l].pattern); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... } } else { @@ -6208,17 +6251,17 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) if (strstr(link, "%s")) { strcpy(tmp, link); if (email_notify) - compose_base_url(lbs, base_url, sizeof(base_url), TRUE); + compose_base_url(lbs, base_url, sizeof(base_url), TRUE); else - base_url[0] = 0; + base_url[0] = 0; sprintf(link, tmp, base_url); } strcpy(return_buffer + j, link); j += strlen(link); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... } - } // !elcode_disabled && !elcode_disabled1 + } // !elcode_disabled && !elcode_disabled1 else if (!elcode_disabled) { @@ -6229,21 +6272,21 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) if (strstr(link, "%s")) { strcpy(tmp, link); if (email_notify) - compose_base_url(lbs, base_url, sizeof(base_url), TRUE); + compose_base_url(lbs, base_url, sizeof(base_url), TRUE); else - base_url[0] = 0; + base_url[0] = 0; sprintf(link, tmp, base_url); } strcpy(return_buffer + j, link); j += strlen(link); - i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... + i += strlen(pattern_list[l].pattern) - 1; // 1 gets added in for loop... } if (stristr(pattern_list[l].pattern, "[code]")) - elcode_disabled = TRUE; + elcode_disabled = TRUE; if (stristr(pattern_list[l].pattern, "[code1]")) - elcode_disabled1 = TRUE; + elcode_disabled1 = TRUE; break; } @@ -6251,59 +6294,59 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) /* don't output tags if already subsituted by HTML code */ if (substituted) - continue; + continue; if (strnieq(str + i, "
          ", 4)) { strcpy(return_buffer + j, "
          "); j += 6; i += 3; } else - switch (str[i]) { + switch (str[i]) { case '\r': - if (!elcode_disabled && !elcode_disabled1 && !inside_table) { - strcat(return_buffer, "
          \r\n"); - j += 8; - } else { - strcat(return_buffer, "\r\n"); - j += 2; - } - break; + if (!elcode_disabled && !elcode_disabled1 && !inside_table) { + strcat(return_buffer, "
          \r\n"); + j += 8; + } else { + strcat(return_buffer, "\r\n"); + j += 2; + } + break; case '\n': - break; + break; case '&': - strcat(return_buffer, "&"); - j += 5; - break; + strcat(return_buffer, "&"); + j += 5; + break; case '<': - strcat(return_buffer, "<"); - j += 4; - break; + strcat(return_buffer, "<"); + j += 4; + break; case '>': - strcat(return_buffer, ">"); - j += 4; - break; + strcat(return_buffer, ">"); + j += 4; + break; - /* the translation for the search highliting */ + /* the translation for the search highliting */ case '\001': - strcat(return_buffer, "<"); - j++; - break; + strcat(return_buffer, "<"); + j++; + break; case '\002': - strcat(return_buffer, ">"); - j++; - break; + strcat(return_buffer, ">"); + j++; + break; case '\003': - strcat(return_buffer, "\""); - j++; - break; + strcat(return_buffer, "\""); + j++; + break; case '\004': - strcat(return_buffer, " "); - j++; - break; + strcat(return_buffer, " "); + j++; + break; default: - return_buffer[j++] = str[i]; - } + return_buffer[j++] = str[i]; + } } xfree(lstr); @@ -6362,8 +6405,8 @@ int setparam(char *param, char *value) if (strieq(param, "text")) { if (strlen(value) >= TEXT_SIZE) { sprintf(str, - "Error: Entry text too big (%lu bytes). Please increase TEXT_SIZE and recompile elogd\n", - (unsigned long) strlen(value)); + "Error: Entry text too big (%lu bytes). Please increase TEXT_SIZE and recompile elogd\n", + (unsigned long) strlen(value)); show_error(str); return 0; } @@ -6375,8 +6418,8 @@ int setparam(char *param, char *value) if (strieq(param, "cmdline")) { if (strlen(value) >= CMD_SIZE) { sprintf(str, - "Error: Command line too big (%lu bytes). Please increase CMD_SIZE and recompile elogd\n", - (unsigned long) strlen(value)); + "Error: Command line too big (%lu bytes). Please increase CMD_SIZE and recompile elogd\n", + (unsigned long) strlen(value)); show_error(str); return 0; } @@ -6400,10 +6443,9 @@ int setparam(char *param, char *value) strlcpy(_param[i], param, NAME_LENGTH); if (strlen(value) >= NAME_LENGTH) { - sprintf( - str, - "Error: Parameter value for parameter %s too big (%lu bytes). Please increase NAME_LENGTH and recompile elogd\n", - param, (unsigned long) strlen(value)); + sprintf(str, + "Error: Parameter value for parameter %s too big (%lu bytes). Please increase NAME_LENGTH and recompile elogd\n", + param, (unsigned long) strlen(value)); show_error(str); return 0; } @@ -6703,7 +6745,7 @@ void set_location(LOGBOOK * lbs, char *rel_path) /* use redirection via URL */ /* if HTTP request comes from localhost, use localhost as - absolute link (needed if running on DSL at home) */ + absolute link (needed if running on DSL at home) */ if (!str[0] && strstr(http_host, "localhost")) { if (_ssl_flag) strlcpy(str, "https://localhost", sizeof(str)); @@ -7059,7 +7101,7 @@ void show_http_header(LOGBOOK * lbs, BOOL expires, char *cookie) if (cookie && cookie[0]) { - set_cookie(lbs, cookie, NULL, FALSE, "99999"); /* ten years by default */ + set_cookie(lbs, cookie, NULL, FALSE, "99999"); /* ten years by default */ if (getcfg(lbs->name, "URL", str, sizeof(str))) { extract_path(str); @@ -7108,7 +7150,7 @@ void show_plain_header(int size, char *file_name) } void show_html_header(LOGBOOK * lbs, BOOL expires, char *title, BOOL close_head, BOOL rss_feed, char *cookie, - int absolute_link) + int absolute_link) { int i, n; char css[1000], str[1000], media[1000]; @@ -7120,8 +7162,8 @@ void show_html_header(LOGBOOK * lbs, BOOL expires, char *title, BOOL close_head, rsprintf("\n"); /* this code would be for XML files... - rsprintf("\n"); - rsprintf("\n"); + rsprintf("\n"); + rsprintf("\n"); */ /* page title */ @@ -7184,7 +7226,7 @@ void show_browser(char *browser) } void show_standard_header(LOGBOOK * lbs, BOOL expires, char *title, char *path, BOOL rss_feed, char *cookie, - char *script) + char *script) { if (script) { show_html_header(lbs, expires, title, FALSE, rss_feed, cookie, FALSE); @@ -7349,7 +7391,7 @@ LBLIST get_logbook_hierarchy(void) for (j = 0; j < root->n_members; j++) { if (i != j && root->member[j] != NULL && (pgrp = get_subgroup(root->member[j], - root->member[i]->name)) != NULL) { + root->member[i]->name)) != NULL) { /* node is allocated twice, so free one... */ xfree(*pgrp); @@ -7385,8 +7427,7 @@ LBLIST get_logbook_hierarchy(void) root->n_members = i; if (n == 0) { - for (n = 0; lb_list[n].name[0]; n++) - ; + for (n = 0; lb_list[n].name[0]; n++); /* make simple list with logbooks */ root->member = xcalloc(n, sizeof(void *)); @@ -7520,7 +7561,8 @@ void show_standard_title(char *logbook, char *text, int printable) LBLIST phier, pnode, pnext, flb; if (printable) - rsprintf("\n\n"); + rsprintf + ("
          \n\n"); else rsprintf("
          \n\n"); @@ -7529,7 +7571,7 @@ void show_standard_title(char *logbook, char *text, int printable) /*---- logbook selection row ----*/ - pnode = phier; /* start at root of tree */ + pnode = phier; /* start at root of tree */ pnext = NULL; if (!printable && (!getcfg(logbook, "logbook tabs", str, sizeof(str)) || atoi(str) == 1)) { @@ -7563,9 +7605,9 @@ void show_standard_title(char *logbook, char *text, int printable) comment[0] = 0; if (pnode->member[i]->member == NULL) { getcfg(pnode->member[i]->name, "Comment", comment, sizeof(comment)); - strlcpy(ref, str, sizeof(ref)); // current node is logbook + strlcpy(ref, str, sizeof(ref)); // current node is logbook } else { - flb = pnode->member[i]->member[0]; // current node is group + flb = pnode->member[i]->member[0]; // current node is group while (flb->member) // so traverse hierarchy flb = flb->member[0]; @@ -7755,9 +7797,9 @@ void show_bottom_text(LOGBOOK * lbs) } } else /* add little logo */ - rsprintf( - "
          ELOG V%s-%d
          ", - loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13)); + rsprintf + ("
          ELOG V%s-%d
          ", + loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13)); } /*------------------------------------------------------------------*/ @@ -7805,9 +7847,9 @@ void show_bottom_text_login(LOGBOOK * lbs) } } else /* add little logo */ - rsprintf( - "
          ELOG V%s-%d
          ", - loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13)); + rsprintf + ("
          ELOG V%s-%d
          ", + loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13)); } /*------------------------------------------------------------------*/ @@ -7824,17 +7866,17 @@ void show_error(char *error) rsprintf("\n
          "); /* - rsprintf("\n"); + rsprintf("\n"); - rsprintf("\n"); */ rsprintf("
          \n"); @@ -7844,7 +7886,7 @@ void show_error(char *error) /*------------------------------------------------------------------*/ void show_query(LOGBOOK * lbs, char *title, char *query_string, char *button1, char *button1_url, - char *button2, char *button2_url) + char *button2, char *button2_url) { show_standard_header(lbs, TRUE, "ELog query", title, FALSE, NULL, NULL); @@ -7858,8 +7900,10 @@ void show_query(LOGBOOK * lbs, char *title, char *query_string, char *button1, c rsprintf("
          "); - rsprintf("\n", button1, button1_url); - rsprintf("\n", button2, button2_url); + rsprintf("\n", button1, + button1_url); + rsprintf("\n", button2, + button2_url); rsprintf("
          \n"); @@ -7891,7 +7935,7 @@ void set_login_cookies(LOGBOOK * lbs, char *user, char *enc_pwd) if (getcfg(lbs->name, "Login expiration", str, sizeof(str)) || atof(str) > 0) strcpy(exp, str); else if (isparam("remember")) { - strcpy(exp, "744"); /* one month by default = 31*24 */ + strcpy(exp, "744"); /* one month by default = 31*24 */ } else exp[0] = 0; @@ -7913,7 +7957,7 @@ void set_login_cookies(LOGBOOK * lbs, char *user, char *enc_pwd) if (user[0]) { /* set "remember me" cookie on login */ if (isparam("remember")) - set_cookie(lbs, "urem", "1", global, "8760"); /* one year = 24*365 */ + set_cookie(lbs, "urem", "1", global, "8760"); /* one year = 24*365 */ else set_cookie(lbs, "urem", "0", global, "8760"); } @@ -7999,8 +8043,8 @@ void send_file_direct(char *file_name) /* return proper header for file type */ for (i = 0; i < (int) strlen(file_name); i++) - str[i] = toupper(file_name[i]); - str[i] = 0; + str[i] = toupper(file_name[i]); + str[i] = 0; for (i = 0; filetype[i].ext[0]; i++) if (chkext(str, filetype[i].ext)) @@ -8057,42 +8101,42 @@ void strencode(char *text) for (i = 0; i < (int) strlen(text); i++) { switch (text[i]) { - case '\n': - rsprintf("
          \n"); - break; - case '<': - rsprintf("<"); - break; - case '>': - rsprintf(">"); - break; - case '&': - rsprintf("&"); - break; - case '\"': - rsprintf("""); - break; - case ' ': - rsprintf(" "); - break; + case '\n': + rsprintf("
          \n"); + break; + case '<': + rsprintf("<"); + break; + case '>': + rsprintf(">"); + break; + case '&': + rsprintf("&"); + break; + case '\"': + rsprintf("""); + break; + case ' ': + rsprintf(" "); + break; - /* the translation for the search highliting */ + /* the translation for the search highliting */ - case '\001': - rsprintf("<"); - break; - case '\002': - rsprintf(">"); - break; - case '\003': - rsprintf("\""); - break; - case '\004': - rsprintf(" "); - break; + case '\001': + rsprintf("<"); + break; + case '\002': + rsprintf(">"); + break; + case '\003': + rsprintf("\""); + break; + case '\004': + rsprintf(" "); + break; - default: - rsprintf("%c", text[i]); + default: + rsprintf("%c", text[i]); } } } @@ -8105,39 +8149,39 @@ void strencode_nouml(char *text) for (i = 0; i < (int) strlen(text); i++) { switch (text[i]) { - case '\n': - rsprintf("
          \n"); - break; - case '<': - rsprintf("<"); - break; - case '>': - rsprintf(">"); - break; - case '\"': - rsprintf("""); - break; - case ' ': - rsprintf(" "); - break; + case '\n': + rsprintf("
          \n"); + break; + case '<': + rsprintf("<"); + break; + case '>': + rsprintf(">"); + break; + case '\"': + rsprintf("""); + break; + case ' ': + rsprintf(" "); + break; - /* the translation for the search highliting */ + /* the translation for the search highliting */ - case '\001': - rsprintf("<"); - break; - case '\002': - rsprintf(">"); - break; - case '\003': - rsprintf("\""); - break; - case '\004': - rsprintf(" "); - break; + case '\001': + rsprintf("<"); + break; + case '\002': + rsprintf(">"); + break; + case '\003': + rsprintf("\""); + break; + case '\004': + rsprintf(" "); + break; - default: - rsprintf("%c", text[i]); + default: + rsprintf("%c", text[i]); } } } @@ -8150,21 +8194,21 @@ void xmlencode(char *text) for (i = 0; i < (int) strlen(text); i++) { switch (text[i]) { - case '<': - rsprintf("<"); - break; - case '>': - rsprintf(">"); - break; - case '&': - rsprintf("&"); - break; - case '\"': - rsprintf("""); - break; + case '<': + rsprintf("<"); + break; + case '>': + rsprintf(">"); + break; + case '&': + rsprintf("&"); + break; + case '\"': + rsprintf("""); + break; - default: - rsprintf("%c", text[i]); + default: + rsprintf("%c", text[i]); } } } @@ -8178,35 +8222,35 @@ void strencode2(char *b, const char *text, int size) *b = 0; for (i = 0; i < (int) strlen(text); i++) { switch (text[i]) { - case '\n': - if (strlen(b) + 5 >= (unsigned int) size) - return; - strcat(b, "
          \n"); - break; - case '<': - if (strlen(b) + 4 >= (unsigned int) size) - return; - strcat(b, "<"); - break; - case '>': - if (strlen(b) + 4 >= (unsigned int) size) - return; - strcat(b, ">"); - break; - case '&': - if (strlen(b) + 5 >= (unsigned int) size) - return; - strcat(b, "&"); - break; - case '\"': - if (strlen(b) + 6 >= (unsigned int) size) - return; - strcat(b, """); - break; - default: - if (strlen(b) + 1 >= (unsigned int) size) - return; - sprintf(b + strlen(b), "%c", text[i]); + case '\n': + if (strlen(b) + 5 >= (unsigned int) size) + return; + strcat(b, "
          \n"); + break; + case '<': + if (strlen(b) + 4 >= (unsigned int) size) + return; + strcat(b, "<"); + break; + case '>': + if (strlen(b) + 4 >= (unsigned int) size) + return; + strcat(b, ">"); + break; + case '&': + if (strlen(b) + 5 >= (unsigned int) size) + return; + strcat(b, "&"); + break; + case '\"': + if (strlen(b) + 6 >= (unsigned int) size) + return; + strcat(b, """); + break; + default: + if (strlen(b) + 1 >= (unsigned int) size) + return; + sprintf(b + strlen(b), "%c", text[i]); } } } @@ -8214,7 +8258,7 @@ void strencode2(char *b, const char *text, int size) /*------------------------------------------------------------------*/ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_LENGTH], - char attrib[][NAME_LENGTH], BOOL format_date) + char attrib[][NAME_LENGTH], BOOL format_date) { int i; char str[NAME_LENGTH], format[256]; @@ -8325,7 +8369,7 @@ void add_subst_list(char list[][NAME_LENGTH], char value[][NAME_LENGTH], char *i } void add_subst_time(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_LENGTH], char *item, - char *date, int *i, int flags) + char *date, int *i, int flags) { char format[80], str[256]; time_t ltime; @@ -8333,7 +8377,7 @@ void add_subst_time(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_L if (flags & (AF_DATE | AF_DATETIME)) { ltime = date_to_ltime(date); - sprintf(str, "%d", (int)ltime); + sprintf(str, "%d", (int) ltime); add_subst_list(list, value, item, str, i); } else { if (!getcfg(lbs->name, "Time format", format, sizeof(format))) @@ -8417,7 +8461,8 @@ void show_change_pwd_page(LOGBOOK * lbs) if (user[0] && get_user_line(lbs, user, act_pwd, NULL, NULL, NULL, NULL)) { /* administrator does not have to supply old password if changing other user's password */ - if (isparam("unm") && is_admin_user(lbs->name, getparam("unm")) && stricmp(getparam("unm"), user) != 0) + if (isparam("unm") && is_admin_user(lbs->name, getparam("unm")) + && stricmp(getparam("unm"), user) != 0) wrong_pwd = 0; else { if (strcmp(old_pwd, act_pwd) != 0) @@ -8460,7 +8505,7 @@ void show_change_pwd_page(LOGBOOK * lbs) if (wrong_pwd == 2) rsprintf("
          %s!
          \n"); @@ -8488,7 +8533,7 @@ void show_change_pwd_page(LOGBOOK * lbs) rsprintf("
          \n"); show_bottom_text(lbs); @@ -8539,13 +8584,14 @@ void get_auto_index(LOGBOOK * lbs, int index, char *format, char *retstr, int si /* search all entries to find largest index */ old_index = 0; do { - el_retrieve(lbs, message_id, NULL, attr_list, attrib, lbs->n_attr, NULL, 0, NULL, NULL, att, NULL, NULL); + el_retrieve(lbs, message_id, NULL, attr_list, attrib, lbs->n_attr, NULL, 0, NULL, NULL, att, NULL, + NULL); /* if date part changed, start over with index */ if (strlen(attrib[index]) > 0 && strncmp(attrib[index], retstr, loc) != 0) old_index = 0; else - /* retrieve old index */ + /* retrieve old index */ if (atoi(attrib[index] + loc) > old_index) old_index = atoi(attrib[index] + loc); @@ -8673,7 +8719,7 @@ void show_date_selector(int day, int month, int year, char *index) if (year) rsprintf(" %s: ", loc("Year"), - index, year); + index, year); else rsprintf(" %s: ", loc("Year"), index); @@ -8854,9 +8900,9 @@ void attrib_from_param(int n_attr, char attrib[MAX_N_ATTR][NAME_LENGTH]) void ricon(char *name, char *comment, char *onclick) { - rsprintf( - "\"%s\"n_attr, - NULL, NULL, NULL, reply_to, NULL, NULL, NULL); + status = el_retrieve(lbs, message_id, NULL, attr_list, attr, lbs->n_attr, + NULL, NULL, NULL, reply_to, NULL, NULL, NULL); if (status != EL_SUCCESS) return; @@ -8909,21 +8954,21 @@ void compare_attributes(LOGBOOK * lbs, int message_id, char attrib[MAX_N_ATTR][N /*------------------------------------------------------------------*/ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit, - BOOL bduplicate, BOOL bpreview) + BOOL bduplicate, BOOL bpreview) { int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen, - format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, n_lines, - attr_index[MAX_N_ATTR], enc_selected, show_smileys, show_text, n_moptions, display_inline, - allowed_encoding, thumb_status, max_n_lines; + format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, n_lines, + attr_index[MAX_N_ATTR], enc_selected, show_smileys, show_text, n_moptions, display_inline, + allowed_encoding, thumb_status, max_n_lines; char str[2 * NAME_LENGTH], str2[NAME_LENGTH], preset[2 * NAME_LENGTH], *p, *pend, star[80], - comment[10000], reply_string[256], list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, - format[256], date[80], script_onload[256], script_onfocus[256], script_onunload[256], - attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80], reply_tag[MAX_REPLY_TO * 10], - att[MAX_ATTACHMENTS][256], encoding[80], slist[MAX_N_ATTR + 10][NAME_LENGTH], - svalue[MAX_N_ATTR + 10][NAME_LENGTH], owner[256], locked_by[256], class_value[80], class_name[80], - ua[NAME_LENGTH], mid[80], title[256], login_name[256], full_name[256], cookie[256], - orig_author[256], attr_moptions[MAX_N_LIST][NAME_LENGTH], ref[256], file_enc[256], tooltip[10000], - enc_attr[NAME_LENGTH], user_email[256], cmd[256], thumb_name[256]; + comment[10000], reply_string[256], list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, + format[256], date[80], script_onload[256], script_onfocus[256], script_onunload[256], + attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80], reply_tag[MAX_REPLY_TO * 10], + att[MAX_ATTACHMENTS][256], encoding[80], slist[MAX_N_ATTR + 10][NAME_LENGTH], + svalue[MAX_N_ATTR + 10][NAME_LENGTH], owner[256], locked_by[256], class_value[80], class_name[80], + ua[NAME_LENGTH], mid[80], title[256], login_name[256], full_name[256], cookie[256], + orig_author[256], attr_moptions[MAX_N_LIST][NAME_LENGTH], ref[256], file_enc[256], tooltip[10000], + enc_attr[NAME_LENGTH], user_email[256], cmd[256], thumb_name[256]; time_t now, ltime; char fl[8][NAME_LENGTH]; struct tm *pts; @@ -8988,7 +9033,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL size = TEXT_SIZE; el_retrieve(lbs, message_id, date, attr_list, attrib, lbs->n_attr, text, &size, orig_tag, reply_tag, - att, encoding, locked_by); + att, encoding, locked_by); get_author(lbs, attrib, orig_author); @@ -9008,12 +9053,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL } if (message_id && getcfg(lbs->name, "Use Lock", str, sizeof(str)) && atoi(str) == 1 && locked_by[0] - && !isparam("steal")) { + && !isparam("steal")) { sprintf(str, "%d", message_id); sprintf(text, "%s %s", loc("Entry is currently edited by"), locked_by); sprintf(cmd, "?cmd=%s&steal=1", loc("Edit")); - show_query(lbs, loc("Entry is locked"), text, loc("Edit anyhow"), cmd, - loc("Cancel"), str); + show_query(lbs, loc("Entry is locked"), text, loc("Edit anyhow"), cmd, loc("Cancel"), str); return; } @@ -9023,13 +9067,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL else allowed_encoding = 7; - enc_selected = 2; /* Default is HTML */ + enc_selected = 2; /* Default is HTML */ - if (allowed_encoding == 2) /* select ELCode if the only one allowed */ + if (allowed_encoding == 2) /* select ELCode if the only one allowed */ enc_selected = 0; - else if (allowed_encoding == 1) /* select plain if the only one allowed */ + else if (allowed_encoding == 1) /* select plain if the only one allowed */ enc_selected = 1; - else if (allowed_encoding == 3) /* select ELCode if only plain and ELCode allowed */ + else if (allowed_encoding == 3) /* select ELCode if only plain and ELCode allowed */ enc_selected = 0; /* Overwrite from config file */ @@ -9039,13 +9083,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* determine if smiley bar should be displayed */ show_smileys = 0; cookie[0] = 0; - if (isparam("hsm") && atoi(getparam("hsm")) == 1) /* cookie */ + if (isparam("hsm") && atoi(getparam("hsm")) == 1) /* cookie */ show_smileys = 0; - if (isparam("smcmd") && strieq(getparam("smcmd"), "hsm")) { /* turn off */ + if (isparam("smcmd") && strieq(getparam("smcmd"), "hsm")) { /* turn off */ show_smileys = 0; strcpy(cookie, "hsm=1"); } - if (isparam("smcmd") && strieq(getparam("smcmd"), "ssm")) { /* turn on */ + if (isparam("smcmd") && strieq(getparam("smcmd"), "ssm")) { /* turn on */ show_smileys = 1; strcpy(cookie, "hsm=0"); } @@ -9070,12 +9114,12 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL sprintf(str, "Preset %s", attr_list[index]); if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0) { - if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */ - (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ + if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */ + (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9096,7 +9140,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9118,7 +9162,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9155,12 +9199,12 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL sprintf(str, "Preset %s", attr_list[index]); if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0) { - if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */ - (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ + if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */ + (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9178,11 +9222,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL sprintf(str, "Preset on reply %s", attr_list[index]); if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0 && breply) { - if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ + if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9200,11 +9244,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL sprintf(str, "Preset on duplicate %s", attr_list[index]); if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0 && bduplicate) { - if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ + if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */ /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9304,7 +9348,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); sprintf(str, "%d", message_id); add_subst_list(slist, svalue, "message id", str, &i); add_subst_time(lbs, slist, svalue, "entry time", date, &i, attr_flags[index]); @@ -9323,7 +9367,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* do not format date for date attributes */ i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) - == 0); + == 0); sprintf(str, "%d", message_id); add_subst_list(slist, svalue, "message id", str, &i); @@ -9568,7 +9612,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("}\n\n"); /* switch_smileys turn on/off the smiley bar by setting the smcmd, which in turn - sets the hsm=0/hsm=1 cookie */ + sets the hsm=0/hsm=1 cookie */ rsprintf("function switch_smileys()\n"); rsprintf("{\n"); if (show_smileys) @@ -9581,7 +9625,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (enc_selected != 2) { if (!getcfg(lbs->name, "Message height", str, sizeof(str)) && !getcfg(lbs->name, "Message width", str, - sizeof(str))) { + sizeof(str))) { /* javascript for resizing edit box */ rsprintf("\nfunction init_resize()\n"); rsprintf("{\n"); @@ -9691,7 +9735,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (enc_selected == 0) { if (!getcfg(lbs->name, "Message height", str, sizeof(str)) && !getcfg(lbs->name, "Message width", str, - sizeof(str))) { + sizeof(str))) { strcat(script_onload, "elKeyInit();init_resize();"); strcat(script_onfocus, "elKeyInit();"); @@ -9751,11 +9795,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("\n", loc("Update")); rsprintf("\n", - loc("Submit")); + loc("Submit")); rsprintf("\n", - loc("Preview")); + loc("Preview")); rsprintf("\n", - loc("Back")); + loc("Back")); rsprintf("
          %s * %s
          ", - ua, attr_options[index][i]); + rsprintf + ("", + ua, attr_options[index][i]); else rsprintf("", ua, - attr_options[index][i]); + attr_options[index][i]); sprintf(str, "Icon comment %s", attr_options[index][i]); getcfg(lbs->name, str, comment, sizeof(comment)); if (comment[0]) rsprintf("\"%s\"\n", attr_options[index][i], - comment, comment); + comment, comment); else rsprintf("\"%s\"\n", attr_options[index][i], - attr_options[index][i], attr_options[index][i]); + attr_options[index][i], attr_options[index][i]); rsprintf("