- #1196 Now builds on Hurd (thanks to Jakub Wilk).
This commit is contained in:
Paul Beckingham 2013-04-09 20:50:05 -04:00
parent 773b55d374
commit 0ea28ef8a3
4 changed files with 17 additions and 0 deletions

View file

@ -84,6 +84,8 @@ endif (READLINE_FOUND)
check_function_exists (random HAVE_RANDOM)
check_function_exists (srandom HAVE_SRANDOM)
check_function_exists (timegm HAVE_TIMEGM)
check_function_exists (get_current_dir_name HAVE_GET_CURRENT_DIR_NAME)
check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
check_struct_has_member ("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAVE_ST_BIRTHTIME)

View file

@ -18,6 +18,7 @@ Features
+ Began fr-FR localization.
Bugs
+ #1196 Now builds on Hurd (thanks to Jakub Wilk).
+ #1197 Now 'tasksh' recognizes Ctrl-D to exit.
+ #1211 The 'dateformat' settings now default to the ISO-8601 standard of
'Y-M-D' (thanks to Robin Björklin).

View file

@ -58,6 +58,9 @@
/* Found timegm */
#cmakedefine HAVE_TIMEGM
/* Found get_current_dir_name */
#cmakedefine HAVE_GET_CURRENT_DIR_NAME
/* Found the uuid library */
#cmakedefine HAVE_UUID
#cmakedefine HAVE_UUID_UNPARSE_LOWER

View file

@ -30,6 +30,8 @@
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <Directory.h>
#include <cmake.h>
@ -148,9 +150,18 @@ std::vector <std::string> Directory::listRecursive ()
////////////////////////////////////////////////////////////////////////////////
std::string Directory::cwd ()
{
#ifdef HAVE_GET_CURRENT_DIR_NAME
char *buf = get_current_dir_name ();
if (buf == NULL)
throw std::bad_alloc ();
std::string result (buf);
free (buf);
return result;
#else
char buf[PATH_MAX];
getcwd (buf, PATH_MAX - 1);
return std::string (buf);
#endif
}
////////////////////////////////////////////////////////////////////////////////