(file) Return to main.cpp CVS log (file) (dir) Up to [OMI] / omi / gen

Diff for /omi/gen/main.cpp between version 1.3 and 1.4

version 1.3, 2015/04/20 18:10:12 version 1.4, 2015/04/20 18:19:52
Line 29 
Line 29 
 #include <common.h> #include <common.h>
 #include <gen/gen.h> #include <gen/gen.h>
 #include <base/paths.h> #include <base/paths.h>
 #include <base/io.h>  #include <pal/format.h>
 #include <base/env.h> #include <base/env.h>
 #include <base/conf.h> #include <base/conf.h>
 #include <base/getopt.h>  #include <base/omigetopt.h>
   #include <windows/config.h>
  
 static const char HELP[] = "\ static const char HELP[] = "\
 Usage: %s [OPTIONS] PATH CLASSNAME[=ALIAS] ...\n\ Usage: %s [OPTIONS] PATH CLASSNAME[=ALIAS] ...\n\
Line 53 
Line 54 
     -D                          Generate 'Description' qualifiers.\n\     -D                          Generate 'Description' qualifiers.\n\
     -V                          Generate 'Values' and 'ValueMap' qualifiers.\n\     -V                          Generate 'Values' and 'ValueMap' qualifiers.\n\
     -M                          Generate 'MappingStrings' qualifiers.\n\     -M                          Generate 'MappingStrings' qualifiers.\n\
       -O                          Generate 'ModelCorrespondence' qualifiers.\n\
     -S                          Generate standard CIM qualifier declarations.\n\     -S                          Generate standard CIM qualifier declarations.\n\
     -B                          Generate boolean qualifiers.\n\     -B                          Generate boolean qualifiers.\n\
     -Q                          Suppress qualifier declarations generation.\n\     -Q                          Suppress qualifier declarations generation.\n\
Line 68 
Line 70 
     -A                          Generate single association function.\n\     -A                          Generate single association function.\n\
     -e CLASS                    Generate extra class with this name.\n\     -e CLASS                    Generate extra class with this name.\n\
     -y NAME                     Use NAME as entry point (default MI_Main).\n\     -y NAME                     Use NAME as entry point (default MI_Main).\n\
     -W                          Print MOF warnings (suppressed by default).\n\      --no-warnings               Print no warnings.\n\
     -C, --schemafile PATH       Alternative path of main CIM schema file.\n\     -C, --schemafile PATH       Alternative path of main CIM schema file.\n\
     -m PROVIDERNAME             Generate provider makefile.\n\     -m PROVIDERNAME             Generate provider makefile.\n\
     --nogi CLASSNAME            Set MI_ProviderFT.GetInstance to NULL for\n\     --nogi CLASSNAME            Set MI_ProviderFT.GetInstance to NULL for\n\
Line 205 
Line 207 
         "-D",         "-D",
         "-V",         "-V",
         "-M",         "-M",
           "-O",
         "-S",         "-S",
         "-B",         "-B",
         "-Q",         "-Q",
         "-f",         "-f",
         "-q",         "-q",
         "-W",          "--no-warnings",
         "-a",         "-a",
         "-n",         "-n",
         "--cpp",         "--cpp",
Line 253 
Line 256 
         else if (strcmp(state.opt, "-v") == 0 ||         else if (strcmp(state.opt, "-v") == 0 ||
                  strcmp(state.opt, "--version") == 0)                  strcmp(state.opt, "--version") == 0)
         {         {
   #if defined(CONFIG_OS_WINDOWS)
               printf(ZT("%s: %S\n"), arg0,
                   CONFIG_PRODUCT L"-" CONFIG_VERSION L" - " CONFIG_DATE);
   #else
             printf("%s: %s\n", arg0,             printf("%s: %s\n", arg0,
                 CONFIG_PRODUCT "-" CONFIG_VERSION " - " CONFIG_DATE);                 CONFIG_PRODUCT "-" CONFIG_VERSION " - " CONFIG_DATE);
   #endif
             exit(0);             exit(0);
         }         }
         else if (strcmp(state.opt, "-D") == 0)         else if (strcmp(state.opt, "-D") == 0)
