[cvslog] Module eggdrop1.6: Change committed

cvslog cvs at tsss.iavalley.cc.ia.us
Sun Dec 17 15:49:00 CST 2000


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2000-12-17 21:48:52 UTC

Modified files:
     src/proto.h src/tcl.c src/mod/module.h

Log message:

Applying fabian's patch for unicode support (also by Wingman); however, there was a warning
in src/tcl.c

tcl.c: In function `readtclprog':
tcl.c:583: warning: passing arg 2 of `Tcl_EvalFile' discards `const' from pointer target type

so I removed the const usage and warning is gone.

Jeff

---------------------- diff included ----------------------
Index: eggdrop1.6/src/mod/module.h
diff -u eggdrop1.6/src/mod/module.h:1.37 eggdrop1.6/src/mod/module.h:1.38
--- eggdrop1.6/src/mod/module.h:1.37	Fri Oct 27 14:32:41 2000
+++ eggdrop1.6/src/mod/module.h	Sun Dec 17 15:48:42 2000
@@ -1,7 +1,7 @@
 /* 
  * module.h
  * 
- * $Id: module.h,v 1.37 2000/10/27 19:32:41 fabian Exp $
+ * $Id: module.h,v 1.38 2000/12/17 21:48:42 guppy Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -272,8 +272,8 @@
 #define movefile ((int (*) (char *, char *))global[146])
 #define copyfile ((int (*) (char *, char *))global[147])
 /* 148 - 151 */
-#define do_tcl ((void (*)(char *,char*))global[148])
-#define readtclprog ((int (*)(char *))global[149])
+#define do_tcl ((void (*)(char *, char *))global[148])
+#define readtclprog ((int (*)(const char *))global[149])
 #define get_language ((char *(*)(int))global[150])
 #define def_get ((void *(*)(struct userrec *, struct user_entry *))global[151])
 /* 152 - 155 */
@@ -282,8 +282,8 @@
 #define maskhost ((void (*)(const char *, char *))global[154])
 #define show_motd ((void(*)(int))global[155])
 /* 156 - 159 */
-#define tellhelp ((void(*)(int,char *,struct flag_record *,int))global[156])
-#define showhelp ((void(*)(char *,char *,struct flag_record *,int))global[157])
+#define tellhelp ((void(*)(int, char *, struct flag_record *, int))global[156])
+#define showhelp ((void(*)(char *, char *, struct flag_record *, int))global[157])
 #define add_help_reference ((void(*)(char *))global[158])
 #define rem_help_reference ((void(*)(char *))global[159])
 /* 160 - 163 */
Index: eggdrop1.6/src/proto.h
diff -u eggdrop1.6/src/proto.h:1.36 eggdrop1.6/src/proto.h:1.37
--- eggdrop1.6/src/proto.h:1.36	Mon Nov 20 22:46:17 2000
+++ eggdrop1.6/src/proto.h	Sun Dec 17 15:48:42 2000
@@ -7,7 +7,7 @@
  * because they use structures in those
  * (saves including those .h files EVERY time) - Beldin
  * 
- * $Id: proto.h,v 1.36 2000/11/21 04:46:17 guppy Exp $
+ * $Id: proto.h,v 1.37 2000/12/17 21:48:42 guppy Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -263,7 +263,7 @@
 void protect_tcl();
 void unprotect_tcl();
 void do_tcl(char *, char *);
-int readtclprog(char *);
+int readtclprog(char *fname);
 int findidx(int);
 int findanyidx(int);
 
Index: eggdrop1.6/src/tcl.c
diff -u eggdrop1.6/src/tcl.c:1.25 eggdrop1.6/src/tcl.c:1.26
--- eggdrop1.6/src/tcl.c:1.25	Sun Dec 10 09:10:27 2000
+++ eggdrop1.6/src/tcl.c	Sun Dec 17 15:48:42 2000
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  * 
- * $Id: tcl.c,v 1.25 2000/12/10 15:10:27 guppy Exp $
+ * $Id: tcl.c,v 1.26 2000/12/17 21:48:42 guppy Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -515,6 +515,12 @@
   Tcl_InitMemory(interp);
 #endif
 
+#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 1
+  /* Set default encoding to default system encoding, i.e. binary.
+     Unicode support present since Tcl library version 8.1. */
+  Tcl_SetSystemEncoding(interp, NULL);
+#endif
+
   /* Set Tcl variable tcl_interactive to 0 */
   Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
 
@@ -524,7 +530,6 @@
 
   /* Add new commands */
   Tcl_CreateCommand(interp, "logfile", tcl_logfile, NULL, NULL);
-  /* Isnt this much neater :) */
   add_tcl_commands(tcluser_cmds);
   add_tcl_commands(tcldcc_cmds);
   add_tcl_commands(tclmisc_cmds);
@@ -562,49 +567,20 @@
   }
 }
 
-/* Read the tcl file fname into memory and interpret it. Not using
- * Tcl_EvalFile avoids problems with high ascii characters.
+/* Interpret tcl file fname.
  *
  * returns:   1 - if everything was okay
  */
 int readtclprog(char *fname)
 {
-  int	 code;
-  long	 size;
-  char	*script;
   FILE	*f;
 
+  /* Check whether file is readable. */
   if ((f = fopen(fname, "r")) == NULL)
     return 0;
-
-  /* Find out file size. */
-  fseek(f, 0, SEEK_END);
-  size = ftell(f);
-  fseek(f, 0, SEEK_SET);
-
-  /* Allocate buffer to save the file's data in. */
-  if ((script = nmalloc(size + 1)) == NULL) {
-    fclose(f);
-    return 0;
-  }
-  script[size] = 0;
-
-  /* Read file's data to the allocated buffer. */
-  fread(script, 1, size, f);
   fclose(f);
 
-  if (debug_tcl) {
-    if ((f = fopen("DEBUG.TCL", "a")) != NULL)
-      fprintf(f, "*** eval: %s\n", script);
-  }
-  code = Tcl_Eval(interp, script);
-  nfree(script);
-  if (debug_tcl && f) {
-    fprintf(f, "*** done eval, result=%d\n", code);
-    fclose(f);
-  }
-
-  if (code != TCL_OK) {
+  if (Tcl_EvalFile(interp, fname) != TCL_OK) {
     putlog(LOG_MISC, "*", "Tcl error in file '%s':", fname);
     putlog(LOG_MISC, "*", "%s",
 	   Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY));
----------------------- End of diff -----------------------



More information about the Changes mailing list