summaryrefslogtreecommitdiffstats
path: root/src/askloc.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-06-28 08:33:52 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2012-06-28 08:33:52 +0200
commit1c0cddad9b574ce1d1de6a9dca22dcd844c690ec (patch)
tree2a6fc8e7fc826d11b6eaa96890f486e185ed72be /src/askloc.c
parentd13df23aa19dfc29ea38393908f42cd470c1d344 (diff)
move get_default_location() from src/intrf.c to src/askloc.c
Diffstat (limited to 'src/askloc.c')
-rw-r--r--src/askloc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/askloc.c b/src/askloc.c
index 9380cb5..846415f 100644
--- a/src/askloc.c
+++ b/src/askloc.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#ifdef HAVE_NCURSES
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -59,6 +58,26 @@
#include "askloc.h"
#include "log.h"
+static char *td_getcwd(char *buf, unsigned long size)
+{
+ /* buf must non-NULL*/
+#ifdef HAVE_GETCWD
+ if(getcwd(buf, size)!=NULL)
+ return buf;
+#endif
+ buf[0]='.';
+ buf[1]='\0';
+ return buf;
+}
+
+char *get_default_location(void)
+{
+ char dst_directory[4096];
+ td_getcwd(dst_directory, sizeof(dst_directory));
+ return strdup(dst_directory);
+}
+
+#ifdef HAVE_NCURSES
extern const char *monstr[];
#define INTER_DIR (LINES-25+16)
@@ -561,5 +580,5 @@ static int aff_txt(int line, WINDOW *window, const char *_format, ...)
va_end(ap);
return line;
}
-
#endif
+