Skip to content

Commit

Permalink
CHANGE add own get_current_dir_name() implementation for non GNU systems
Browse files Browse the repository at this point in the history
Relates to #17
  • Loading branch information
rkrejci committed Feb 5, 2016
1 parent ec797a3 commit 15acd04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ ly_errno_location(void)
return retval;
}

#ifndef __USE_GNU

char *get_current_dir_name(void)
{
char tmp[PATH_MAX];

if (getcwd(tmp, sizeof(tmp)))
return strdup(tmp);
return NULL;
}

#endif

const char *
strpbrk_backwards(const char *s, const char *accept, unsigned int s_len)
{
Expand Down
8 changes: 8 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
*/
#define API __attribute__((visibility("default")))

#ifndef __USE_GNU
/*
* If we don't have GNU extension, implement these function on your own
*/
char *get_current_dir_name(void);

#endif

/*
* logger
*/
Expand Down

0 comments on commit 15acd04

Please sign in to comment.