|
@@ -12,9 +12,6 @@
|
|
* You should have received a copy of the GNU General Public License
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
*/
|
|
-#define string_strcmp
|
|
|
|
-#define string_strrchr
|
|
|
|
-#define string_strlen
|
|
|
|
#include "admin/Admin.h"
|
|
#include "admin/Admin.h"
|
|
#include "admin/AdminClient.h"
|
|
#include "admin/AdminClient.h"
|
|
#include "admin/angel/InterfaceWaiter.h"
|
|
#include "admin/angel/InterfaceWaiter.h"
|
|
@@ -49,9 +46,9 @@
|
|
#include "net/SwitchPinger.h"
|
|
#include "net/SwitchPinger.h"
|
|
#include "net/SwitchPinger_admin.h"
|
|
#include "net/SwitchPinger_admin.h"
|
|
#include "switch/SwitchCore.h"
|
|
#include "switch/SwitchCore.h"
|
|
|
|
+#include "util/CString.h"
|
|
#include "util/ArchInfo.h"
|
|
#include "util/ArchInfo.h"
|
|
#include "util/SysInfo.h"
|
|
#include "util/SysInfo.h"
|
|
-#include "util/platform/libc/string.h"
|
|
|
|
#include "util/events/EventBase.h"
|
|
#include "util/events/EventBase.h"
|
|
#include "util/events/Pipe.h"
|
|
#include "util/events/Pipe.h"
|
|
#include "util/events/Process.h"
|
|
#include "util/events/Process.h"
|
|
@@ -446,9 +443,9 @@ int main(int argc, char** argv)
|
|
|
|
|
|
if (isatty(STDIN_FILENO) || argc < 2) {
|
|
if (isatty(STDIN_FILENO) || argc < 2) {
|
|
// Fall through.
|
|
// Fall through.
|
|
- } else if (!strcmp("angel", argv[1])) {
|
|
|
|
|
|
+ } else if (!CString_strcmp("angel", argv[1])) {
|
|
return AngelInit_main(argc, argv);
|
|
return AngelInit_main(argc, argv);
|
|
- } else if (!strcmp("core", argv[1])) {
|
|
|
|
|
|
+ } else if (!CString_strcmp("core", argv[1])) {
|
|
return Core_main(argc, argv);
|
|
return Core_main(argc, argv);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -462,22 +459,24 @@ int main(int argc, char** argv)
|
|
|
|
|
|
if (argc == 2) {
|
|
if (argc == 2) {
|
|
// one argument
|
|
// one argument
|
|
- if ((strcmp(argv[1], "--help") == 0) || (strcmp(argv[1], "-h") == 0)) {
|
|
|
|
|
|
+ if ((CString_strcmp(argv[1], "--help") == 0) || (CString_strcmp(argv[1], "-h") == 0)) {
|
|
return usage(allocator, argv[0]);
|
|
return usage(allocator, argv[0]);
|
|
- } else if (strcmp(argv[1], "--genconf") == 0) {
|
|
|
|
|
|
+ } else if (CString_strcmp(argv[1], "--genconf") == 0) {
|
|
return genconf(rand);
|
|
return genconf(rand);
|
|
- } else if (strcmp(argv[1], "--pidfile") == 0) {
|
|
|
|
|
|
+ } else if (CString_strcmp(argv[1], "--pidfile") == 0) {
|
|
// deprecated
|
|
// deprecated
|
|
fprintf(stderr, "'--pidfile' option is deprecated.\n");
|
|
fprintf(stderr, "'--pidfile' option is deprecated.\n");
|
|
return 0;
|
|
return 0;
|
|
- } else if (strcmp(argv[1], "--reconf") == 0) {
|
|
|
|
|
|
+ } else if (CString_strcmp(argv[1], "--reconf") == 0) {
|
|
// Performed after reading the configuration
|
|
// Performed after reading the configuration
|
|
- } else if (strcmp(argv[1], "--bench") == 0) {
|
|
|
|
|
|
+ } else if (CString_strcmp(argv[1], "--bench") == 0) {
|
|
return benchmark();
|
|
return benchmark();
|
|
- } else if ((strcmp(argv[1], "--version") == 0) || (strcmp(argv[1], "-v") == 0)) {
|
|
|
|
|
|
+ } else if ((CString_strcmp(argv[1], "--version") == 0)
|
|
|
|
+ || (CString_strcmp(argv[1], "-v") == 0))
|
|
|
|
+ {
|
|
printf("Cjdns protocol version: %d\n", Version_CURRENT_PROTOCOL);
|
|
printf("Cjdns protocol version: %d\n", Version_CURRENT_PROTOCOL);
|
|
return 0;
|
|
return 0;
|
|
- } else if (strcmp(argv[1], "--cleanconf") == 0) {
|
|
|
|
|
|
+ } else if (CString_strcmp(argv[1], "--cleanconf") == 0) {
|
|
// Performed after reading configuration
|
|
// Performed after reading configuration
|
|
} else {
|
|
} else {
|
|
fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], argv[1]);
|
|
fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], argv[1]);
|
|
@@ -489,7 +488,7 @@ int main(int argc, char** argv)
|
|
fprintf(stderr, "%s: too many arguments\n", argv[0]);
|
|
fprintf(stderr, "%s: too many arguments\n", argv[0]);
|
|
fprintf(stderr, "Try `%s --help' for more information.\n", argv[0]);
|
|
fprintf(stderr, "Try `%s --help' for more information.\n", argv[0]);
|
|
// because of '--pidfile $filename'?
|
|
// because of '--pidfile $filename'?
|
|
- if (strcmp(argv[1], "--pidfile") == 0)
|
|
|
|
|
|
+ if (CString_strcmp(argv[1], "--pidfile") == 0)
|
|
{
|
|
{
|
|
fprintf(stderr, "\n'--pidfile' option is deprecated.\n");
|
|
fprintf(stderr, "\n'--pidfile' option is deprecated.\n");
|
|
}
|
|
}
|
|
@@ -513,7 +512,7 @@ int main(int argc, char** argv)
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- if (argc == 2 && strcmp(argv[1], "--cleanconf") == 0) {
|
|
|
|
|
|
+ if (argc == 2 && CString_strcmp(argv[1], "--cleanconf") == 0) {
|
|
struct Writer* stdoutWriter = FileWriter_new(stdout, allocator);
|
|
struct Writer* stdoutWriter = FileWriter_new(stdout, allocator);
|
|
JsonBencSerializer_get()->serializeDictionary(stdoutWriter, &config);
|
|
JsonBencSerializer_get()->serializeDictionary(stdoutWriter, &config);
|
|
printf("\n");
|
|
printf("\n");
|
|
@@ -530,7 +529,7 @@ int main(int argc, char** argv)
|
|
if (!adminPass) {
|
|
if (!adminPass) {
|
|
adminPass = String_newBinary(NULL, 32, allocator);
|
|
adminPass = String_newBinary(NULL, 32, allocator);
|
|
Random_base32(rand, (uint8_t*) adminPass->bytes, 32);
|
|
Random_base32(rand, (uint8_t*) adminPass->bytes, 32);
|
|
- adminPass->len = strlen(adminPass->bytes);
|
|
|
|
|
|
+ adminPass->len = CString_strlen(adminPass->bytes);
|
|
}
|
|
}
|
|
if (!adminBind) {
|
|
if (!adminBind) {
|
|
Except_throw(eh, "You must specify admin.bind in the cjdroute.conf file.");
|
|
Except_throw(eh, "You must specify admin.bind in the cjdroute.conf file.");
|