Got it .... trailing spaces in the put-together command line, cause an extra
argv[] item.

ntop @/etc/ntop/ntoptest.conf -u ntop -- works
ntop -u ntop @/etc/ntop/ntoptest.conf -- fails

I'll finish testing and put it into the cvs.

If you use this, watch out for line wrap...
============================================================================
=====================
--- ntop/main.c 2003-06-30 01:50:19.000000000 -0500
+++ ntop/main.c 2003-07-11 07:02:24.000000000 -0500
@@ -1005,7 +1005,12 @@
   printf("PARAM_DEBUG: effective cmd line: '%s'\n", cmdLineBuffer);
 #endif

-  if(cmdLineBuffer[strlen(cmdLineBuffer)-1] == ' ')
cmdLineBuffer[strlen(cmdLineBuffer)-1] = '\0';
+  /* Strip trailing spaces */
+  while((strlen(cmdLineBuffer) > 1) &&
+        (cmdLineBuffer[strlen(cmdLineBuffer)-1] == ' ')) {
+      cmdLineBuffer[strlen(cmdLineBuffer)-1] = '\0';
+  }
+
 #ifndef WIN32
   effective_argv=buildargv(cmdLineBuffer); /* Build a new argv[] from the
string */

============================================================================
=====================


-----Burton

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Aaron
Grewell
Sent: Thursday, June 26, 2003 3:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [Ntop] NTop CVS issue continued


Sure, np.  NTop was configured at compile time as follows:
./configure --prefix=/usr --sysconfdir=/var --localstate=/var

My configuration file looks more or less like this (minus the comments and
such):
----------------------------------------------------------------------------
---------------------------------------
--daemon
--db-file-path "/var/ntop"
--domain uwb.edu
--interface eth0
--local-subnets
"192.168.64.0/24,192.168.65.0/24,192.168.66.0/24,192.168.67.0/24
,192.168.68.0/24,192.168.69.0/24,192.168.70.0/24,192.168.71.0/24,192.168.72.
0/24
,192.168.73.0/24,192.168.74.0/24,192.168.75.0/24,192.168.76.0/24,192.168.77.
0/24
,192.168.78.0/24,192.168.79.0/24,192.168.80.0/24,192.168.81.0/24,192.168.82.
0/24
"
--http-server 3000
--https-server 3001
--no-mac
----------------------------------------------------------------------------
---------------------------------------

NTop is invoked in the initscript as follows:
ntop -u ntop @/etc/ntop/ntop.conf

The box is RH 7.3 running a vanilla Marcelo 2.4.20 kernel.

rpm -qa | grep glibc returns:
glibc-2.2.5-43
glibc-kernheaders-2.4-7.16
glibc-devel-2.2.5-43
glibc-common-2.2.5-43

I have tried the above NTop options both at the command-line and in the
file.
At the command-line I can use short options regardless.  Long options do not
work.

Test 1: Long options in a file
If I set the first (and only) entry in my configfile to '--daemon' here is
what happens:
----------------------------------------------------------------------------
---------------------------------------
[EMAIL PROTECTED] ntop]# ntop -u ntop @/etc/ntop/ntoptest.conf
Wait please: ntop is coming up...
   Processing file /etc/ntop/ntoptest.conf for parameters...
ntop: invalid option -- -
FATAL ERROR: unknown ntop option, '?'
----------------------------------------------------------------------------
---------------------------------------

If I set it to '-d':
----------------------------------------------------------------------------
---------------------------------------
[EMAIL PROTECTED] ntop]# ntop -u ntop @/etc/ntop/ntoptest.conf
Wait please: ntop is coming up...
   Processing file /etc/ntop/ntoptest.conf for parameters...
FATAL ERROR: Unrecognized/unprocessed ntop options...


run ntop --help for usage information

    Common problems:
        -B "filter expressions" (quotes are required)
        --use-syslog=facilty (the = is required)
----------------------------------------------------------------------------
---------------------------------------

This is not what I thought was happening, there's something else going on.
It
failed here even with the short option.  There's only one line in my
ntoptest.conf file, and it contains only '-d'.  I verified this just to be
sure.

Just for grins I added another line containing '-o'.  Now it starts
successfully.  Having only one option in a file appears to break NTop.

Changing from '-o' to '--no-mac' gives the same error as above with
'--daemon'.  There is still an issue with long options, even when we have
multiple options in the file.

Test 2: Long options at the command line
If I use this command line:
ntop -u ntop -i eth0

NTop starts fine.

If I use this command line:
ntop -u ntop --interface eth0

It gives the same error as in the long option in a file case.

I have not been able to replicate the problem I was having with short
options
that take arguments.  That was probably an error on my part.

HTH,
-Aaron

On Thursday 26 June 2003 12:39 pm, Burton M. Strauss III wrote:
> You might supply some configuration info - it might be that in moving
stuff
> around, Rocco munged something.
>
> See, there are two versions of getopt_long, one which is native to your
> glibc and one which is the libiberty code which is in util.c (2.2) or
> getopt.c (2.2.1+).
>
> -----Burton
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Aaron
> Grewell
> Sent: Thursday, June 26, 2003 2:08 PM
> To: [EMAIL PROTECTED]
> Subject: [Ntop] NTop CVS issue continued
>
>
> In fact, reading from files appears fairly well borked in CVS.  Short
> options
> that do not take arguments work fine.  All others fail.  I'm not a CVS
> expert.  I just followed the instructions and did a 'cvs checkout .'  Am I
> using the wrong branch or something?
> _______________________________________________
> Ntop mailing list
> [EMAIL PROTECTED]
> http://listgateway.unipi.it/mailman/listinfo/ntop
>
> _______________________________________________
> Ntop mailing list
> [EMAIL PROTECTED]
> http://listgateway.unipi.it/mailman/listinfo/ntop

_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop

_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop

Reply via email to