Просмотр исходного кода

* Changed how stringfix is used
* Fixed a make error with 'make salt'


svn: 319

Bryan Drewery 22 лет назад
Родитель
Сommit
250d413ac8
4 измененных файлов с 36 добавлено и 36 удалено
  1. 12 8
      Makefile.in
  2. 7 11
      src/Makefile.in
  3. 4 2
      src/mod/Makefile.in
  4. 13 15
      src/stringfix.c

+ 12 - 8
Makefile.in

@@ -126,10 +126,11 @@ packconf: makesettings
 	cp -f src/settings.tmp src/settings.c; \
 	fi)
 
-salt:	makesalt
+salt:	makesalt src/makesalt.c stringfix
 	@src/makesalt
-	@cp -f pack/salt.h src/salt.h
-	@src/stringfix src/salt.h
+	@echo -n "[*] Encrypting salts..."
+	@src/stringfix pack/salt.h src/salt.h || echo "FAILED"
+	@echo "done."
 
 config:
 	@$(modconf) modules-still-exist
@@ -144,17 +145,20 @@ clean-modconfig:
 
 reconfig: clean-modconfig config
 
-stringfix:
+
+stringfix: src/stringfix.c
 	+@cd src && ${MAKE_UTILS} stringfix
 
-makesalt:
+makesalt: src/makesalt.c
 	+@cd src && ${MAKE_UTILS} makesalt
 
-makesettings:
+makesettings: src/makesettings.c
 	+@cd src && ${MAKE_UTILS} makesettings
 
-utils:
-	+@cd src && ${MAKE_UTILS} utils
+utils: makesettings makesalt stringfix
+
+#utils: src/stringfix.c src/makesalt.c src/makesettings.c
+#	+@cd src && ${MAKE_UTILS} utils
 
 dostrings: stringfix
 	@misc/dostrings

+ 7 - 11
src/Makefile.in

@@ -43,8 +43,6 @@ stringfix: stringfix.c
 	@$(CC) $(CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CPPFLAGS) stringfix.c -o stringfix
 	@$(STRIP) stringfix
 
-utils: stringfix makesettings makesalt
-
 ../$(EGGEXEC): build_msg $(eggdrop_objs) $(XREQS) compatability
 	@echo ""
 	@echo "Linking wraith... $(EGGBUILD)"
@@ -58,7 +56,7 @@ utils: stringfix makesettings makesalt
 $(EGGEXEC): stringfix ../$(EGGEXEC)
 
 clean:
-	@rm -f .depend *.o *.a *~ x*.c
+	@rm -f .depend *.o *~ _*.c
 
 depleaf:
 	$(CC) $(CFLAGS) $(CPPFLAGS) -DLEAF -MM $(srcdir)/*.c > .depend
@@ -73,10 +71,10 @@ build_msg:
 
 main.o: stringfix
 	@cp -f main.c xmain.c
+	@./stringfix main.c _main.c || cp -f main.c _main.c
 	@echo -e "Compiling: \033[1mmain\033[0m"
-	@./stringfix xmain.c
 	@$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) '-DCCFLAGS="$(CC) $(CFLAGS) $(CPPFLAGS)"' \
-	'-DLDFLAGS="$(LD)"' '-DSTRIPFLAGS="$(STRIP)"' -c $(srcdir)/xmain.c -o main.o
+	'-DLDFLAGS="$(LD)"' '-DSTRIPFLAGS="$(STRIP)"' -c $(srcdir)/_main.c -o main.o
 
 compatability:
 	+@cd compat && $(MAKE_GENERIC) compat
@@ -87,15 +85,13 @@ eggdrop.h:
 	@exit 1
 
 .SUFFIXES:
-.SUFFIXES: .c .h .o .a
+.SUFFIXES: .c .h .o
 
 
-.c.o:   stringfix
-	@cp -f $< x$<
+.c.o: stringfix
+	@./stringfix $< _$< || cp -f $< _$<
 	@echo -e "Compiling: \033[1m`basename $< .c`\033[0m"
-	@./stringfix x$<
-	@$(CC) $(CFLAGS) $(CPPFLAGS) -c x$< -o `basename $< .c`.o
-	@${STRIP} `basename $< .c`.o
+	@$(CC) $(CFLAGS) $(CPPFLAGS) -c _$< -o `basename $< .c`.o
 
 #safety hash
 auth.o: auth.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.h \

+ 4 - 2
src/mod/Makefile.in

@@ -38,9 +38,12 @@ doofus:
 	@echo ""
 	@cd ../.. && $(MAKE)
 
-static: $(mod_objs)
+static: build_msg $(mod_objs)
 	@$(modconfig) static.h
 
+build_msg:
+	@echo "[*] Building modules"
+
 .SUFFIXES:
 .SUFFIXES: .mod .mod_o
 
@@ -108,6 +111,5 @@ distclean:
 		fi; \
 	done
 
-install:
 
 #safety hash

+ 13 - 15
src/stringfix.c

@@ -9,15 +9,13 @@
 #include <string.h>
 #include "conf.h"
 
-char tmp[] = { 0x0, 0x1 };
-
 #ifdef S_GARBLESTRINGS
 void garble(char **inptr, char **outptr)
 {
   char *in = *inptr,
    *out,
    *p = NULL;
-  char obuf[16384];
+  char obuf[1024];
   int chars = 0;
   unsigned char x;
 
@@ -96,8 +94,8 @@ char *outbuf = NULL;
 
 void processline(char *line)
 {
-  char tmpin[16384],
-    tmpout[16384];
+  char tmpin[1024],
+    tmpout[1024];
   char *in,
    *out;
 
@@ -127,7 +125,7 @@ void processline(char *line)
   strcat(outbuf, tmpout);
   strcat(outbuf, "\n");
 }
-#endif
+#endif /* S_GARBLESTRINGS */
 
 int main(int argc, char *argv[0])
 {
@@ -138,11 +136,10 @@ int main(int argc, char *argv[0])
   int insize;
   char *buf;
 
-  if (argc != 2)
-    exit(1);
-  f = fopen(argv[1], "r");
-  if (!f)
-    exit(1);
+  if (argc != 3)
+    return 1;
+  if (!(f = fopen(argv[1], "r")))
+    return 1;
   fseek(f, 0, SEEK_END);
   insize = ftell(f);
   fseek(f, 0, SEEK_SET);
@@ -160,12 +157,13 @@ int main(int argc, char *argv[0])
     ln = nln;
   }
 
-  f = fopen(argv[1], "w");
-  if (f) {
+  if ((f = fopen(argv[2], "w"))) {
     fwrite(outbuf, 1, strlen(outbuf), f);
     fclose(f);
   }
   /*  printf(outbuf); */
-#endif
-  exit(0);
+  return 0;
+#else /* !S_GARBLESTRINGS */
+  return 1;
+#endif /* S_GARBLESTRINGS */
 }