mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 21:10:27 +02:00
simplify posix.c
* libguile/posix.c: Reorder includes to fix mingw include-order problem. Remove ttyname shims; gnulib is the place to fix that. Remove winsock2 include, as gnulib seems to handle that OK. Rely on the new pipe-posix gnulib module. Don't bother shimming getlogin, etc on mingw; gnulib is the place for shims.
This commit is contained in:
parent
7dfcaf2616
commit
d3c88f1826
1 changed files with 17 additions and 44 deletions
|
@ -32,23 +32,6 @@
|
|||
# include <sched.h>
|
||||
#endif
|
||||
|
||||
#include "libguile/_scm.h"
|
||||
#include "libguile/dynwind.h"
|
||||
#include "libguile/fports.h"
|
||||
#include "libguile/scmsigs.h"
|
||||
#include "libguile/feature.h"
|
||||
#include "libguile/strings.h"
|
||||
#include "libguile/srfi-13.h"
|
||||
#include "libguile/srfi-14.h"
|
||||
#include "libguile/vectors.h"
|
||||
#include "libguile/values.h"
|
||||
|
||||
#include "libguile/validate.h"
|
||||
#include "libguile/posix.h"
|
||||
#include "libguile/gettext.h"
|
||||
#include "libguile/threads.h"
|
||||
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
@ -65,10 +48,6 @@
|
|||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#ifndef ttyname
|
||||
extern char *ttyname();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LIBC_H_WITH_UNISTD_H
|
||||
|
@ -85,15 +64,23 @@ extern char *ttyname();
|
|||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* Some defines for Windows here. */
|
||||
# include <process.h>
|
||||
# define pipe(fd) _pipe (fd, 256, O_BINARY)
|
||||
#endif /* __MINGW32__ */
|
||||
#include "libguile/_scm.h"
|
||||
#include "libguile/dynwind.h"
|
||||
#include "libguile/fports.h"
|
||||
#include "libguile/scmsigs.h"
|
||||
#include "libguile/feature.h"
|
||||
#include "libguile/strings.h"
|
||||
#include "libguile/srfi-13.h"
|
||||
#include "libguile/srfi-14.h"
|
||||
#include "libguile/vectors.h"
|
||||
#include "libguile/values.h"
|
||||
|
||||
#include "libguile/validate.h"
|
||||
#include "libguile/posix.h"
|
||||
#include "libguile/gettext.h"
|
||||
#include "libguile/threads.h"
|
||||
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
|
@ -1922,21 +1909,7 @@ SCM_DEFINE (scm_chroot, "chroot", 1, 0, 0,
|
|||
#endif /* HAVE_CHROOT */
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* Wrapper function to supplying `getlogin()' under Windows. */
|
||||
static char * getlogin (void)
|
||||
{
|
||||
static char user[256];
|
||||
static unsigned long len = 256;
|
||||
|
||||
if (!GetUserName (user, &len))
|
||||
return NULL;
|
||||
return user;
|
||||
}
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
|
||||
#if defined (HAVE_GETLOGIN) || defined (__MINGW32__)
|
||||
#if defined (HAVE_GETLOGIN)
|
||||
SCM_DEFINE (scm_getlogin, "getlogin", 0, 0, 0,
|
||||
(void),
|
||||
"Return a string containing the name of the user logged in on\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue