summaryrefslogtreecommitdiff
path: root/net-im/icb/files/patch-icb__c_log.c
blob: e6992aece03890e55e247950059fc52a85536fdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- icb/c_log.c.orig	Sat May 11 23:59:42 2002
+++ icb/c_log.c	Sun May 12 00:00:20 2002
@@ -7,6 +7,9 @@
 #include "icb.h"
 #include "externs.h"
 
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif
@@ -30,7 +33,8 @@
 	time_t time();
 	struct tm *t, *localtime();
 	time_t clock;
-	extern int errno, sys_nerr;
+	extern int errno;
+	extern const int sys_nerr;
 
 	/* determine pathname to use */
 	if (path == NULL || *path == '\0') {
@@ -43,17 +47,17 @@
 	/* expand a tilde style path */
 	if (*path == '~')
 		if ((path = tildexpand(path)) == NULL) {
-			strcpy(TRET, "c_log: bad login id in path");
+			strcpy(Tcl_GetStringResult(interp), "c_log: bad login id in path");
 			return(-1);
 		}
 	
 	/* open the session log */
 	if ((logfp = fopen(path, "a")) == NULL) {
 		if (errno > sys_nerr)
-		   sprintf(TRET,
+		   sprintf(Tcl_GetStringResult(interp),
 		    "c_log: can't open \"%s\": errno %d", path, errno);
 		else
-		   sprintf(TRET,
+		   sprintf(Tcl_GetStringResult(interp),
 		    "c_log: can't open \"%s\": %s", path, strerror(errno));
 		return(-1);
 	}
@@ -61,10 +65,10 @@
 	/* protect the logfile against others */
 	if (fchmod((int)(fileno(logfp)), 0600) != 0) {
 		if (errno > sys_nerr)
-		   sprintf(TRET,
+		   sprintf(Tcl_GetStringResult(interp),
 		    "c_log: can't fchmod \"%s\": errno %d", path, errno);
 		else
-		   sprintf(TRET,
+		   sprintf(Tcl_GetStringResult(interp),
 		    "c_log: can't fchmod \"%s\": %s", path, strerror(errno));
 		fclose(logfp);
 		logfp = NULL;
@@ -146,7 +150,7 @@
 				return(TCL_ERROR);
 	} else {
 		if (logging()) {
-			sprintf(TRET, "c_log: session logging already on");
+			sprintf(Tcl_GetStringResult(interp), "c_log: session logging already on");
 			return(TCL_ERROR);
 		} else
 			if (startsessionlog(interp, argv[1]) < 0)