Line 269 
Line 277 
         {         {
             options.mappingStrings = true;             options.mappingStrings = true;
         }         }
           else if (strcmp(state.opt, "-O") == 0)
           {
               options.modelCorrespondence = true;
           }
         else if (strcmp(state.opt, "-S") == 0)         else if (strcmp(state.opt, "-S") == 0)
         {         {
             options.standardQualifiers = true;             options.standardQualifiers = true;
Line 289 
Line 301 
         {         {
             options.quiet = true;             options.quiet = true;
         }         }
         else if (strcmp(state.opt, "-W") == 0)          else if (strcmp(state.opt, "--no-warnings") == 0)
         {         {
             options.warnings = true;              options.no_warnings = true;
         }         }
         else if (strcmp(state.opt, "-a") == 0)         else if (strcmp(state.opt, "-a") == 0)
         {         {
Line 352 
Line 364 
         {         {
             options.noGetInstance.push_back(state.arg);             options.noGetInstance.push_back(state.arg);
         }         }
           else if (strncmp(state.opt, "--", 2) == 0 && IsNickname(state.opt+2))
           {
               if (SetPathFromNickname(state.opt+2, state.arg) != 0)
                   err(ZT("SetPathFromNickname() failed"));
           }
     }     }
 } }
  
Line 367 
Line 384 
 // //
 //============================================================================== //==============================================================================
  
 static int FindConfigFile(char path[MAX_PATH_SIZE])  static int FindConfigFile(_Pre_writable_size_(PAL_MAX_PATH_SIZE) char path[PAL_MAX_PATH_SIZE])
 { {
     /* Look in current directory */     /* Look in current directory */
     {     {
         Strlcpy(path, "./.omigenrc", MAX_PATH_SIZE);          Strlcpy(path, "./.omigenrc", PAL_MAX_PATH_SIZE);
  
         if (access(path, R_OK) == 0)         if (access(path, R_OK) == 0)
             return 0;             return 0;
Line 381 
Line 398 
     char* home = Dupenv("HOME");     char* home = Dupenv("HOME");
     if (home)     if (home)
     {     {
         Strlcpy(path, home, MAX_PATH_SIZE);          Strlcpy(path, home, PAL_MAX_PATH_SIZE);
         Strlcat(path, "/.omigenrc", MAX_PATH_SIZE);          Strlcat(path, "/.omigenrc", PAL_MAX_PATH_SIZE);
  
         if (access(path, R_OK) == 0)         if (access(path, R_OK) == 0)
         {         {
             free(home);              PAL_Free(home);
             return 0;             return 0;
         }         }
         free(home);          PAL_Free(home);
     }     }
  
     /* Look in system config directory */     /* Look in system config directory */
     {     {
         Strlcpy(path, GetPath(ID_DESTDIR), MAX_PATH_SIZE);          Strlcpy(path, OMI_GetPath(ID_DESTDIR), PAL_MAX_PATH_SIZE);
         Strlcat(path, "/", MAX_PATH_SIZE);          Strlcat(path, "/", PAL_MAX_PATH_SIZE);
         Strlcat(path, GetPath(ID_SYSCONFDIR), MAX_PATH_SIZE);          Strlcat(path, OMI_GetPath(ID_SYSCONFDIR), PAL_MAX_PATH_SIZE);
         Strlcat(path, "/omigen.conf", MAX_PATH_SIZE);          Strlcat(path, "/omigen.conf", PAL_MAX_PATH_SIZE);
  
         if (access(path, R_OK) == 0)         if (access(path, R_OK) == 0)
             return 0;             return 0;
Line 417 
Line 434 
  
 static void _GetConfigFileOptions(GeneratorOptions& opts) static void _GetConfigFileOptions(GeneratorOptions& opts)
 { {
     char path[MAX_PATH_SIZE];      char path[PAL_MAX_PATH_SIZE];
     Conf* conf;     Conf* conf;
  
     MI_UNUSED(opts);     MI_UNUSED(opts);
Line 490 
Line 507 
     }     }
 } }
  
 int main(int argc, const char** argv)  int MI_MAIN_CALL main(int argc, const char** argv)
 { {
     arg0 = argv[0];     arg0 = argv[0];
     GeneratorOptions options;     GeneratorOptions options;
Line 518 
Line 535 
     _GetCommandLineDestDirOption(&argc, argv);     _GetCommandLineDestDirOption(&argc, argv);
  
     // Set path of default CIM schema file.     // Set path of default CIM schema file.
     schemafile = GetPath(ID_SCHEMAFILE);      schemafile = OMI_GetPath(ID_SCHEMAFILE);
  
     // Get configuraiton file options.     // Get configuraiton file options.
     _GetConfigFileOptions(options);     _GetConfigFileOptions(options);


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

ViewCVS 0.9.2