[Pidgin] #10182: "--config" option with "-" in folder name causes error messages

Pidgin trac at pidgin.im
Thu Sep 3 08:05:00 EDT 2009


#10182: "--config" option with "-" in folder name causes error messages
--------------------------+-------------------------------------------------
 Reporter:  darkfoxprime  |        Owner:  datallah       
     Type:  defect        |       Status:  pending        
Milestone:                |    Component:  winpidgin (gtk)
  Version:  2.6.1         |   Resolution:                 
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by darkfoxprime):

  * status:  pending => new


Comment:

 My first thought is that having unexplained error messages show up for no
 visible reason should not be considered normal programming practice and
 tossed off as "unfortunate".

 Looking at the WinMain code, I don't see why you would be using strstr for
 the -h option anyway - or if you're going to use it because strncmp
 doesn't exist or is buggy or something, then check the return value to
 make sure the -h is at the beginning of the arg - or, even easier, don't
 bother to check unless the arg begins with a dash.  Why would it ever be
 correct for -h (or -d or -v or -m) to appear in the middle of a word,
 especially one that did not begin with a dash, and still be considered a
 valid option?

         /* If debug or help or version flag used, create console for
 output */
         for (i = 1; i < __argc; i++) {
                 if (__argv[i][0] == '-') {
                         if (strstr(__argv[i], "-d") || strstr(__argv[i], "
 --debug"))
                                 debug = TRUE;
                         else if (strstr(__argv[i], "-h") ||
 strstr(__argv[i], "--help"))
                                 help = TRUE;
                         else if (strstr(__argv[i], "-v") ||
 strstr(__argv[i], "--version"))
                                 version = TRUE;
                         else if (strstr(__argv[i], "-m") ||
 strstr(__argv[i], "--multiple"))
                                 multiple = TRUE;
                 }
         }

-- 
Ticket URL: <http://developer.pidgin.im/ticket/10182#comment:3>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list