fix build - failure caused by CREAM orig_timestamp
authorJan Pospíšil <honik@ntc.zcu.cz>
Mon, 2 Nov 2009 19:59:15 +0000 (19:59 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Mon, 2 Nov 2009 19:59:15 +0000 (19:59 +0000)
- 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
org.glite.lb.client/src/args.h
org.glite.lb.client/src/logevent.c.T

index d140c2f..10e1b5b 100644 (file)
@@ -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;
index 879dc60..57d6f72 100644 (file)
@@ -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 {
index 634abf8..8df365c 100644 (file)
@@ -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} }