this is still borken

piwakawaka:~# aptitude -qq update
Expected a number after -q=, got q
piwakawaka:~#

which is a lie, there was no -q=

Here's the relevant code from main.cc in aptitude-0.4.1:

        case 'q':
          if(optarg == 0)
            ++quiet;
          else
            {
              if(*optarg == '=')
                ++optarg;

              if(*optarg == 0)
                {
                  fprintf(stderr, _("Expected a number after -q=\n"));
                  return -1;
                }

              char *tmp;
              quiet = strtol(optarg, &tmp, 0);

              if(*tmp != '\0')
                {
                  fprintf(stderr, _("Expected a number after -q=, got %s\n"),
                          optarg);
                  return -1;
                }
            }
          seen_quiet = true;
          break;

Obviously the block dealing with the parameters needs to be defined contingent on the existance of the "=".

        case 'q':
          if(optarg == 0)
            ++quiet;
          else
            {
              if(*optarg == '=')
                {
                  ++optarg;

                  if(*optarg == 0)
                    {
                      fprintf(stderr, _("Expected a number after -q=\n"));
                      return -1;
                    }

                  char *tmp;
                  quiet = strtol(optarg, &tmp, 0);

                  if(*tmp != '\0')
                    {
                      fprintf(stderr, _("Expected a number after -q=, got 
%s\n"),
                        optarg);
                      return -1;
                    }
                }
            }
          seen_quiet = true;
          break;

which then gives the behaviour where

        aptitude -q -q moo
        aptitude -q=2 moo
        aptitude -vVsq upgrade

work while

        aptitude -qq moo
        aptitude -qvvv moo
        aptitude -qvVs upgrade

fail as all options after the first q are ignored.

I also changed the line

        {"quiet", 2, NULL, 'q'},

in opts[]={ to

        {"quiet", 0, NULL, 'q'},

but it still doesn't behave as I would expect.

The -q=n syntax is anomalous, every other option uses -x <value>. I suggest that -q= be deprecated and that -qqq or -q n be encouraged instead.

I can't spend any more time on this now and I'm at almost all at sea.

Perhaps a proficient coder could have a look-see.

A side note: Attempting to compile aptitude throws up a linker error about not being able to find cppunit. I assume this should be added as a build-depends ?

The docs may need some attention after all this.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to