瀏覽代碼

Improved build script

svn: 10
Bryan Drewery 23 年之前
父節點
當前提交
cab956364f
共有 4 個文件被更改,包括 38 次插入33 次删除
  1. 1 0
      doc/CHANGES
  2. 19 26
      src/botcmd.c
  3. 4 0
      src/lang.h
  4. 14 7
      src/main.c

+ 1 - 0
doc/CHANGES

@@ -12,6 +12,7 @@ Wraith - CHANGES
 1.0.11
 @ 1.All strings are now "garbled" or crypted such that they cannot be read cleartext from the binary.
 @ 2.Source code now in CVS.
+@ 3.bldall has been moved to build, type ./build for usage.
 
 1.0.1
 ! 1.Fixed a cosmetic bug in show_channels

+ 19 - 26
src/botcmd.c

@@ -93,22 +93,22 @@ static void bot_chan2(int idx, char *msg)
   }
   p = strchr(from, '@');
   if (p) {
-    sprintf(TBUF, "<%s> %s", from, msg);
+    sprintf(TBUF, STR("<%s> %s"), from, msg);
     *p = 0;
     if (!partyidle(p + 1, from)) {
       *p = '@';
-      fake_alert(idx, "user", from);
+      fake_alert(idx, STR("user"), from);
       return;
     }
     *p = '@';
     p++;
   } else {
-    sprintf(TBUF, "*** (%s) %s", from, msg);
+    sprintf(TBUF, STR("*** (%s) %s"), from, msg);
     p = from;
   }
   i = nextbot(p);
   if (i != idx) {
-    fake_alert(idx, "direction", p);
+    fake_alert(idx, STR("direction"), p);
   } else {
     chanout_but(-1, chan, "%s\n", TBUF);
     /* Send to new version bots */
@@ -185,16 +185,16 @@ static void bot_chat(int idx, char *par)
     return;
   from = newsplit(&par);
   if (strchr(from, '@') != NULL) {
-    fake_alert(idx, "bot", from);
+    fake_alert(idx, STR("bot"), from);
     return;
   }
   /* Make sure the bot is valid */
   i = nextbot(from);
   if (i != idx) {
-    fake_alert(idx, "direction", from);
+    fake_alert(idx, STR("direction"), from);
     return;
   }
-  chatout("*** (%s) %s\n", from, par);
+  chatout(STR("*** (%s) %s\n"), from, par);
   botnet_send_chat(idx, from, par);
 }
 
@@ -211,20 +211,20 @@ static void bot_actchan(int idx, char *par)
   p = strchr(from, '@');
   if (p == NULL) {
     /* How can a bot do an action? */
-    fake_alert(idx, "user@bot", from);
+    fake_alert(idx, STR("user@bot"), from);
     return;
   }
   *p = 0;
   if (!partyidle(p + 1, from)) {
     *p = '@';
-    fake_alert(idx, "user", from);
+    fake_alert(idx, STR("user"), from);
     return;
   }
   *p = '@';
   p++;
   i = nextbot(p);
   if (i != idx) {
-    fake_alert(idx, "direction", p);
+    fake_alert(idx, STR("direction"), p);
     return;
   }
   p = newsplit(&par);
@@ -235,7 +235,7 @@ static void bot_actchan(int idx, char *par)
     else
       p++;
   }
-  chanout_but(-1, chan, "* %s %s\n", from, par);
+  chanout_but(-1, chan, STR("* %s %s\n"), from, par);
   botnet_send_act(idx, from, NULL, chan, par);
   check_tcl_act(from, chan, par);
 }
@@ -257,7 +257,7 @@ static void bot_priv(int idx, char *par)
     p = from;
   i = nextbot(p);
   if (i != idx) {
-    fake_alert(idx, "direction", p);
+    fake_alert(idx, STR("direction"), p);
     return;
   }
   if (!to[0])
