summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-11-01 11:06:37 +0000
committerFrederic Culot <calcurse@culot.org>2009-11-01 11:06:37 +0000
commit9ac8389823ef97c57d4d74179afb9805d435f051 (patch)
tree97f6c8a1584c44bebbe1122d90c7954662eaa8f0
parent546ed4b224800436170d62b4f011f6028c80a64d (diff)
downloadcalcurse-9ac8389823ef97c57d4d74179afb9805d435f051.zip
Check for data directory availability added (thanks Brandon for reporting this bug).
-rwxr-xr-xChangeLog9
-rwxr-xr-xsrc/args.c3
-rwxr-xr-xsrc/io.c15
-rwxr-xr-xsrc/io.h3
4 files changed, 22 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 5336544..b403d70 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-01 Frederic Culot <frederic@culot.org>
+
+ * TODO: list updated
+
+ * src/io.c (check_directory): changed to non-static io_check_dir
+
+ * src/args.c (parse_args): check for data directory availability
+ added (thanks Brandon for reporting this bug)
+
2009-10-28 Frederic Culot <frederic@culot.org>
* src/wins.c (wins_status_bar): key bindings for changing calendar
diff --git a/src/args.c b/src/args.c
index 818f583..e21e1e3 100755
--- a/src/args.c
+++ b/src/args.c
@@ -1,4 +1,4 @@
-/* $calcurse: args.c,v 1.59 2009/08/02 07:22:50 culot Exp $ */
+/* $calcurse: args.c,v 1.60 2009/11/01 11:06:37 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -901,6 +901,7 @@ parse_args (int argc, char **argv, conf_t *conf)
if (load_data)
{
io_init (cfile, datadir);
+ io_check_dir (path_dir, (int *)0);
}
if (iflag)
{
diff --git a/src/io.c b/src/io.c
index 059fc6d..1ef3c6f 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.79 2009/10/28 15:15:44 culot Exp $ */
+/* $calcurse: io.c,v 1.80 2009/11/01 11:06:37 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -1498,8 +1498,8 @@ io_load_keys (char *pager)
#undef HSIZE
}
-static void
-check_directory (char *dir, int *missing)
+void
+io_check_dir (char *dir, int *missing)
{
errno = 0;
if (mkdir (dir, 0700) != 0)
@@ -1512,7 +1512,10 @@ check_directory (char *dir, int *missing)
}
}
else
- (*missing)++;
+ {
+ if (missing)
+ (*missing)++;
+ }
}
unsigned
@@ -1570,8 +1573,8 @@ io_check_data_files (void)
missing = missing_keys = 0;
errno = 0;
- check_directory (path_dir, &missing);
- check_directory (path_notes, &missing);
+ io_check_dir (path_dir, &missing);
+ io_check_dir (path_notes, &missing);
io_check_file (path_todo, &missing);
io_check_file (path_apts, &missing);
io_check_file (path_conf, &missing);
diff --git a/src/io.h b/src/io.h
index a22ca55..82b6f69 100755
--- a/src/io.h
+++ b/src/io.h
@@ -1,4 +1,4 @@
-/* $calcurse: io.h,v 1.26 2009/07/27 21:00:41 culot Exp $ */
+/* $calcurse: io.h,v 1.27 2009/11/01 11:06:37 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -74,6 +74,7 @@ void io_save_cal (conf_t *, io_save_display_t);
void io_load_app (void);
void io_load_todo (void);
void io_load_keys (char *);
+void io_check_dir (char *, int *);
unsigned io_file_exist (char *);
void io_check_file (char *, int *);
int io_check_data_files (void);