From c4fc0030b15e1f9c47037961c7b02ff7c4762ab4 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 30 Jan 2011 22:51:27 +0100 Subject: [PATCH] Fix up and for C++ programs. __BEGIN_DECLS and __END_DECLS are absolutely needed around prototypes so the functions can be called from C++ code (see the definition of __BEGIN_DECLS in ). While here, put non-standard stuff in __BSD_VISIBLE instead of just noting it in a comment. This fixes at least x11/rxvt-unicode. Tested-by: tuxillo --- include/utmp.h | 4 ++++ include/utmpx.h | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/utmp.h b/include/utmp.h index 7316087dc4..2858f18312 100644 --- a/include/utmp.h +++ b/include/utmp.h @@ -43,6 +43,8 @@ #ifndef _UTMP_H_ #define _UTMP_H_ +#include + #define _PATH_UTMP "/var/run/utmp" #define _PATH_WTMP "/var/log/wtmp" #define _PATH_LASTLOG "/var/log/lastlog" @@ -64,9 +66,11 @@ struct utmp { time_t ut_time; }; +__BEGIN_DECLS int utmpname(const char *); void setutent(void); struct utmp *getutent(void); void endutent(void); +__END_DECLS #endif /* !_UTMP_H_ */ diff --git a/include/utmpx.h b/include/utmpx.h index 7e6aadab17..3e26f6eba9 100644 --- a/include/utmpx.h +++ b/include/utmpx.h @@ -103,7 +103,14 @@ struct utmpx { uint8_t ut_unused2[16]; /* reserved for future use */ }; +struct lastlogx { + struct timeval ll_tv; /* time entry was created */ + char ll_line[_UTX_LINESIZE]; /* tty name */ + char ll_host[_UTX_HOSTSIZE]; /* host name */ + struct sockaddr_storage ll_ss; /* address where entry was made from */ +}; +__BEGIN_DECLS void endutxent(void); struct utmpx *getutxent(void); struct utmpx *getutxid(const struct utmpx *); @@ -111,14 +118,7 @@ struct utmpx *getutxline(const struct utmpx *); struct utmpx *pututxline(const struct utmpx *); void setutxent(void); -/* NON-STANDARD functions, NetBSD specific stuff */ -struct lastlogx { - struct timeval ll_tv; /* time entry was created */ - char ll_line[_UTX_LINESIZE]; /* tty name */ - char ll_host[_UTX_HOSTSIZE]; /* host name */ - struct sockaddr_storage ll_ss; /* address where entry was made from */ -}; - +#ifdef __BSD_VISIBLE int updwtmpx(const char *, const struct utmpx *); struct lastlogx *getlastlogx(const char *, uid_t, struct lastlogx *); int updlastlogx(const char *, uid_t, struct lastlogx *); @@ -127,6 +127,8 @@ void getutmp(const struct utmpx *, struct utmp *); void getutmpx(const struct utmp *, struct utmpx *); int utmpxname(const char *); int setutxdb(utx_db_t, char *); +#endif +__END_DECLS #endif /* _UTMPX_H_ */ -- 2.41.0