#include <ndb_global.h>#include <ndb_version.h>#include <mgmapi_configuration.hpp>#include <NdbMain.h>#include <Properties.hpp>#include "InitConfigFileParser.hpp"#include <Config.hpp>Include dependency graph for mkconfig.cpp:

Go to the source code of this file.
Functions | |
| void | usage (const char *prg) |
| NDB_COMMAND (mkconfig,"mkconfig","mkconfig","Make a binary configuration from a config file", 16384) | |
| NDB_COMMAND | ( | mkconfig | , | |
| "mkconfig" | , | |||
| "mkconfig" | , | |||
| "Make a binary configuration from a config file" | , | |||
| 16384 | ||||
| ) |
Definition at line 32 of file mkconfig.cpp.
References buf, f, ConfigValues::getPackedSize(), ndb_mgm_configuration::m_config, Config::m_configValues, ndb_init(), ConfigValues::pack(), parser, and usage().
00034 { 00035 ndb_init(); 00036 if(argc < 3){ 00037 usage(argv[0]); 00038 return 0; 00039 } 00040 00041 InitConfigFileParser parser; 00042 Config* _cp; 00043 00044 if ((_cp = parser.parseConfig(argv[1])) == 0) 00045 return false; 00046 00047 ConfigValues* cp = &_cp->m_configValues->m_config; 00048 Uint32 sz = cp->getPackedSize(); 00049 UtilBuffer buf; 00050 if(!cp->pack(buf)) 00051 return -1; 00052 00053 FILE * f = fopen(argv[2], "w"); 00054 if(fwrite(buf.get_data(), 1, buf.length(), f) != sz){ 00055 fclose(f); 00056 unlink(argv[2]); 00057 return -1; 00058 } 00059 fclose(f); 00060 return 0; 00061 }
Here is the call graph for this function:

| void usage | ( | const char * | prg | ) |
1.4.7

