Panda3D
 All Classes Functions Variables Enumerations
preprocess_argv.cxx
00001 // Filename: preprocess_argv.cxx
00002 // Created by:  drose (08Nov11)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "preprocess_argv.h"
00016 #include "win32ArgParser.h"
00017 
00018 ////////////////////////////////////////////////////////////////////
00019 //     Function: preprocess_argv
00020 //  Description: Processes the argc, argv pair as needed before
00021 //               passing it to getopt().  If this program is running
00022 //               on Windows, but not within Cygwin, this ignores the
00023 //               incoming argv, argv values, replacing them from the
00024 //               GetCommandLine() string, and expanding glob patterns
00025 //               like *.egg to a list of all matching egg files.  On
00026 //               other platforms, this function does nothing and
00027 //               returns argc, argv unchanged.
00028 //
00029 //               The argc and argv values are modified by this
00030 //               function, if necessary, to point to
00031 //               statically-allocated memory that will be valid until
00032 //               the next call to preprocess_argv().
00033 ////////////////////////////////////////////////////////////////////
00034 void
00035 preprocess_argv(int &argc, char **&argv) {
00036 #ifndef _WIN32
00037   // Not Windows: do nothing.
00038 #else  // _WIN32
00039   // Temporarily commenting out to fix build.  Revisit shortly.
00040   static Win32ArgParser parser;
00041   if (!parser.do_glob()) {
00042     // No globbing required.
00043     return;
00044   }
00045 
00046   // Globbing is required.  Process the args.
00047   parser.set_system_command_line();
00048   argc = parser.get_argc();
00049   argv = parser.get_argv();
00050 #endif  // _WIN32
00051 }
 All Classes Functions Variables Enumerations