Skip to content

Commit

Permalink
Fix up dicl headers to be able to import into C++ code too.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhams committed Oct 26, 2019
1 parent f6c8587 commit 7790fb8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libdicl/configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ(2.65)
AC_INIT([libdicl],
[0.1.12],
[0.1.13],
[[email protected]])

AC_SUBST(ACLOCAL_AMFLAGS, "-I macros")
Expand Down
8 changes: 8 additions & 0 deletions libdicl/src/repl_headers/fnmatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "/usr/include/fnmatch.h"
#endif

#if defined(__cplusplus)
extern "C" {
#endif

/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
Expand Down Expand Up @@ -37,4 +41,8 @@
#define fnmatch rpl_fnmatch
extern int rpl_fnmatch(const char *, const char *, int);

#if defined(__cplusplus)
}
#endif

#endif
8 changes: 8 additions & 0 deletions libdicl/src/repl_headers/repl_select.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#ifndef LIBDICL_REPL_SELECT_H
#define LIBDICL_REPL_SELECT_H

#if defined(__cplusplus)
extern "C" {
#endif

#undef select
#define select rpl_select
extern int rpl_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);

#if defined(__cplusplus)
}
#endif

#endif
8 changes: 8 additions & 0 deletions libdicl/src/repl_headers/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "/usr/include/stdio.h"
#endif

#if defined(__cplusplus)
extern "C" {
#endif

extern int asprintf(char **,const char *, ...);

#undef sprintf
Expand Down Expand Up @@ -42,4 +46,8 @@ ssize_t rpl_getline(char **lineptr, size_t *n, FILE *stream);

ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);

#if defined(__cplusplus)
}
#endif

#endif
11 changes: 10 additions & 1 deletion libdicl/src/repl_headers/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#else
#include "/usr/include/stdlib.h"
#endif

#if defined(__cplusplus)
extern "C" {
#endif

#undef strtod
#define strtod rpl_strtod
extern double rpl_strtod(const char *, char **);
Expand All @@ -20,10 +25,14 @@ int unsetenv(const char *name);
const char *getprogname(void);
void setprogname(const char *progname);

char *mkdtemp(char *template);
char *mkdtemp(char *ftemplate);

void qsort_r(void *, size_t, size_t,
int(*)(const void*,const void*, void*),
void *);

#if defined(__cplusplus)
}
#endif

#endif
8 changes: 8 additions & 0 deletions libdicl/src/repl_headers/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "/usr/include/string.h"
#endif

#if defined(__cplusplus)
extern "C" {
#endif

/* Missing pieces */
char *stpcpy(char *, const char*);
char *stpncpy(char *, const char*, size_t);
Expand All @@ -19,4 +23,8 @@ char *strndup(const char*, size_t);

char *strsep(char **, char*);

#if defined(__cplusplus)
}
#endif

#endif
8 changes: 8 additions & 0 deletions libdicl/src/repl_headers/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#endif
#include "repl_select.h"

#if defined(__cplusplus)
extern "C" {
#endif

# define AT_FDCWD (-3041965)

# define AT_SYMLINK_NOFOLLOW 4096
Expand All @@ -20,4 +24,8 @@

int faccessat(int, const char*, int, int);

#if defined(__cplusplus)
}
#endif

#endif

0 comments on commit 7790fb8

Please sign in to comment.