Bryan Drewery 21 سال پیش
والد
کامیت
6679b221fd
2فایلهای تغییر یافته به همراه8 افزوده شده و 5 حذف شده
  1. 5 2
      src/main.c
  2. 3 3
      src/misc.c

+ 5 - 2
src/main.c

@@ -273,8 +273,8 @@ static void show_help()
 }
 
 // leaf: BkLP
-#define PARSE_FLAGS "0234:B:c:Cd:De:Eg:G:k:L:P:hnr:stu:U:v"
-#define FLAGS_CHECKPASS "CdDeEgGhknrtuUv"
+#define PARSE_FLAGS STR("0234:aB:c:Cd:De:Eg:G:k:L:P:hnr:stu:U:v")
+#define FLAGS_CHECKPASS STR("CdDeEgGhknrtuUv")
 static void dtx_arg(int argc, char *argv[])
 {
   int i = 0;
@@ -298,6 +298,9 @@ static void dtx_arg(int argc, char *argv[])
         fix_tilde(&conf.binpath);
         parseconf(0);
         conf_to_bin(&conf, 0, 6);		/* this will exit() in write_settings() */
+      case 'a':
+        unlink(binname);
+        exit(0);
       case 'B':
         localhub = 0;
         used_B = 1;

+ 3 - 3
src/misc.c

@@ -650,7 +650,7 @@ int updatebin(int idx, char *par, int secs)
   }
 
   /* The binary should return '2' when ran with -2, if not it's probably corrupt. */
-  egg_snprintf(testbuf, sizeof testbuf, "%s -2", path);
+  egg_snprintf(testbuf, sizeof testbuf, STR("%s -2"), path);
 #ifndef CYGWIN_HACKS
   putlog(LOG_DEBUG, "*", "Running for update binary test: %s", testbuf);
   i = system(testbuf);
@@ -663,7 +663,7 @@ int updatebin(int idx, char *par, int secs)
 #endif /* !CYGWIN_HACKS */
 
   /* now to send our config to the new binary */
-  egg_snprintf(testbuf, sizeof testbuf, "%s -4 %s", path, conffile->file);
+  egg_snprintf(testbuf, sizeof testbuf, STR("%s -4 %s"), path, conffile->file);
 #ifndef CYGWIN_HACKS
   putlog(LOG_DEBUG, "*", "Running for update conf: %s", testbuf);
   i = system(testbuf);
@@ -701,7 +701,7 @@ int updatebin(int idx, char *par, int secs)
     char buf[DIRMAX] = "";
 
     /* this forces all running bots to be restarted (except localhub/me) */
-    egg_snprintf(buf, sizeof buf, "%s -L %s -P %d", binname, conf.bot->nick, getpid());
+    egg_snprintf(buf, sizeof buf, STR("%s -L %s -P %d"), binname, conf.bot->nick, getpid());
     putlog(LOG_DEBUG, "*", "Running for update: %s", buf);
     system(buf);	/* restarts other bots running, removes pid files */