mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Adjusted indentation
SVN revision: 883
This commit is contained in:
parent
2d45f661a5
commit
6442fbb266
81
src/elogd.c
81
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.331 2004/06/04 15:05:01 midas
|
||||||
|
Adjusted indentation
|
||||||
|
|
||||||
Revision 1.330 2004/06/04 14:51:40 midas
|
Revision 1.330 2004/06/04 14:51:40 midas
|
||||||
Implemented stristr
|
Implemented stristr
|
||||||
|
|
||||||
@ -839,7 +842,7 @@ char *stristr(const char *str, const char *pattern)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (*str) {
|
while (*str) {
|
||||||
ps = (char *)str;
|
ps = (char *) str;
|
||||||
c1 = *str;
|
c1 = *str;
|
||||||
c2 = *pattern;
|
c2 = *pattern;
|
||||||
if (my_toupper(c1) == my_toupper(c2)) {
|
if (my_toupper(c1) == my_toupper(c2)) {
|
||||||
@ -852,7 +855,7 @@ char *stristr(const char *str, const char *pattern)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!*pattern)
|
if (!*pattern)
|
||||||
return (char *)str;
|
return (char *) str;
|
||||||
}
|
}
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
@ -1407,20 +1410,19 @@ void _MD5_decode(unsigned int *pout, unsigned char *pin, unsigned int len)
|
|||||||
|
|
||||||
void serialdate2date(double days, int *day, int *month, int *year)
|
void serialdate2date(double days, int *day, int *month, int *year)
|
||||||
/* convert days since 1.1.1900 to date */
|
/* convert days since 1.1.1900 to date */
|
||||||
|
|
||||||
{
|
{
|
||||||
int i,j, l, n;
|
int i, j, l, n;
|
||||||
|
|
||||||
l = (int)days + 68569 + 2415019;
|
l = (int) days + 68569 + 2415019;
|
||||||
n = (int)(( 4 * l ) / 146097);
|
n = (int) ((4 * l) / 146097);
|
||||||
l = l - (int)(( 146097 * n + 3 ) / 4);
|
l = l - (int) ((146097 * n + 3) / 4);
|
||||||
i = (int)(( 4000 * ( l + 1 ) ) / 1461001);
|
i = (int) ((4000 * (l + 1)) / 1461001);
|
||||||
l = l - (int)(( 1461 * i ) / 4) + 31;
|
l = l - (int) ((1461 * i) / 4) + 31;
|
||||||
j = (int)(( 80 * l ) / 2447);
|
j = (int) ((80 * l) / 2447);
|
||||||
*day = l - (int)(( 2447 * j ) / 80);
|
*day = l - (int) ((2447 * j) / 80);
|
||||||
l = (int)(j / 11);
|
l = (int) (j / 11);
|
||||||
*month = j + 2 - ( 12 * l );
|
*month = j + 2 - (12 * l);
|
||||||
*year = 100 * ( n - 49 ) + i + l;
|
*year = 100 * (n - 49) + i + l;
|
||||||
}
|
}
|
||||||
|
|
||||||
double date2serialdate(int day, int month, int year)
|
double date2serialdate(int day, int month, int year)
|
||||||
@ -1428,10 +1430,10 @@ double date2serialdate(int day, int month, int year)
|
|||||||
{
|
{
|
||||||
int serialdate;
|
int serialdate;
|
||||||
|
|
||||||
serialdate = (int)(( 1461 * ( year + 4800 + (int)(( month - 14 ) / 12) ) ) / 4) +
|
serialdate = (int) ((1461 * (year + 4800 + (int) ((month - 14) / 12))) / 4) +
|
||||||
(int)(( 367 * ( month - 2 - 12 * ( ( month - 14 ) / 12 ) ) ) / 12) -
|
(int) ((367 * (month - 2 - 12 * ((month - 14) / 12))) / 12) -
|
||||||
(int)(( 3 * ( (int)(( year + 4900 + (int)(( month - 14 ) / 12) ) / 100) ) ) / 4) +
|
(int) ((3 * ((int) ((year + 4900 + (int) ((month - 14) / 12)) / 100))) / 4) +
|
||||||
day - 2415019 - 32075;
|
day - 2415019 - 32075;
|
||||||
|
|
||||||
return serialdate;
|
return serialdate;
|
||||||
}
|
}
|
||||||
@ -4283,7 +4285,8 @@ int el_correct_links(LOGBOOK * lbs, int old_id, int new_id)
|
|||||||
This routine corrects that. */
|
This routine corrects that. */
|
||||||
{
|
{
|
||||||
int i, i1, n, n1, size;
|
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];
|
char date[80], *attrib, *text, in_reply_to[80], reply_to[MAX_REPLY_TO * 10],
|
||||||
|
encoding[80], locked_by[256];
|
||||||
char list[MAX_N_ATTR][NAME_LENGTH], list1[MAX_N_ATTR][NAME_LENGTH];
|
char list[MAX_N_ATTR][NAME_LENGTH], list1[MAX_N_ATTR][NAME_LENGTH];
|
||||||
char *att_file;
|
char *att_file;
|
||||||
|
|
||||||
@ -4291,15 +4294,16 @@ This routine corrects that. */
|
|||||||
text = malloc(TEXT_SIZE);
|
text = malloc(TEXT_SIZE);
|
||||||
att_file = malloc(MAX_ATTACHMENTS * 256);
|
att_file = malloc(MAX_ATTACHMENTS * 256);
|
||||||
|
|
||||||
el_retrieve(lbs, new_id, date, attr_list, (void *) attrib, lbs->n_attr, NULL, 0, in_reply_to,
|
el_retrieve(lbs, new_id, date, attr_list, (void *) attrib, lbs->n_attr, NULL, 0,
|
||||||
reply_to, (void *)att_file, encoding, locked_by);
|
in_reply_to, reply_to, (void *) att_file, encoding, locked_by);
|
||||||
|
|
||||||
/* go through in_reply_to list */
|
/* go through in_reply_to list */
|
||||||
n = strbreak(in_reply_to, list, MAX_N_ATTR, ",");
|
n = strbreak(in_reply_to, list, MAX_N_ATTR, ",");
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
size = TEXT_SIZE;
|
size = TEXT_SIZE;
|
||||||
el_retrieve(lbs, atoi(list[i]), date, attr_list, (void *)attrib, lbs->n_attr,
|
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);
|
text, &size, in_reply_to, reply_to, (void *) att_file, encoding,
|
||||||
|
locked_by);
|
||||||
|
|
||||||
n1 = strbreak(reply_to, list1, MAX_N_ATTR, ",");
|
n1 = strbreak(reply_to, list1, MAX_N_ATTR, ",");
|
||||||
reply_to[0] = 0;
|
reply_to[0] = 0;
|
||||||
@ -4314,19 +4318,21 @@ This routine corrects that. */
|
|||||||
strcat(reply_to, ", ");
|
strcat(reply_to, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
el_submit(lbs, atoi(list[i]), TRUE, date, attr_list, (void *)attrib, lbs->n_attr,
|
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);
|
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,
|
el_retrieve(lbs, new_id, date, attr_list, (void *) attrib, lbs->n_attr, NULL, 0,
|
||||||
reply_to, (void *)att_file, encoding, locked_by);
|
in_reply_to, reply_to, (void *) att_file, encoding, locked_by);
|
||||||
|
|
||||||
/* go through reply_to list */
|
/* go through reply_to list */
|
||||||
n = strbreak(reply_to, list, MAX_N_ATTR, ",");
|
n = strbreak(reply_to, list, MAX_N_ATTR, ",");
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
size = sizeof(text);
|
size = sizeof(text);
|
||||||
el_retrieve(lbs, atoi(list[i]), date, attr_list, (void *)attrib, lbs->n_attr,
|
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);
|
text, &size, in_reply_to, reply_to, (void *) att_file, encoding,
|
||||||
|
locked_by);
|
||||||
|
|
||||||
n1 = strbreak(in_reply_to, list1, MAX_N_ATTR, ",");
|
n1 = strbreak(in_reply_to, list1, MAX_N_ATTR, ",");
|
||||||
in_reply_to[0] = 0;
|
in_reply_to[0] = 0;
|
||||||
@ -4341,8 +4347,9 @@ This routine corrects that. */
|
|||||||
strcat(in_reply_to, ", ");
|
strcat(in_reply_to, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
el_submit(lbs, atoi(list[i]), TRUE, date, attr_list, (void *)attrib, lbs->n_attr,
|
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);
|
text, in_reply_to, reply_to, encoding, (void *) att_file, TRUE,
|
||||||
|
locked_by);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(text);
|
free(text);
|
||||||
@ -4970,7 +4977,7 @@ void set_location(LOGBOOK * lbs, char *rel_path)
|
|||||||
if (!str[0] && strstr(http_host, "localhost")) {
|
if (!str[0] && strstr(http_host, "localhost")) {
|
||||||
strcpy(str, "http://localhost");
|
strcpy(str, "http://localhost");
|
||||||
if (tcp_port != 80)
|
if (tcp_port != 80)
|
||||||
sprintf(str+strlen(str), ":%d", tcp_port);
|
sprintf(str + strlen(str), ":%d", tcp_port);
|
||||||
strcat(str, "/");
|
strcat(str, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4978,7 +4985,7 @@ void set_location(LOGBOOK * lbs, char *rel_path)
|
|||||||
/* assemble absolute path from host name and port */
|
/* assemble absolute path from host name and port */
|
||||||
sprintf(str, "http://%s", host_name);
|
sprintf(str, "http://%s", host_name);
|
||||||
if (tcp_port != 80)
|
if (tcp_port != 80)
|
||||||
sprintf(str+strlen(str), ":%d", tcp_port);
|
sprintf(str + strlen(str), ":%d", tcp_port);
|
||||||
strcat(str, "/");
|
strcat(str, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6713,7 +6720,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
|
|
||||||
/* do not format date for date attributes */
|
/* do not format date for date attributes */
|
||||||
i = build_subst_list(lbs, slist, svalue, attrib,
|
i = build_subst_list(lbs, slist, svalue, attrib,
|
||||||
(attr_flags[index] & AF_DATE) == 0);
|
(attr_flags[index] & AF_DATE) == 0);
|
||||||
sprintf(str, "%d", message_id);
|
sprintf(str, "%d", message_id);
|
||||||
add_subst_list(slist, svalue, "message id", str, &i);
|
add_subst_list(slist, svalue, "message id", str, &i);
|
||||||
add_subst_time(lbs, slist, svalue, "entry time", date, &i);
|
add_subst_time(lbs, slist, svalue, "entry time", date, &i);
|
||||||
@ -6732,7 +6739,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
|
|
||||||
/* do not format date for date attributes */
|
/* do not format date for date attributes */
|
||||||
i = build_subst_list(lbs, slist, svalue, attrib,
|
i = build_subst_list(lbs, slist, svalue, attrib,
|
||||||
(attr_flags[index] & AF_DATE) == 0);
|
(attr_flags[index] & AF_DATE) == 0);
|
||||||
|
|
||||||
sprintf(str, "%d", message_id);
|
sprintf(str, "%d", message_id);
|
||||||
add_subst_list(slist, svalue, "message id", str, &i);
|
add_subst_list(slist, svalue, "message id", str, &i);
|
||||||
@ -12360,8 +12367,8 @@ void show_elog_list(LOGBOOK * lbs, INT past_n, INT last_n, INT page_n, char *inf
|
|||||||
else
|
else
|
||||||
strlcat(_cmdline, "?reverse=0", sizeof(_cmdline));
|
strlcat(_cmdline, "?reverse=0", sizeof(_cmdline));
|
||||||
}
|
}
|
||||||
if (_cmdline[strlen(_cmdline)-1] == '&')
|
if (_cmdline[strlen(_cmdline) - 1] == '&')
|
||||||
_cmdline[strlen(_cmdline)-1] = 0;
|
_cmdline[strlen(_cmdline) - 1] = 0;
|
||||||
redirect(lbs, _cmdline);
|
redirect(lbs, _cmdline);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user