(file) Return to getoopt.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / getoopt

Diff for /pegasus/src/Pegasus/getoopt/getoopt.cpp between version 1.25 and 1.26

version 1.25, 2003/04/30 18:26:55 version 1.26, 2003/07/28 16:52:54
Line 33 
Line 33 
 // implementation of getoopt // implementation of getoopt
  
 #include <Pegasus/Common/PegasusVersion.h> #include <Pegasus/Common/PegasusVersion.h>
   #include <Pegasus/Common/MessageLoader.h> //l10n
  
 #include "getoopt.h" #include "getoopt.h"
 #include <cctype> #include <cctype>
Line 277 
Line 278 
 Boolean Boolean
 getoopt::addFlagspec(char flag, Boolean hasarg) { getoopt::addFlagspec(char flag, Boolean hasarg) {
   if (flag == '*') {   if (flag == '*') {
     addError("You can't have a flag named '*'");          //l10n
           MessageLoaderParms parms("getoopt.getoopt.CANT_NAME_FLAG",
                                                            "You can't have a flag named '$0'",
                                                            flag);
           addError(MessageLoader::getMessage(parms));
       //addError("You can't have a flag named '*'");
       //l10n end
     return false;     return false;
   }   }
   flagspec fs;   flagspec fs;
Line 447 
Line 454 
               String temp = argv[i];               String temp = argv[i];
               String name = temp.subString(argpos, 1);               String name = temp.subString(argpos, 1);
               if (!fs) {  // See if we recognize it               if (!fs) {  // See if we recognize it
                 addError("Unknown flag -" + name);                  //l10n
                   MessageLoaderParms parms("getoopt.getoopt.UNKNOWN_FLAG",
                                                                    "Unknown flag $0$1",
                                                                    "-",
                                                                    name);
                   addError(MessageLoader::getMessage(parms));
                           //addError("Unknown flag -" + name);
                           //l10n end
                 argpos++;                 argpos++;
               } else {               } else {
                 if (fs->argtype == NOARG) {  // Should this flag be bound                 if (fs->argtype == NOARG) {  // Should this flag be bound
Line 472 
Line 486 
             optargFromLongOpt(o, arg);             optargFromLongOpt(o, arg);
             fs = getFlagspec(o.getName());             fs = getFlagspec(o.getName());
             if (!fs) { // see if we recognize this flag             if (!fs) { // see if we recognize this flag
               String temp = "Unknown flag ";                  //l10n
               addError(temp + o.getName());                //String temp = "Unknown flag ";
                 //addError(temp + o.getName());
                 MessageLoaderParms parms("getoopt.getoopt.UNKNOWN_FLAG",
                                                              "Unknown flag $0$1",
                                                              "",
                                                              o.getName());
                 addError(MessageLoader::getMessage(parms));
                 //l10n end
             } else {             } else {
                 // this is a long flag we know about                 // this is a long flag we know about
               if (o.optarg() != ""  || fs->argtype != MUSTHAVEARG) {               if (o.optarg() != ""  || fs->argtype != MUSTHAVEARG) {
Line 492 
Line 513 
  
       case ARGEXPECTED:       case ARGEXPECTED:
         if (argv[i][0] == '-') {         if (argv[i][0] == '-') {
           addError("Missing required value for flag " + o.getopt());                  //l10n
             //addError("Missing required value for flag " + o.getopt());
             MessageLoaderParms parms("getoopt.getoopt.MISSING_VALUE_FOR_FLAG",
                                                      "Missing required value for flag $0",
                                                      o.getopt());
             addError(MessageLoader::getMessage(parms));
             //l10n end
           i--;           i--;
         } else {         } else {
           o.setValue(argv[i]);           o.setValue(argv[i]);
Line 503 
Line 530 
       } // end switch       } // end switch
   } // end for   } // end for
   if (state != START) {   if (state != START) {
     addError("Missing required value for flag " + o.getName());          //l10n
       //addError("Missing required value for flag " + o.getName());
       MessageLoaderParms parms("getoopt.getoopt.MISSING_VALUE_FOR_FLAG",
                                                      "Missing required value for flag $0",
                                                      o.getName());
             addError(MessageLoader::getMessage(parms));
       //l10n end
   }   }
   copyargs(_args, nonflagargs);   copyargs(_args, nonflagargs);
   return !_errorStrings.size();   return !_errorStrings.size();


Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2