summaryrefslogtreecommitdiffstats
path: root/src
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
parentd13df23aa19dfc29ea38393908f42cd470c1d344 (diff)
move get_default_location() from src/intrf.c to src/askloc.c
Diffstat (limited to 'src')
-rw-r--r--src/askloc.c23
-rw-r--r--src/askloc.h1
-rw-r--r--src/intrf.c19
-rw-r--r--src/intrf.h2
4 files changed, 22 insertions, 23 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
+
diff --git a/src/askloc.h b/src/askloc.h
index 0da930f..7671883 100644
--- a/src/askloc.h
+++ b/src/askloc.h
@@ -24,6 +24,7 @@ extern "C" {
#endif
char *ask_location(const char*msg, const char *src_dir, const char *dst_org);
+char *get_default_location(void);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/intrf.c b/src/intrf.c
index 2fc08b6..cd5d6c7 100644
--- a/src/intrf.c
+++ b/src/intrf.c
@@ -206,25 +206,6 @@ const char *aff_part_aux(const unsigned int newline, const disk_t *disk_car, con
#define PATH_DRIVE_LENGTH 9
#endif
-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);
-}
-
unsigned long long int ask_number_cli(char **current_cmd, const unsigned long long int val_cur, const unsigned long long int val_min, const unsigned long long int val_max, const char * _format, ...)
{
if(*current_cmd!=NULL)
diff --git a/src/intrf.h b/src/intrf.h
index 9ae93da..d40ac52 100644
--- a/src/intrf.h
+++ b/src/intrf.h
@@ -70,9 +70,7 @@ int screen_buffer_add(const char *_format, ...) __attribute__ ((format (printf,
void screen_buffer_to_log(void);
void screen_buffer_to_interface(void);
void screen_buffer_to_stdout(void);
-char *get_default_location(void);
void dump_ncurses(const void *nom_dump, unsigned int lng);
-char *td_getcwd(char *buf, unsigned long size);
#ifdef __cplusplus
} /* closing brace for extern "C" */