diff --git a/doc/config.html b/doc/config.html index c83ab853..5756937b 100755 --- a/doc/config.html +++ b/doc/config.html @@ -1499,6 +1499,22 @@ Subst on edit author = $full_name except that several user names or user emails can be selected at once using check boxes. +
  • + Style <attribute> <value> = <style>
    + + Optional formatting of logbok entries in list mode. For some logbooks + it might be useful to display different entries in a different color + for example. To achieve this, a CSS style sheet can be attached to an + entry based on the value of an attribute. If you have an attribute + called importnace and you want to highlight + all entries where importnace is severe + for example, you can specify following style: +
    +Style importance severe = background-color:red
    +        
    + For possible formattings, please refer to some CSS documentation. You can + change the colors, font styles and sizes. +
  • Change <attribute> = <string>
    Instead of subsituting an attribute, the original attribute can be kept diff --git a/src/elogd.c b/src/elogd.c index bbfac4d1..3542920f 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -1,13 +1,12 @@ -/********************************************************************\ +/******************************************************************** + Name: elogd.c + Created by: Stefan Ritt - Name: elogd.c - Created by: Stefan Ritt + Contents: Web server program for Electronic Logbook ELOG - Contents: Web server program for Electronic Logbook ELOG + $Id$ - $Id$ - -\********************************************************************/ + \********************************************************************/ /* Version of ELOG */ #define VERSION "2.7.3" @@ -115,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 */ @@ -135,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 */ @@ -212,44 +211,25 @@ 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" +char *mname[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", + "October", "November", "December" }; + +char type_list[MAX_N_LIST][NAME_LENGTH] = { "Routine", "Other" }; + +char category_list[MAX_N_LIST][NAME_LENGTH] = { "General", "Other", }; -char type_list[MAX_N_LIST][NAME_LENGTH] = { - "Routine", - "Other" -}; - -char category_list[MAX_N_LIST][NAME_LENGTH] = { - "General", - "Other", -}; - -char author_list[MAX_N_LIST][NAME_LENGTH] = { - "" -}; +char author_list[MAX_N_LIST][NAME_LENGTH] = { "" }; /* attribute flags */ #define AF_REQUIRED (1<<0) @@ -279,82 +259,36 @@ char attr_list[MAX_N_ATTR][NAME_LENGTH]; char attr_options[MAX_N_ATTR][MAX_N_LIST][NAME_LENGTH]; int attr_flags[MAX_N_ATTR]; -char attr_list_default[][NAME_LENGTH] = { - "Author", - "Type", - "Category", - "Subject", - "" -}; +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 -}; +int attr_flags_default[] = { AF_REQUIRED, 0, 0, 0 }; struct { char ext[32]; 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; @@ -398,7 +332,7 @@ typedef struct { int in_reply_to; } MSG_LIST; -LOGBOOK *lb_list = NULL; +LOGBOOK *lb_list= NULL; #ifdef OS_WINNT int run_service(void); @@ -406,11 +340,11 @@ 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); +int get_user_line(LOGBOOK * lbs, char *user, char *password, char *full_name, char *email, + 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); @@ -428,7 +362,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); @@ -642,8 +576,7 @@ 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 ---*/ @@ -657,8 +590,8 @@ static void memory_error_and_abort(char *func) } /* Return a pointer to free()able block of memory large enough - to hold BYTES number of bytes. If the memory cannot be allocated, - print an error message and abort. */ + to hold BYTES number of bytes. If the memory cannot be allocated, + print an error message and abort. */ void *xmalloc(size_t bytes) { char *temp; @@ -771,7 +704,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; @@ -806,34 +739,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++; } @@ -894,7 +827,7 @@ void eprintf(const char *format, ...) xvasprintf(&msg, format, ap); va_end(ap); - (*printf_handler) (msg); + (*printf_handler)(msg); free(msg); } @@ -902,7 +835,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) */ @@ -914,7 +847,7 @@ void eputs(const char *buf) strcpy(p, buf); strcat(p, "\n"); - (*fputs_handler) (p); + (*fputs_handler)(p); xfree(p); } @@ -982,7 +915,7 @@ void fputs_stderr(const char *buf) } /* Redirect all messages handled with eprintf/efputs - to syslog (Unix) or event log (Windows) */ + to syslog (Unix) or event log (Windows) */ void redirect_to_syslog(void) { static int has_inited = 0; @@ -1021,7 +954,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; @@ -1039,38 +972,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); @@ -1086,16 +1019,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); @@ -1108,35 +1041,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); @@ -1145,7 +1078,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; @@ -1254,10 +1187,10 @@ 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; @@ -1269,10 +1202,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 */ @@ -1299,7 +1232,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++; @@ -1307,34 +1240,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); @@ -1382,7 +1315,7 @@ void strsubst(char *string, int size, char *pattern, char *subst) void url_decode(char *p) /********************************************************************\ Decode the given string in-place by expanding %XX escapes -\********************************************************************/ + \********************************************************************/ { char *pD, str[3]; int i; @@ -1416,7 +1349,7 @@ Decode the given string in-place by expanding %XX escapes void url_encode(char *ps, int size) /********************************************************************\ Encode the given string in-place by adding %XX escapes -\********************************************************************/ + \********************************************************************/ { unsigned char *pd, *p; unsigned char str[NAME_LENGTH]; @@ -1442,7 +1375,7 @@ Encode the given string in-place by adding %XX escapes void url_slash_encode(char *ps, int size) /********************************************************************\ Do the same including '/' characters -\********************************************************************/ + \********************************************************************/ { unsigned char *pd, *p; unsigned char str[NAME_LENGTH]; @@ -1626,16 +1559,15 @@ void do_crypt(char *s, char *d, int size) #endif } -/*------------------------------------------------------------------*\ +/*------------------------------------------------------------------* + MD5 Checksum Routines - MD5 Checksum Routines - -\*------------------------------------------------------------------*/ + \*------------------------------------------------------------------*/ 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; /*------------------------------------------------------------------*/ @@ -1689,11 +1621,9 @@ void MD5_checksum(const void *pdata, unsigned int len, unsigned char digest[16]) unsigned int i, padlen; /* 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 - }; + 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 }; memset(&ctx, 0, sizeof(MD5_CONTEXT)); ctx.count[0] = ctx.count[1] = 0; @@ -1767,76 +1697,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; @@ -1850,7 +1780,7 @@ void _MD5_transform(unsigned int state[4], unsigned char block[64]) /*------------------------------------------------------------------*/ /* encodes input (unsigned int) into output (unsigned char), - assumes that lLen is a multiple of 4 */ + assumes that lLen is a multiple of 4 */ void _MD5_encode(unsigned char *pout, unsigned int *pin, unsigned int len) { unsigned int i, j; @@ -1866,15 +1796,14 @@ void _MD5_encode(unsigned char *pout, unsigned int *pin, unsigned int len) /*------------------------------------------------------------------*/ /* encodes input (unsigned char) into output (unsigned int), - assumes that lLen is a multiple of 4 */ + assumes that lLen is a multiple of 4 */ void _MD5_decode(unsigned int *pout, unsigned char *pin, unsigned int len) { unsigned int i, j; 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); + pout[i] = ((unsigned int) pin[j]) | (((unsigned int) pin[j + 1]) << 8) | (((unsigned int) pin[j + 2]) + << 16) | (((unsigned int) pin[j + 3]) << 24); } /*------------------------------------------------------------------*/ @@ -1915,9 +1844,9 @@ 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; + 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; return serialdate; } @@ -1938,7 +1867,8 @@ 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; @@ -1961,7 +1891,8 @@ 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; @@ -1984,7 +1915,8 @@ 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; @@ -2007,7 +1939,8 @@ 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; @@ -2058,9 +1991,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) +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) { char buffer[256], charset[256], subject_enc[5000]; char buf[80], str[256]; @@ -2095,7 +2027,7 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, 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]) @@ -2111,8 +2043,8 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, 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); @@ -2132,12 +2064,12 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, 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)); @@ -2153,10 +2085,10 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, 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); @@ -2167,14 +2099,14 @@ void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to, 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 { @@ -2441,7 +2373,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); @@ -2527,7 +2459,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; } @@ -2595,7 +2527,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); @@ -2642,12 +2574,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); @@ -2663,9 +2595,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 @@ -2688,7 +2620,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]; @@ -2942,15 +2874,16 @@ 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') @@ -3009,8 +2942,9 @@ int getcfg_simple(char *group, char *param, char *value, int vsize, int conditio return 0; for (i = 0; i < (int) strlen(param); i++) - uparam[i] = toupper(param[i]); - uparam[i] = 0; + uparam[i] = toupper(param[i]) +; + uparam[i] = 0; value[0] = 0; for (i = 0; i < n_lb_config; i++) @@ -3046,18 +2980,18 @@ int enumgrp(int index, char *group) int getcfg(char *group, char *param, char *value, int vsize) /* - Read parameter from configuration file. + Read parameter from configuration file. - - if group == [global] and top group exists, read - from [global ] + - if group == [global] and top group exists, read + from [global ] - - if parameter not in [global ], read from [global] + - if parameter not in [global ], read from [global] - - if group is logbook, read from logbook section + - if group is logbook, read from logbook section - - if parameter not in [], read from [global ] - or [global] -*/ + - if parameter not in [], read from [global ] + or [global] + */ { char str[256]; int status; @@ -3198,7 +3132,7 @@ int exist_top_group() /*-------------------------------------------------------------------*/ -char *_locbuffer = NULL; +char *_locbuffer= NULL; char **_porig, **_ptrans; time_t _locfile_mtime = 0; @@ -3581,7 +3515,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') @@ -3591,11 +3525,9 @@ void el_enum_attr(char *message, int n, char *attr_name, char *attr_value) strcpy(tmp, str); *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")) + 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")) i--; } } @@ -3623,59 +3555,58 @@ 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); + case EOS: + return (*string == EOS ? 0 : 1); + case '?': + if (*string == EOS) + return (1); ++string; - } - return (1); - /* FALLTHROUGH */ - default: - if (c != *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); - string++; - break; + /* FALLTHROUGH */ + default: + if (c != *string) + return (1); + string++; + break; } } /*------------------------------------------------------------------*/ int ss_file_find(char *path, char *pattern, char **plist) -/********************************************************************\ - +/******************************************************************** Routine: ss_file_find - Purpose: Return list of files matching 'pattern' from the 'path' location + Purpose: Return list of files matching 'pattern' from the 'path' location - Input: - char *path Name of a file in file system to check - char *pattern pattern string (wildcard allowed) + Input: + char *path Name of a file in file system to check + char *pattern pattern string (wildcard allowed) - Output: - char **plist pointer to the file list + Output: + char **plist pointer to the file list - Function value: - int Number of files matching request + Function value: + int Number of files matching request -\********************************************************************/ + \********************************************************************/ { #ifdef OS_UNIX DIR *dir_pointer; @@ -3713,7 +3644,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)); @@ -3747,8 +3678,8 @@ int eli_compare(const void *e1, const void *e2) 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]; + char *file_list, str[256], error_str[256], date[256], dir[256], file_name[MAX_PATH_LENGTH], *buffer, *p, + *pn, in_reply_to[80]; int index, n, length; int i, fh, len; unsigned char digest[16]; @@ -3763,8 +3694,7 @@ int el_build_index(LOGBOOK * lbs, BOOL rebuild) if (strieq(lb_list[i].data_dir, lbs->data_dir)) break; - if (strieq(lb_list[i].data_dir, lbs->data_dir) - && &lb_list[i] != lbs) { + if (strieq(lb_list[i].data_dir, lbs->data_dir) && &lb_list[i] != lbs) { if (verbose) eprintf("\n Same index as logbook %s\n", lb_list[i].name); @@ -3874,10 +3804,9 @@ 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"); + 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"); for (i = 0; i < 16; i++) eprintf("%02X", lbs->el_index[*lbs->n_el_index].md5_digest[i]); @@ -3906,8 +3835,8 @@ int el_build_index(LOGBOOK * lbs, BOOL rebuild) if (verbose > 1) { 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); + eprintf(" ID %3d, %s, ofs %5d\n", lbs->el_index[i].message_id, lbs->el_index[i].file_name, + lbs->el_index[i].offset); } return EL_SUCCESS; @@ -3988,7 +3917,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) @@ -4085,7 +4014,6 @@ int el_index_logbooks() if (is_logbook_in_group(phier->member[i], lb_list[j].name)) strcpy(lb_list[j].top_group, phier->member[i]->name); - free_logbook_hierarchy(phier); } @@ -4098,20 +4026,19 @@ int el_index_logbooks() /*------------------------------------------------------------------*/ int el_search_message(LOGBOOK * lbs, int mode, int message_id, BOOL head_only) -/********************************************************************\ - +/******************************************************************** Routine: el_search_message - Purpose: Search for a specific message in a logbook + Purpose: Search for a specific message in a logbook - Input: - int mode Search mode, EL_FIRST, EL_LAST, EL_NEXT, EL_PREV - int message_id Message id for EL_NEXT and EL_PREV + Input: + int mode Search mode, EL_FIRST, EL_LAST, EL_NEXT, EL_PREV + int message_id Message id for EL_NEXT and EL_PREV - Function value: - int New message id + Function value: + int New message id -\********************************************************************/ + \********************************************************************/ { int i; @@ -4150,10 +4077,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++) @@ -4172,10 +4099,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--) @@ -4193,45 +4120,40 @@ 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) -/********************************************************************\ +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) +/******************************************************************** + Routine: el_retrieve - Routine: el_retrieve + Purpose: Retrieve an ELog entry by its message tab - Purpose: Retrieve an ELog entry by its message tab + Input: + LOGBOOK lbs Logbook structure + int message_id Message ID to retrieve + int *size Size of text buffer - Input: - LOGBOOK lbs Logbook structure - int message_id Message ID to retrieve - int *size Size of text buffer + Output: + char *tag tag of retrieved message + char *date Date/time of message recording + char attr_list Names of attributes + char attrib Values of attributes + int n_attr Number of attributes + char *text Message text + char *in_reply_to Original message if this one is a reply + char *reply_to Replies for current message + char *attachment[] File attachments + char *encoding Encoding of message + char *locked_by User/Host if locked for editing + int *size Actual message text size - Output: - char *tag tag of retrieved message - char *date Date/time of message recording - char attr_list Names of attributes - char attrib Values of attributes - int n_attr Number of attributes - char *text Message text - char *in_reply_to Original message if this one is a reply - char *reply_to Replies for current message - char *attachment[] File attachments - char *encoding Encoding of message - char *locked_by User/Host if locked for editing - int *size Actual message text size + Function value: + EL_SUCCESS Successful completion + EL_EMPTY Logbook is empty + EL_NO_MSG Message doesn't exist + EL_FILE_ERROR Internal error - Function value: - EL_SUCCESS Successful completion - EL_EMPTY Logbook is empty - EL_NO_MSG Message doesn't exist - EL_FILE_ERROR Internal error - -\********************************************************************/ + \********************************************************************/ { int i, index, size, fh; char str[NAME_LENGTH], file_name[256], *p; @@ -4256,8 +4178,8 @@ int el_retrieve(LOGBOOK * lbs, if (fh < 0) { /* 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); + return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr, text, textsize, in_reply_to, + reply_to, attachment, encoding, locked_by); } message = xmalloc(TEXT_SIZE + 1000); @@ -4277,8 +4199,8 @@ int el_retrieve(LOGBOOK * lbs, xfree(message); /* 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); + return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr, text, textsize, in_reply_to, + reply_to, attachment, encoding, locked_by); } /* check for correct ID */ @@ -4388,7 +4310,7 @@ int el_retrieve(LOGBOOK * lbs, /*------------------------------------------------------------------*/ 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; @@ -4401,24 +4323,22 @@ 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 */ if (file_name[0]) { - if (file_name[6] == '_' && file_name[13] == '_' && isdigit(file_name[0]) - && isdigit(file_name[1])) + if (file_name[6] == '_' && file_name[13] == '_' && isdigit(file_name[0]) && isdigit(file_name[1])) strlcpy(ext_file_name, file_name, sizeof(ext_file_name)); else { time(&now); 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); + 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); } if (full_name) @@ -4554,48 +4474,43 @@ 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) -/********************************************************************\ +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) +/******************************************************************** + Routine: el_submit - Routine: el_submit + Purpose: Submit an ELog entry - Purpose: Submit an ELog entry + Input: + LOGBOOK lbs Logbook structure + int message_id Message id + BOOL bedit TRUE for existing message, FALSE for new message + char *date Message date + char attr_name[][] Name of attributes + char attr_value[][] Value of attributes + int n_attr Number of attributes - Input: - LOGBOOK lbs Logbook structure - int message_id Message id - BOOL bedit TRUE for existing message, FALSE for new message - char *date Message date - char attr_name[][] Name of attributes - char attr_value[][] Value of attributes - int n_attr Number of attributes + char *text Message text + char *in_reply_to In reply to this message + char *reply_to Replie(s) to this message + char *encoding Text encoding, either HTML or plain - char *text Message text - char *in_reply_to In reply to this message - char *reply_to Replie(s) to this message - char *encoding Text encoding, either HTML or plain + char *afilename[] File name of attachments + char *tag If given, edit existing message + int *tag_size Maximum size of tag + BOOL mark_original Tag original message for replies + char *locked_by User/Host which locked message for edit - char *afilename[] File name of attachments - char *tag If given, edit existing message - int *tag_size Maximum size of tag - BOOL mark_original Tag original message for replies - char *locked_by User/Host which locked message for edit + Function value: + int New message ID - Function value: - int New message ID - -\********************************************************************/ + \********************************************************************/ { 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; + 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; char attachment_all[64 * MAX_ATTACHMENTS]; time_t ltime; @@ -4642,8 +4557,8 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, /* 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); + 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); } /* check for correct ID */ @@ -4829,8 +4744,8 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, if (lbs->el_index[i].message_id == message_id) break; - for (j = i + 1; - j < *lbs->n_el_index && strieq(lbs->el_index[i].file_name, lbs->el_index[j].file_name); j++) + 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].offset += delta; } @@ -4845,20 +4760,20 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, 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); + el_retrieve(lbs, reply_id, date, attr_list, attr, n_attr, message, &size, in_reply_to, reply_to, att, + enc, lock); if (reply_to[0]) strcat(reply_to, ", "); sprintf(reply_to + strlen(reply_to), "%d", message_id); /* 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); + el_submit(lbs, reply_id, TRUE, date, attr_list, attr, n_attr, message, in_reply_to, reply_to, enc, att, + TRUE, lock); } xfree(message); @@ -4869,16 +4784,15 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, 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; + 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; 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); + status = el_retrieve(lbs, message_id, date, attr_list, attr, lbs->n_attr, message, &size, in_reply_to, + reply_to, att, enc, lock); if (status != EL_SUCCESS) return; @@ -4906,39 +4820,36 @@ 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); + el_submit(lbs, message_id, TRUE, date, attr_list, attr, lbs->n_attr, message, in_reply_to, reply_to, enc, + att, TRUE, lock); xfree(message); } /*------------------------------------------------------------------*/ -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) -/********************************************************************\ +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) +/******************************************************************** + Routine: el_delete_message - Routine: el_delete_message + Purpose: Delete an ELog entry including attachments - Purpose: Delete an ELog entry including attachments + Input: + LOGBOOK *lbs Pointer to logbook structure + int message_id Message ID + BOOL delete_attachments Delete attachments if TRUE + char attachment Used to return attachments (on move) + BOOL delete_bw_ref If true, delete backward references + BOOL delete_reply_to If true, delete replies to this message - Input: - LOGBOOK *lbs Pointer to logbook structure - int message_id Message ID - BOOL delete_attachments Delete attachments if TRUE - char attachment Used to return attachments (on move) - BOOL delete_bw_ref If true, delete backward references - BOOL delete_reply_to If true, delete replies to this message + Output: + - Output: - + Function value: + EL_SUCCESS Successful completion - Function value: - EL_SUCCESS Successful completion - -\********************************************************************/ + \********************************************************************/ { int i, index, n, size, fh, tail_size, old_offset; char str[MAX_PATH_LENGTH], file_name[MAX_PATH_LENGTH], reply_to[MAX_REPLY_TO * 10], in_reply_to[256]; @@ -4980,8 +4891,8 @@ int el_delete_message(LOGBOOK * lbs, int message_id, /* 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); + return el_delete_message(lbs, message_id, delete_attachments, attachment, delete_bw_ref, + delete_reply_to); } /* check for correct ID */ @@ -5117,7 +5028,7 @@ int el_delete_message(LOGBOOK * lbs, int message_id, int el_correct_links(LOGBOOK * lbs, int old_id, int new_id) /* If a message gets resubmitted, the links to that message are wrong. -This routine corrects that. */ + This routine corrects that. */ { int i, i1, n, n1, size; char date[80], *attrib, *text, in_reply_to[80], reply_to[MAX_REPLY_TO * 10], encoding[80], locked_by[256]; @@ -5128,15 +5039,15 @@ This routine corrects that. */ text = xmalloc(TEXT_SIZE); 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); + 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); /* 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); + 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); n1 = strbreak(reply_to, list1, MAX_N_ATTR, ",", FALSE); reply_to[0] = 0; @@ -5151,19 +5062,19 @@ This routine corrects that. */ strcat(reply_to, ", "); } - 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); + 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); } - 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); + 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); /* 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); + 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); n1 = strbreak(in_reply_to, list1, MAX_N_ATTR, ",", FALSE); in_reply_to[0] = 0; @@ -5178,8 +5089,8 @@ This routine corrects that. */ strcat(in_reply_to, ", "); } - 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); + 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); } xfree(text); @@ -5194,21 +5105,21 @@ This routine corrects that. */ 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]; + 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]; char list[MAX_N_ATTR][NAME_LENGTH], str[256]; char att_file[MAX_ATTACHMENTS][256]; /* retrieve message */ 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); + el_retrieve(lbs, message_id, date, attr_list, attrib, lbs->n_attr, text, &size, in_reply_to, reply_to, + 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); + 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); xfree(text); @@ -5235,20 +5146,20 @@ int el_move_message_thread(LOGBOOK * lbs, int message_id) 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]; + 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]; /* 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); + 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); 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); + 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); xfree(text); @@ -5270,18 +5181,18 @@ int el_lock_message(LOGBOOK * lbs, int message_id, char *user) /* lock message for editing */ { 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]; + 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]; 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); + el_retrieve(lbs, message_id, date, attr_list, attrib, lbs->n_attr, text, &size, in_reply_to, reply_to, + 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); + el_submit(lbs, message_id, TRUE, date, attr_list, attrib, lbs->n_attr, text, in_reply_to, reply_to, + encoding, att_file, FALSE, user); return EL_SUCCESS; } @@ -5337,9 +5248,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') @@ -5354,35 +5265,35 @@ void write_logfile(LOGBOOK * lbs, const char *text) /*------------------------------------------------------------------*/ /* -void logd(const char *format, ...) -{ - va_list argptr; - char str[10000]; - FILE *f; - time_t now; - char buf[1000]; + void logd(const char *format, ...) + { + va_list argptr; + char str[10000]; + FILE *f; + time_t now; + char buf[1000]; - va_start(argptr, format); - vsprintf(str, (char *) format, argptr); - va_end(argptr); + va_start(argptr, format); + vsprintf(str, (char *) format, argptr); + va_end(argptr); - f = fopen("c:\\tmp\\elogd.log", "a"); - if (!f) - return; + f = fopen("c:\\tmp\\elogd.log", "a"); + if (!f) + return; - now = time(0); - strftime(buf, sizeof(buf), "%d-%b-%Y %H:%M:%S", localtime(&now)); - strcat(buf, " "); + now = time(0); + strftime(buf, sizeof(buf), "%d-%b-%Y %H:%M:%S", localtime(&now)); + strcat(buf, " "); - strlcat(buf, str, sizeof(buf)); - if (buf[strlen(buf) - 1] != '\n') - strlcat(buf, "\n", sizeof(buf)); + strlcat(buf, str, sizeof(buf)); + if (buf[strlen(buf) - 1] != '\n') + strlcat(buf, "\n", sizeof(buf)); - fprintf(f, buf); + fprintf(f, buf); - fclose(f); -} -*/ + fclose(f); + } + */ /*------------------------------------------------------------------*/ @@ -5396,8 +5307,9 @@ 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]); @@ -5436,8 +5348,9 @@ 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); @@ -5487,8 +5400,8 @@ 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); + return (stristr(att, ".GIF") != NULL) || (stristr(att, ".JPG") != NULL) || (stristr(att, ".JPEG") != NULL) + || (stristr(att, ".PNG") != NULL); } /*------------------------------------------------------------------*/ @@ -5562,7 +5475,8 @@ void replace_inline_img(LOGBOOK * lbs, char *str) /* now change href to absolute link */ pa = p - 1; - while (pa > str && *pa != '<') // search '' + while (pa > str && *pa != '<') + // search '' pa--; pn = strstr(pa, "href="); if (pn && pn - pa < 10) { @@ -5589,7 +5503,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; @@ -5614,8 +5528,8 @@ void convert_elog_link(LOGBOOK * lbs, char *link, char *link_text, char *result, compose_base_url(NULL, base_url, sizeof(base_url), FALSE); else base_url[0] = 0; - sprintf(result, "elog:%s", base_url, lbs->name_enc, - message_id, link, link_text); + sprintf(result, "elog:%s", base_url, lbs->name_enc, message_id, link, + link_text); } else { if (absolute_link) compose_base_url(lbs, base_url, sizeof(base_url), FALSE); @@ -5707,18 +5621,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; } } @@ -5760,45 +5674,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] != '[') + /* 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]; - 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]; } } } @@ -5817,22 +5731,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); } } } @@ -5844,113 +5758,110 @@ 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\""}, + /* 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]", ""}, + /* 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]", "
    "}, + { "[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=", "
        "}, + /* lists */ + { "[list]\r", "
          " }, + { "[list]", "
            " }, + { "[*]", "
          • " }, + { "[/list]\r", "" }, // either
          or
      + { "[/list]", "" }, + { "[list=", "
        " }, - /* headings */ - {"[h1]", "

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

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

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

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

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

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

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

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

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

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

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

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

        \r\n"}, - {"[/quote]", "
        \r\n"}, + /* quote */ + { + "[quote=", + "
        %s:
        " }, + { + "[quote]", + "
        %s:
        " }, + { "[/quote]\r", "

        \r\n" }, { "[/quote]", "
        \r\n" }, - /* table */ - {"[table]", "
        "}, - {"[table ", "
        "}, - {"|-", "
        "}, - {"|", ""}, - {"[/table]", "
        "}, + /* table */ + { "[table]", "\n\n"); /*---- entry form ----*/ @@ -9853,9 +9758,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* print required message if one of the attributes has it set */ for (i = 0; i < n_attr; i++) { if (attr_flags[i] & AF_REQUIRED) { - rsprintf - ("\n", - loc("Fields marked with"), loc("are required")); + rsprintf("\n", + loc("Fields marked with"), loc("are required")); break; } } @@ -9975,9 +9879,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("\n"); /* 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))) { + if ((attr_flags[index] & AF_LOCKED) || ((bedit && !breedit && !bupload) && (attr_flags[index] + & AF_FIXED_EDIT)) || (message_id && !bedit && (attr_flags[index] & AF_FIXED_REPLY))) { if (attr_flags[index] & AF_DATE) { @@ -10150,13 +10053,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"); @@ -10187,13 +10090,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"); @@ -10240,9 +10143,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"); } @@ -10256,35 +10159,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); @@ -10296,13 +10199,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"); @@ -10316,9 +10219,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"); @@ -10341,13 +10244,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"); @@ -10358,9 +10261,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"); @@ -10383,15 +10286,14 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL *strchr(str, '{') = 0; 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); + if (strstr(attrib[index], attr_options[index][i]) || strieq(str, enc_attr)) + rsprintf( + "\n", + str, ua, str); else - rsprintf - ("\n", - str, ua, str); + rsprintf( + "\n", + str, ua, str); rsprintf("\n", str, str); @@ -10403,9 +10305,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"); @@ -10417,23 +10319,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]) { @@ -10468,8 +10369,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL *strchr(str, '{') = 0; strencode2(enc_attr, attrib[index], sizeof(enc_attr)); - if (strieq(attr_options[index][i], attrib[index]) - || strieq(str, enc_attr)) + if (strieq(attr_options[index][i], attrib[index]) || strieq(str, enc_attr)) rsprintf("
        " }, { "[table ", "
        " }, { "|-", + "
        " }, { "|", "" }, { "[/table]", "
        " }, - /* horizontal line */ - {"[line]", "
        "}, + /* horizontal line */ + { "[line]", "
        " }, - /* anchor */ - {"[anchor]", ""}, - {"[/anchor]", ""}, - {"", ""} -}; + /* 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", loc("Retype new password")); rsprintf("\n"); - rsprintf - ("", - loc("Submit")); + rsprintf("", + loc("Submit")); rsprintf("
        %s:
        "; +char + *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; + char *p, *pd, link[1000], link_text[1000], tmp[1000], attrib[1000], hattrib[1000], value[1000], + 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); @@ -5969,8 +5880,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++) { @@ -5987,7 +5898,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--; @@ -6006,7 +5917,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); @@ -6016,7 +5927,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); } @@ -6025,31 +5936,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) { @@ -6078,7 +5989,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str) } } if (key_list[l][0]) - continue; + continue; substituted = FALSE; @@ -6086,9 +5997,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] == '\\') { @@ -6096,7 +6007,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; @@ -6107,12 +6018,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] == '=') { @@ -6121,23 +6032,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... } } @@ -6150,30 +6061,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; @@ -6196,24 +6107,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)); } @@ -6222,13 +6133,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) { @@ -6274,19 +6185,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 { @@ -6296,17 +6207,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) { @@ -6317,21 +6228,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; } @@ -6339,59 +6250,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); @@ -6450,8 +6361,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; } @@ -6463,8 +6374,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; } @@ -6488,9 +6399,10 @@ 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; } @@ -6790,7 +6702,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)); @@ -6937,7 +6849,7 @@ void redirect(LOGBOOK * lbs, char *rel_path) int strbreak(char *str, char list[][NAME_LENGTH], int size, char *brk, BOOL ignore_quotes) /* break comma-separated list into char array, stripping leading -and trailing blanks */ + and trailing blanks */ { int i, j; char *p; @@ -7014,7 +6926,7 @@ and trailing blanks */ int scan_attributes(char *logbook) /* scan configuration file for attributes and fill attr_list, attr_options -and attr_flags arrays */ + and attr_flags arrays */ { char list[10000], str[NAME_LENGTH], type[NAME_LENGTH], tmp_list[MAX_N_ATTR][NAME_LENGTH]; int i, j, n, m; @@ -7146,7 +7058,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); @@ -7195,7 +7107,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]; @@ -7207,8 +7119,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 */ @@ -7271,7 +7183,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); @@ -7435,8 +7347,8 @@ LBLIST get_logbook_hierarchy(void) if (root->member[i]) { 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) { + if (i != j && root->member[j] != NULL && (pgrp = get_subgroup(root->member[j], + root->member[i]->name)) != NULL) { /* node is allocated twice, so free one... */ xfree(*pgrp); @@ -7472,7 +7384,8 @@ 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 *)); @@ -7606,8 +7519,7 @@ 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"); @@ -7616,25 +7528,22 @@ 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)) { + if (!printable && (!getcfg(logbook, "logbook tabs", str, sizeof(str)) || atoi(str) == 1)) { for (level = 0;; level++) { rsprintf("\n
        \n"); - if (level == 0 && getcfg("global", "main tab", str, sizeof(str)) - && !getcfg_topgroup()) { + if (level == 0 && getcfg("global", "main tab", str, sizeof(str)) && !getcfg_topgroup()) { if (getcfg("global", "main tab url", url, sizeof(url))) rsprintf("%s\n", url, str); else rsprintf("%s\n", str); } - if (level == 1 && getcfg("global", "main tab", str, sizeof(str)) - && getcfg_topgroup()) { + if (level == 1 && getcfg("global", "main tab", str, sizeof(str)) && getcfg_topgroup()) { if (getcfg("global", "main tab url", url, sizeof(url))) rsprintf("%s\n", url, str); else @@ -7644,8 +7553,7 @@ void show_standard_title(char *logbook, char *text, int printable) /* iterate through members of this group */ for (i = 0; i < pnode->n_members; i++) { - if (getcfg(pnode->member[i]->name, "Hidden", str, sizeof(str)) - && atoi(str) == 1) + if (getcfg(pnode->member[i]->name, "Hidden", str, sizeof(str)) && atoi(str) == 1) continue; strlcpy(str, pnode->member[i]->name, sizeof(str)); @@ -7654,10 +7562,11 @@ 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 - while (flb->member) // so traverse hierarchy + flb = pnode->member[i]->member[0]; // current node is group + while (flb->member) + // so traverse hierarchy flb = flb->member[0]; strlcpy(ref, flb->name, sizeof(ref)); } @@ -7845,9 +7754,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)); } /*------------------------------------------------------------------*/ @@ -7895,9 +7804,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)); } /*------------------------------------------------------------------*/ @@ -7914,17 +7823,17 @@ void show_error(char *error) rsprintf("
        "); /* - rsprintf("\n"); + rsprintf("\n"); - rsprintf("\n"); */ rsprintf("
        \n"); @@ -7934,7 +7843,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); @@ -7948,10 +7857,8 @@ 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"); @@ -7983,7 +7890,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; @@ -8005,7 +7912,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"); } @@ -8090,8 +7997,9 @@ 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)) @@ -8148,42 +8056,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]); } } } @@ -8196,39 +8104,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]); } } } @@ -8241,21 +8149,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]); } } } @@ -8269,35 +8177,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]); } } } @@ -8305,7 +8213,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]; @@ -8415,8 +8323,8 @@ void add_subst_list(char list[][NAME_LENGTH], char value[][NAME_LENGTH], char *i strlcpy(value[(*i)++], str, NAME_LENGTH); } -void add_subst_time(LOGBOOK * lbs, - char list[][NAME_LENGTH], char value[][NAME_LENGTH], char *item, char *date, int *i) +void add_subst_time(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_LENGTH], char *item, + char *date, int *i) { char format[80], str[256]; time_t ltime; @@ -8499,12 +8407,10 @@ void show_change_pwd_page(LOGBOOK * lbs) wrong_pwd = FALSE; if (old_pwd[0] || new_pwd[0]) { - if (user[0] - && get_user_line(lbs, user, act_pwd, NULL, NULL, NULL, NULL)) { + 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) @@ -8547,7 +8453,7 @@ void show_change_pwd_page(LOGBOOK * lbs) if (wrong_pwd == 2) rsprintf("
        %s!
        \n"); @@ -8574,9 +8480,8 @@ void show_change_pwd_page(LOGBOOK * lbs) rsprintf("
        %s:
        \n"); show_bottom_text(lbs); @@ -8587,7 +8492,7 @@ void show_change_pwd_page(LOGBOOK * lbs) void get_auto_index(LOGBOOK * lbs, int index, char *format, char *retstr, int size) /* return value of specific attribute of last entry, can be used to -auto-increment tags */ + auto-increment tags */ { int i, message_id, loc, len, old_index; char str[NAME_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH], att[MAX_ATTACHMENTS][256]; @@ -8633,9 +8538,9 @@ auto-increment tags */ if (strlen(attrib[index]) > 0 && strncmp(attrib[index], retstr, loc) != 0) old_index = 0; else - /* retrieve old index */ - if (atoi(attrib[index] + loc) > old_index) - old_index = atoi(attrib[index] + loc); + /* retrieve old index */ + if (atoi(attrib[index] + loc) > old_index) + old_index = atoi(attrib[index] + loc); message_id = el_search_message(lbs, EL_PREV, message_id, FALSE); @@ -8760,9 +8665,8 @@ void show_date_selector(int day, int month, int year, char *index) rsprintf("\n"); if (year) - rsprintf - (" %s: ", - loc("Year"), index, year); + rsprintf(" %s: ", loc("Year"), + index, year); else rsprintf(" %s: ", loc("Year"), index); @@ -8943,9 +8847,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; @@ -8997,20 +8902,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; - 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]; + 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]; time_t now, ltime; char fl[8][NAME_LENGTH]; struct tm *pts; @@ -9074,8 +8980,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* get message for reply/edit */ 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); + el_retrieve(lbs, message_id, date, attr_list, attrib, lbs->n_attr, text, &size, orig_tag, reply_tag, + att, encoding, locked_by); get_author(lbs, attrib, orig_author); @@ -9094,12 +9000,12 @@ 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")) { + if (message_id && getcfg(lbs->name, "Use Lock", str, sizeof(str)) && atoi(str) == 1 && locked_by[0] + && !isparam("steal")) { sprintf(str, "%d", message_id); sprintf(text, "%s %s", loc("Entry is currently edited by"), locked_by); show_query(lbs, loc("Entry is locked"), text, loc("Edit anyhow"), "?cmd=Edit&steal=1", loc("Cancel"), - str); + str); return; } @@ -9109,13 +9015,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 */ @@ -9125,13 +9031,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"); } @@ -9156,12 +9062,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); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9181,8 +9087,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL 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); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9203,8 +9109,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL 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); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9241,12 +9147,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); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9264,11 +9170,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); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9286,11 +9192,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); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); strsubst_list(preset, sizeof(preset), slist, svalue, i); /* check for index substitution */ @@ -9306,10 +9212,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL } } - } else // if (_condition[0]) + } else + // if (_condition[0]) n_attr = lbs->n_attr; - /* check for maximum number of replies */ if (breply) { i = 0; @@ -9328,8 +9234,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL } /* check for author */ - if (bedit && getcfg(lbs->name, "Restrict edit", str, sizeof(str)) - && atoi(str) == 1) { + if (bedit && getcfg(lbs->name, "Restrict edit", str, sizeof(str)) && atoi(str) == 1) { if (!is_author(lbs, attrib, owner)) { sprintf(str, loc("Only user %s can edit this entry"), owner); strencode2(str2, str, sizeof(str2)); @@ -9390,8 +9295,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (orig_tag[0] == 0) { /* do not format date for date attributes */ - i = build_subst_list(lbs, slist, svalue, attrib, - (attr_flags[index] & (AF_DATE | AF_DATETIME)) == 0); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 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); @@ -9409,8 +9314,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL if (getcfg(lbs->name, str, preset, sizeof(preset))) { /* do not format date for date attributes */ - i = build_subst_list(lbs, slist, svalue, attrib, - (attr_flags[index] & (AF_DATE | AF_DATETIME)) == 0); + i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME)) + == 0); sprintf(str, "%d", message_id); add_subst_list(slist, svalue, "message id", str, &i); @@ -9655,7 +9560,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) @@ -9667,8 +9572,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("}\n\n"); if (enc_selected != 2) { - if (!getcfg(lbs->name, "Message height", str, sizeof(str)) && - !getcfg(lbs->name, "Message width", str, sizeof(str))) { + if (!getcfg(lbs->name, "Message height", str, sizeof(str)) && !getcfg(lbs->name, "Message width", str, + sizeof(str))) { /* javascript for resizing edit box */ rsprintf("\nfunction init_resize()\n"); rsprintf("{\n"); @@ -9777,8 +9682,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL strcpy(script_onload, "document.form1.Text.focus();"); if (enc_selected == 0) { - if (!getcfg(lbs->name, "Message height", str, sizeof(str)) && - !getcfg(lbs->name, "Message width", str, sizeof(str))) { + if (!getcfg(lbs->name, "Message height", str, sizeof(str)) && !getcfg(lbs->name, "Message width", str, + sizeof(str))) { strcat(script_onload, "elKeyInit();init_resize();"); strcat(script_onfocus, "elKeyInit();"); @@ -9837,12 +9742,12 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* default cmd */ rsprintf("\n", loc("Update")); - rsprintf - ("\n", loc("Submit")); - rsprintf - ("\n", loc("Preview")); - rsprintf - ("\n", loc("Back")); + rsprintf("\n", + loc("Submit")); + rsprintf("\n", + loc("Preview")); + rsprintf("\n", + loc("Back")); rsprintf("
        %s * %s
        %s * %s
        ", - ua, attr_options[index][i]); + rsprintf( + "", + ua, attr_options[index][i]); else - rsprintf - ("", - ua, attr_options[index][i]); + rsprintf("", ua, + 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); + rsprintf("\"%s\"\n", attr_options[index][i], + comment, comment); else - rsprintf("\"%s\"\n", - attr_options[index][i], attr_options[index][i], attr_options[index][i]); + rsprintf("\"%s\"\n", attr_options[index][i], + attr_options[index][i], attr_options[index][i]); rsprintf("