From 5871a51bb74ce8afea53e29a86a73cd061029292 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Posp=C3=AD=C5=A1il?= Date: Mon, 2 Nov 2009 19:59:15 +0000 Subject: [PATCH] fix build - failure caused by CREAM orig_timestamp - timeval handling, more changes will be probably needed (pravdepodobne to bude chtit napsat korektne read_timeval v args.c.T, to az budete logovat pomoci logevent) --- org.glite.lb.client/src/args.c.T | 26 ++++++++++++++++++++++++++ org.glite.lb.client/src/args.h | 1 + org.glite.lb.client/src/logevent.c.T | 4 +++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/org.glite.lb.client/src/args.c.T b/org.glite.lb.client/src/args.c.T index d140c2f..10e1b5b 100644 --- a/org.glite.lb.client/src/args.c.T +++ b/org.glite.lb.client/src/args.c.T @@ -281,6 +281,29 @@ static void read_source(const edg_wll_Args* o, char* arg, char* par) *(edg_wll_Source*)o->value = s; } +/* FIXME: parse timeval from string correctly */ +static void read_timeval(const edg_wll_Args* o, char* arg, char* par) +{ + int v = 0; + if (!par) + { + printf("Option: %s - missing timeval value\n", arg); + exit(1); + } + sscanf(par, "%i", &v); + if (o->min != o->max) + { + if (v < o->min && v > o->max) + { + printf("Option: %s - value: %d out of range <%d, %d>", + arg, v, o->min, o->max); + exit(1); + } + } + if (o->value) + *(int*)o->value = v; +} + static void show_help(const edg_wll_Args* o, int prefix) { unsigned max = 0; @@ -499,6 +522,9 @@ static int findOpt(opt_ctx_t* ctx, int olong) exit(0); //case EDG_WLL_ARGS_SUBOPTIONS: //parse_suboptions((const edg_wll_Args*)o->value, arg, par, regname); + case EDG_WLL_ARGS_TIMEVAL: + read_timeval(o, arg, par); + break; default: printf("FIXME: unhandle option type %d\n", o->type); break; diff --git a/org.glite.lb.client/src/args.h b/org.glite.lb.client/src/args.h index 879dc60..57d6f72 100644 --- a/org.glite.lb.client/src/args.h +++ b/org.glite.lb.client/src/args.h @@ -16,6 +16,7 @@ typedef enum { EDG_WLL_ARGS_OPTIONS, EDG_WLL_ARGS_SUBOPTIONS, EDG_WLL_ARGS_SELECTSTRING, + EDG_WLL_ARGS_TIMEVAL, } edg_wll_ArgsCode; typedef struct { diff --git a/org.glite.lb.client/src/logevent.c.T b/org.glite.lb.client/src/logevent.c.T index 634abf8..8df365c 100644 --- a/org.glite.lb.client/src/logevent.c.T +++ b/org.glite.lb.client/src/logevent.c.T @@ -27,6 +27,7 @@ #define ENABLE_REASON_LENGTH static int flesh_seq(int); +static const struct timeval null_timeval = {0,0}; int main(int argc, char *argv[]) { @@ -104,7 +105,8 @@ int main(int argc, char *argv[]) "glite_jobid_t", "EDG_WLL_ARGS_JOBID", "edg_wll_NotifId", "EDG_WLL_ARGS_NOTIFID", "edg_wll_Source", "EDG_WLL_ARGS_SOURCE", - "uint16_t", "EDG_WLL_ARGS_UINT16" + "uint16_t", "EDG_WLL_ARGS_UINT16", + "struct timeval", "EDG_WLL_ARGS_TIMEVAL" ); my %vars = (); for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} } -- 1.8.2.3