]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
BUGFIX
authorhadaq <hadaq>
Fri, 13 Aug 2004 08:55:38 +0000 (08:55 +0000)
committerhadaq <hadaq>
Fri, 13 Aug 2004 08:55:38 +0000 (08:55 +0000)
hadaq/netmem.c

index 2f841f6c67aa22fb9baf015a4c149717f2700fa8..61ca6fe1194690b51fb8a6baf813a842b98524cb 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/netmem.c,v 6.26 2003-05-14 13:54:44 muench Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/netmem.c,v 6.27 2004-08-13 08:55:38 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -30,9 +30,7 @@ typedef struct TheArgsS {
        unsigned long priority;
        unsigned long queueSize;
        char verbosity[PARAM_MAX_VALUE_LEN];
-}
-
-TheArgs;
+} TheArgs;
 
 static jmp_buf terminateJmp;
 
@@ -79,6 +77,11 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[])
 {
        extern char *optarg;
        int i;
+       int inPathCntFromParam;
+
+       /* inPath must _overwrite_, not add to param */
+       inPathCntFromParam = my->inPathCnt;
+       my->inPathCnt = 0;
 
        while ((i = getopt(argc, argv, "ai:m:q:p:v:")) != -1) {
                switch (i) {
@@ -105,6 +108,12 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[])
                        break;
                }
        }
+
+       /* restore inPathCnt only if it ws not touched here */
+       if (my->inPathCnt == 0) {
+               my->inPathCnt = inPathCntFromParam;
+       }
+
        return 0;
 }
 
@@ -114,8 +123,7 @@ static int argsFromParam(TheArgs *my, int argc, char *argv[])
        int paramWasFound;
 
        conSetupParam(param, getenv("DAQ_SETUP"));
-       Param_getStringArray(param, argv[0], "inpath",
-                                                MAXINPATH, &my->inPathCnt, my->inPath);
+       Param_getStringArray(param, argv[0], "inpath", MAXINPATH, &my->inPathCnt, my->inPath);
        Param_getInt(param, argv[0], "nrofmsgs", &paramWasFound, &my->nrOfMsgs);
        Param_getInt(param, argv[0], "stndln", &paramWasFound, &my->isStandalone);
        Param_getInt(param, argv[0], "prio", &paramWasFound, &my->priority);
@@ -145,25 +153,16 @@ static void statsDump(TheArgs *theArgs, NetTrans **my, int interval)
        int i;
 
 
-       if (theArgs->isStandalone
-               && strcmp(theArgs->verbosity, "info") == 0
-               && (dT = (time(NULL) - lastTime)) >= interval
-               ) {
+       if (theArgs->isStandalone && strcmp(theArgs->verbosity, "info") == 0 && (dT = (time(NULL) - lastTime)) >= interval) {
                fputs("==============================================================================\n", stderr);
                for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                       fprintf(stderr, "%17s%02d:%6s",
-                                       "pktsReceived", i, unit(*my[i]->pktsReceived));
-                       fprintf(stderr, "%17s%02d:%6s",
-                                       "pktsDiscarded", i, unit(*my[i]->pktsDiscarded));
-                       fprintf(stderr, "%15s%02d  :%6s",
-                                       "bytesReceived", i, unit(*my[i]->bytesReceived));
+                       fprintf(stderr, "%17s%02d:%6s", "pktsReceived", i, unit(*my[i]->pktsReceived));
+                       fprintf(stderr, "%17s%02d:%6s", "pktsDiscarded", i, unit(*my[i]->pktsDiscarded));
+                       fprintf(stderr, "%15s%02d  :%6s", "bytesReceived", i, unit(*my[i]->bytesReceived));
                        fputc('\n', stderr);
-                       fprintf(stderr, "%17s%02d:%6s",
-                                       "msgsReceived", i, unit(*my[i]->msgsReceived));
-                       fprintf(stderr, "%17s%02d:%6s",
-                                       "msgsDiscarded", i, unit(*my[i]->msgsDiscarded));
-                       fprintf(stderr, "%15s%02d/s:%6s",
-                                       "bytesReceived", i, unit(*my[i]->bytesReceived - lastBR[i]));
+                       fprintf(stderr, "%17s%02d:%6s", "msgsReceived", i, unit(*my[i]->msgsReceived));
+                       fprintf(stderr, "%17s%02d:%6s", "msgsDiscarded", i, unit(*my[i]->msgsDiscarded));
+                       fprintf(stderr, "%15s%02d/s:%6s", "bytesReceived", i, unit(*my[i]->bytesReceived - lastBR[i]));
                        lastBR[i] = *my[i]->bytesReceived;
                        fputc('\n', stderr);
                        fputs("------------------------------------------------------------------------------\n", stderr);
@@ -232,8 +231,7 @@ int main(int argc, char *argv[])
                usage(argv[0]);
                exit(EXIT_FAILURE);
        }
-       for (i = 0; prioritynames[i].c_name != NULL
-                && 0 != strcmp(prioritynames[i].c_name, theArgs->verbosity); i++) {
+       for (i = 0; prioritynames[i].c_name != NULL && 0 != strcmp(prioritynames[i].c_name, theArgs->verbosity); i++) {
        }
        if (prioritynames[i].c_name == NULL) {
                exit(EXIT_FAILURE);