Skip to content

Commit

Permalink
Posix/SUS portability cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
franklahm committed Nov 3, 2011
1 parent 857f1ff commit 6dd1fb3
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 81 deletions.
6 changes: 2 additions & 4 deletions bin/ad/ad.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2009 Frank Lahm <[email protected]>
Copyright (c) 2009,2011 Frank Lahm <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -15,9 +15,7 @@
#ifndef AD_H
#define AD_H

#if !defined(__FreeBSD__)
# define _XOPEN_SOURCE 600
#endif
#include <atalk/standards.h>

#include <sys/types.h>
#include <sys/stat.h>
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,10 @@ fi
dnl ----- OpenBSD specific -----
if test x"$this_os" = "xopenbsd"; then
AC_MSG_RESULT([ * OpenBSD specific configuration])
AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
fi

dnl ----- Solaris specific -----
Expand Down
12 changes: 1 addition & 11 deletions etc/cnid_dbd/comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@
#include "config.h"
#endif

#if !defined(__FreeBSD__) && !defined(__NetBSD__)
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
#endif
#ifndef __EXTENSIONS__
# define __EXTENSIONS__
#endif
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#endif
#include <atalk/standards.h>

#include <stdio.h>
#include <stdlib.h>
Expand Down
9 changes: 2 additions & 7 deletions etc/uams/uams_dhx2_passwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@

#ifdef UAM_DHX2

#include <atalk/standards.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <pwd.h>

#ifdef NETBSD
#define _XOPEN_SOURCE 500 /* for crypt() */
#endif
#ifdef FREEBSD
#define _XOPEN_SOURCE /* for crypt() */
#endif

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
Expand Down
7 changes: 1 addition & 6 deletions etc/uams/uams_dhx_passwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */

#ifdef NETBSD
#define _XOPEN_SOURCE 500 /* for crypt() */
#endif
#ifdef FREEBSD
#define _XOPEN_SOURCE /* for crypt() */
#endif
#include <atalk/standards.h>

#include <stdio.h>
#include <stdlib.h>
Expand Down
10 changes: 2 additions & 8 deletions etc/uams/uams_passwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@
#include <config.h>
#endif /* HAVE_CONFIG_H */

#include <sys/types.h>
/* crypt needs _XOPEN_SOURCE (500) at least on BSD, but that breaks Solaris compile */
#ifdef NETBSD
#define _XOPEN_SOURCE 500 /* for crypt() */
#endif
#ifdef FREEBSD
#define _XOPEN_SOURCE /* for crypt() */
#endif
#include <atalk/standards.h>

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
/* STDC check */
Expand Down
4 changes: 2 additions & 2 deletions etc/uams/uams_pgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#ifdef UAM_PGP

/* for crypt() */
#define _XOPEN_SOURCE
#include <atalk/standards.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion include/atalk/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ atalkinclude_HEADERS = \
server_ipc.h tdb.h uam.h unicode.h util.h uuid.h volinfo.h \
zip.h ea.h acl.h unix.h directory.h hash.h volume.h

noinst_HEADERS = cnid_dbd_private.h cnid_private.h bstradd.h bstrlib.h errchk.h ftw.h globals.h fce_api.h
noinst_HEADERS = cnid_dbd_private.h cnid_private.h bstradd.h bstrlib.h errchk.h ftw.h globals.h fce_api.h standards.h
27 changes: 1 addition & 26 deletions include/atalk/adouble.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,7 @@
#include <config.h>
#endif

/* -------------------
* need pread() and pwrite()
*/
#ifdef HAVE_PREAD

#ifndef HAVE_PWRITE
#undef HAVE_PREAD
#endif

#endif

#ifdef HAVE_PWRITE
#ifndef HAVE_PREAD
#undef HAVE_PWRITE
#endif
#endif

/*
Still have to figure out which platforms really
need _XOPEN_SOURCE defined for pread.
*/
#if defined(HAVE_PREAD) && !defined(SOLARIS) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(TRU64)
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 500
#endif
#endif
#include <atalk/standards.h>

#include <sys/types.h>
#include <sys/stat.h>
Expand Down
10 changes: 5 additions & 5 deletions include/atalk/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/* lock file path. this should be re-organized a bit. */
#if ! defined (_PATH_LOCKDIR)
# if defined (FHS_COMPATIBILITY) || defined (__NetBSD__)
# if defined (FHS_COMPATIBILITY) || defined (__NetBSD__) || defined (__OpenBSD__)
# define _PATH_LOCKDIR "/var/run/"
# elif defined (BSD4_4)
# ifdef MACOSX_SERVER
Expand Down Expand Up @@ -51,7 +51,7 @@
*/
#define _PATH_ATALKDEBUG "/tmp/atalkd.debug"
#define _PATH_ATALKDTMP "atalkd.tmp"
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__)
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__) || defined (__OpenBSD__)
# define _PATH_ATALKDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"atalkd.pid")
#else
# define _PATH_ATALKDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"atalkd")
Expand All @@ -61,7 +61,7 @@
* psorder paths
*/
#define _PATH_TMPPAGEORDER "/tmp/psorderXXXXXX"
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__)
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__) || defined (__OpenBSD__)
# define _PATH_PAPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"papd.pid")
#else
# define _PATH_PAPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"papd")
Expand All @@ -72,7 +72,7 @@
*/
#define _PATH_AFPTKT "/tmp/AFPtktXXXXXX"
#define _PATH_AFP_IPC ATALKPATHCAT(_PATH_LOCKDIR,"afpd_ipc")
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__)
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__) || defined (__OpenBSD__)
# define _PATH_AFPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"afpd.pid")
#else
# define _PATH_AFPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"afpd")
Expand All @@ -81,7 +81,7 @@
/*
* cnid_metad paths
*/
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__)
#if defined (FHS_COMPATIBILITY) || defined (__NetBSD__) || defined (__OpenBSD__)
# define _PATH_CNID_METAD_LOCK ATALKPATHCAT(_PATH_LOCKDIR,"cnid_metad.pid")
#else
# define _PATH_CNID_METAD_LOCK ATALKPATHCAT(_PATH_LOCKDIR,"cnid_metad")
Expand Down
13 changes: 2 additions & 11 deletions libatalk/util/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */

#if !defined(__FreeBSD__) && !defined(__NetBSD__)
# ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
# endif
# ifndef __EXTENSIONS__
# define __EXTENSIONS__
# endif
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
# endif
#endif
#include <atalk/standards.h>

#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
Expand Down

0 comments on commit 6dd1fb3

Please sign in to comment.