mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 09:16:22 +00:00
Log location ~/.profanity/log/profanity.log
This commit is contained in:
11
src/common.c
11
src/common.c
@@ -28,22 +28,23 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static void _create_dir(char *name);
|
||||
#include "common.h"
|
||||
|
||||
void p_slist_free_full(GSList *items, GDestroyNotify free_func)
|
||||
{
|
||||
g_slist_foreach (items, (GFunc) free_func, NULL);
|
||||
g_slist_free (items);
|
||||
g_slist_foreach (items, (GFunc) free_func, NULL);
|
||||
g_slist_free (items);
|
||||
}
|
||||
|
||||
void create_config_directory()
|
||||
{
|
||||
GString *dir = g_string_new(getenv("HOME"));
|
||||
g_string_append(dir, "/.profanity");
|
||||
_create_dir(dir->str);
|
||||
create_dir(dir->str);
|
||||
g_string_free(dir, TRUE);
|
||||
}
|
||||
|
||||
void _create_dir(char *name)
|
||||
void create_dir(char *name)
|
||||
{
|
||||
int e;
|
||||
struct stat sb;
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef enum {
|
||||
#endif
|
||||
|
||||
void p_slist_free_full(GSList *items, GDestroyNotify free_func);
|
||||
void create_config_directory();
|
||||
void create_config_directory(void);
|
||||
void create_dir(char *name);
|
||||
|
||||
#endif
|
||||
|
||||
11
src/log.c
11
src/log.c
@@ -21,8 +21,12 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "glib.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "common.h"
|
||||
|
||||
extern FILE *logp;
|
||||
|
||||
@@ -33,7 +37,12 @@ void log_msg(const char * const area, const char * const msg)
|
||||
|
||||
void log_init(void)
|
||||
{
|
||||
logp = fopen("profanity.log", "a");
|
||||
GString *log_file = g_string_new(getenv("HOME"));
|
||||
g_string_append(log_file, "/.profanity/log");
|
||||
create_dir(log_file->str);
|
||||
g_string_append(log_file, "/profanity.log");
|
||||
logp = fopen(log_file->str, "a");
|
||||
g_string_free(log_file, TRUE);
|
||||
log_msg(PROF, "Starting Profanity...");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "profanity.h"
|
||||
|
||||
Reference in New Issue
Block a user