[/trunk] Changeset 91 by mikael
* Some more cleaning
* Create log in user's home dir if possible (more confidential...)
--- a/mcabber/src/main.c Sat Apr 16 18:13:24 2005 +0000
+++ b/mcabber/src/main.c Sat Apr 16 18:24:01 2005 +0000
@@ -101,7 +101,7 @@
sprintf(configFile, "%s/.mcabberrc", getenv("HOME"));
- /* Proceso opciones de usuario */
+ /* Parse command line options */
while (1) {
int c = getopt(argc, argv, "hf:");
if (c == -1) {
--- a/mcabber/src/utils.c Sat Apr 16 18:13:24 2005 +0000
+++ b/mcabber/src/utils.c Sat Apr 16 18:24:01 2005 +0000
@@ -1,17 +1,30 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <stdarg.h>
#include <time.h>
/* Variables globales a UTILS.C */
static int DebugEnabled;
+static char *FName;
void ut_InitDebug(int level)
{
- FILE *fp = fopen("/tmp/mcabberlog", "w");
+ FILE *fp;
+
+ FName = getenv("HOME");
+ if (!FName)
+ FName = "/tmp/mcabberlog";
+ else {
+ char *tmpname = malloc(strlen(FName) + 12);
+ strcpy(tmpname, FName);
+ strcat(tmpname, "/mcabberlog");
+ FName = tmpname;
+ }
DebugEnabled = level;
+ fp = fopen(FName, "w");
if (!fp) return;
fprintf(fp, "Debugging mode started...\n"
"-----------------------------------\n");
@@ -26,7 +39,7 @@
char *buffer = NULL;
if (DebugEnabled) {
- fp = fopen("/tmp/mcabberlog", "a+");
+ fp = fopen(FName, "a+");
if (!fp) return;
buffer = (char *) calloc(1, 64);
--- a/mcabber/src/utils.h Sat Apr 16 18:13:24 2005 +0000
+++ b/mcabber/src/utils.h Sat Apr 16 18:24:01 2005 +0000
@@ -3,14 +3,8 @@
#include <ncurses.h>
-char **ut_SplitMessage(char *mensaje, int *nsubmsgs, unsigned int maxlong);
void ut_InitDebug(int level);
void ut_WriteLog(const char *fmt, ...);
-char *ut_strrstr(const char *s1, const char *s2);
-char *getattr(char *buffer, char *what);
-char *gettag(char *buffer, char *what);
-void ut_CenterMessage(char *text, int width, char *output);
-
#endif