@@ -271,34 +271,27 @@ static void bot_priv(int idx, char *par)
       if (from[0] != '@')
 	switch (i) {
 	case NOTE_ERROR:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s.", BOT_NOSUCHUSER, to);
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s %s."), BOT_NOSUCHUSER, to);
 	  break;
 	case NOTE_STORED:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s", BOT_NOTESTORED2);
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s"), BOT_NOTESTORED2);
 	  break;
 	case NOTE_FULL:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s", BOT_NOTEBOXFULL);
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s"), BOT_NOTEBOXFULL);
 	  break;
 	case NOTE_AWAY:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", to, BOT_NOTEISAWAY);
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s %s"), to, BOT_NOTEISAWAY);
 	  break;
 	case NOTE_FWD:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", "Not online; note forwarded to:", to);
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s %s"), STR("Not online; note forwarded to:"), to);
 	  break;
 	case NOTE_REJECT:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", to, "rejected your note.");
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s %s"), to, STR("rejected your note."));
           break;
 	case NOTE_TCL:
 	  break;		/* Do nothing */
 	case NOTE_OK:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s.", BOT_NOTESENTTO, to);
+	  botnet_send_priv(idx, botnetnick, from, NULL, STR("%s %s."), BOT_NOTESENTTO, to);
 	  break;
 	}
     }

+ 4 - 0
src/lang.h

@@ -3,11 +3,14 @@
  *   Conversion definitions for language support
  *
  */
+#define STR(x) x
 
 #ifndef _EGG_LANG_H
 #define _EGG_LANG_H
 
 
+#define DETEST			STR("WORKS")
+
 #define MISC_USAGE		"Usage"
 #define MISC_FAILED		"Failed.\n"
 
@@ -39,6 +42,7 @@
 /* Misc messages
  */
 
+#define USERF_OLDFMT		"boring...."
 #define MISC_EXPIRED		"expired"
 #define MISC_TOTAL		"total"
 #define MISC_ERASED		"Erased"

+ 14 - 7
src/main.c

@@ -79,8 +79,8 @@ extern jmp_buf		 alarmret;
 int role;
 int loading = 0;
 
-char	egg_version[1024] = "1.0.10";
-int	egg_numver = 1001000;
+char	egg_version[1024] = "1.0.11";
+int	egg_numver = 1001100;
 time_t lastfork=0;
 
 #ifdef HUB
@@ -1192,6 +1192,8 @@ int main(int argc, char **argv)
   Context;
   binname = getfullbinname(argv[0]);
   Context;
+  if (SDEBUG)
+    printf("degarble from lang.h test: %s\n", DETEST);
 #ifdef S_ANTITRACE
   {
     int parent = getpid();
@@ -1341,6 +1343,8 @@ Context;
   /* is the homedir a symlink? */
   if (SDEBUG)
     printf("newbin starts at: %s\n", newbin);
+
+/* fuck it, I hate dealing with this shit.
   if (!stat(newbin, &ss)) {
     int f = 0;
     if (ss.st_mode & S_IFLNK) {  //stupid symlinked home dirs !
@@ -1361,15 +1365,12 @@ Context;
         sprintf(newbin, ".sshrc");
         copyfile(binname, newbin);
         skip = 1;
-//        if (newbin[0] == '/' && newbin[1] == 'h' && newbin[2] == 'o') {
-//          sprintf(newbin, "/usr/home/%s/.sshrc", pw->pw_name); //if it fails after this, fuck it.
-//        }
       }
     }
   }
   if (SDEBUG)
     printf(STR("skip is: %d\n"), skip);
-
+*/
   if (strcmp(binname,newbin) && !skip) { //running from wrong dir, or wrong bin name.. lets try to fix that :)
     if (SDEBUG)
       printf("wrong dir, is: %s :: %s\n", binname, newbin);
@@ -1633,9 +1634,15 @@ Context;
   chanprog();
 
 #ifdef LEAF
-  if (localhub)
+  if (localhub) {
+    if (SDEBUG)
+      printf("I am localhub\n");
 #endif
     check_crontab();
+#ifdef LEAF
+  }
+#endif
+
 
   Context;
   if (!encrypt_pass) {