Created a separate static portability library and moved some of the

libwine routines in there.
This commit is contained in:
Alexandre Julliard 2003-03-19 22:09:16 +00:00
parent ea8d2e2141
commit 6a9fe36de2
33 changed files with 593 additions and 286 deletions

View File

@ -70,6 +70,7 @@ WIDL = $(TOOLSDIR)/tools/widl/widl
WRCFLAGS = -J -m $(EXTRAWRCFLAGS)
LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls
LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port
LIBWINE = -L$(TOPOBJDIR)/library -lwine
LIBUNICODE = -L$(TOPOBJDIR)/unicode -lwine_unicode
LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid

View File

@ -32,6 +32,7 @@ SUBDIRS = \
documentation \
include \
library \
libs \
miscemu \
ole \
programs \
@ -55,7 +56,7 @@ INSTALLDEVSUBDIRS = \
tools
# Sub-directories to install for both install-lib and install-dev
INSTALLBOTHSUBDIRS = dlls
INSTALLBOTHSUBDIRS = dlls libs
INSTALLSUBDIRS = $(INSTALLDEVSUBDIRS) $(INSTALLLIBSUBDIRS)
@ -120,15 +121,16 @@ $(INSTALLBOTHSUBDIRS:%=%/__uninstall__): dummy
# Dependencies between directories
all: $(SUBDIRS)
dlls: library ole tools unicode
server: library tools unicode
miscemu programs: dlls library ole tools unicode
tools: library unicode
dlls: library libs ole tools unicode
server: library libs tools unicode
miscemu programs: dlls library libs ole tools unicode
tools: library libs unicode
dlls/__install-lib__ dlls/__install-dev__: library ole tools unicode
server/__install__: library tools unicode
miscemu/__install__ programs/__install__: library ole tools unicode dlls/__install-lib__
dlls/__install-lib__ dlls/__install-dev__: library libs ole tools unicode
server/__install__: library libs tools unicode
miscemu/__install__ programs/__install__: library libs ole tools unicode dlls/__install-lib__
library/__install__: library
libs/__install__: libs
ole/__install__: ole
tools/__install__: tools
unicode/__install__: unicode

4
configure vendored

File diff suppressed because one or more lines are too long

View File

@ -1517,6 +1517,8 @@ dlls/x11drv/Makefile
documentation/Makefile
include/Makefile
library/Makefile
libs/Makefile
libs/port/Makefile
miscemu/Makefile
ole/Makefile
programs/Makefile

View File

@ -16,7 +16,7 @@ MAINSPEC = $(MODULE:%.dll=%).spec
SPEC_DEF = $(MAINSPEC).def
WIN16_FILES = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
all: $(MODULE)$(DLLEXT) $(SUBDIRS)

View File

@ -21,7 +21,7 @@ RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
C_SRCS = $(CTESTS)
EXTRA_SRCS = $(TESTLIST)
EXTRA_OBJS = $(TESTLIST:.c=.o)
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe

View File

@ -64,88 +64,6 @@
# include <stdint.h>
#endif
/***********************************************************************
* usleep
*/
#ifndef HAVE_USLEEP
int usleep (unsigned int useconds)
{
#if defined(__EMX__)
DosSleep(useconds);
return 0;
#elif defined(__BEOS__)
return snooze(useconds);
#elif defined(HAVE_SELECT)
struct timeval delay;
delay.tv_sec = useconds / 1000000;
delay.tv_usec = useconds % 1000000;
select( 0, 0, 0, 0, &delay );
return 0;
#else /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
errno = ENOSYS;
return -1;
#endif /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
}
#endif /* HAVE_USLEEP */
/***********************************************************************
* memmove
*/
#ifndef HAVE_MEMMOVE
void *memmove( void *dest, const void *src, size_t len )
{
register char *dst = dest;
/* Use memcpy if not overlapping */
if ((dst + len <= (char *)src) || ((char *)src + len <= dst))
{
memcpy( dst, src, len );
}
/* Otherwise do it the hard way (FIXME: could do better than this) */
else if (dst < (char *)src)
{
while (len--) *dst++ = *((char *)src)++;
}
else
{
dst += len - 1;
src = (char *)src + len - 1;
while (len--) *dst-- = *((char *)src)--;
}
return dest;
}
#endif /* HAVE_MEMMOVE */
/***********************************************************************
* strerror
*/
#ifndef HAVE_STRERROR
const char *strerror( int err )
{
/* Let's hope we have sys_errlist then */
return sys_errlist[err];
}
#endif /* HAVE_STRERROR */
/***********************************************************************
* getpagesize
*/
#ifndef HAVE_GETPAGESIZE
size_t getpagesize(void)
{
# ifdef __svr4__
return sysconf(_SC_PAGESIZE);
# elif defined(__i386__)
return 4096;
# else
# error Cannot get the page size on this platform
# endif
}
#endif /* HAVE_GETPAGESIZE */
/***********************************************************************
* clone
@ -181,42 +99,6 @@ int clone( int (*fn)(void *), void *stack, int flags, void *arg )
}
#endif /* !HAVE_CLONE && __linux__ */
/***********************************************************************
* strcasecmp
*/
#ifndef HAVE_STRCASECMP
int strcasecmp( const char *str1, const char *str2 )
{
const unsigned char *ustr1 = (const unsigned char *)str1;
const unsigned char *ustr2 = (const unsigned char *)str2;
while (*ustr1 && toupper(*ustr1) == toupper(*ustr2)) {
ustr1++;
ustr2++;
}
return toupper(*ustr1) - toupper(*ustr2);
}
#endif /* HAVE_STRCASECMP */
/***********************************************************************
* strncasecmp
*/
#ifndef HAVE_STRNCASECMP
int strncasecmp( const char *str1, const char *str2, size_t n )
{
const unsigned char *ustr1 = (const unsigned char *)str1;
const unsigned char *ustr2 = (const unsigned char *)str2;
int res;
if (!n) return 0;
while ((--n > 0) && *ustr1) {
if ((res = toupper(*ustr1) - toupper(*ustr2))) return res;
ustr1++;
ustr2++;
}
return toupper(*ustr1) - toupper(*ustr2);
}
#endif /* HAVE_STRNCASECMP */
/***********************************************************************
* getsockopt
@ -241,134 +123,6 @@ unsigned long inet_network(const char *cp)
}
#endif /* defined(HAVE_INET_NETWORK) */
/***********************************************************************
* statfs
*/
#ifndef HAVE_STATFS
int statfs(const char *name, struct statfs *info)
{
#ifdef __BEOS__
dev_t mydev;
fs_info fsinfo;
if(!info) {
errno = ENOSYS;
return -1;
}
if ((mydev = dev_for_path(name)) < 0) {
errno = ENOSYS;
return -1;
}
if (fs_stat_dev(mydev,&fsinfo) < 0) {
errno = ENOSYS;
return -1;
}
info->f_bsize = fsinfo.block_size;
info->f_blocks = fsinfo.total_blocks;
info->f_bfree = fsinfo.free_blocks;
return 0;
#else /* defined(__BEOS__) */
errno = ENOSYS;
return -1;
#endif /* defined(__BEOS__) */
}
#endif /* !defined(HAVE_STATFS) */
/***********************************************************************
* lstat
*/
#ifndef HAVE_LSTAT
int lstat(const char *file_name, struct stat *buf)
{
return stat( file_name, buf );
}
#endif /* HAVE_LSTAT */
/***********************************************************************
* mkstemp
*/
#ifndef HAVE_MKSTEMP
int mkstemp(char *tmpfn)
{
int tries;
char *xstart;
xstart = tmpfn+strlen(tmpfn)-1;
while ((xstart > tmpfn) && (*xstart == 'X'))
xstart--;
tries = 10;
while (tries--) {
char *newfn = mktemp(tmpfn);
int fd;
if (!newfn) /* something else broke horribly */
return -1;
fd = open(newfn,O_CREAT|O_RDWR|O_EXCL,0600);
if (fd!=-1)
return fd;
newfn = xstart;
/* fill up with X and try again ... */
while (*newfn) *newfn++ = 'X';
}
return -1;
}
#endif /* HAVE_MKSTEMP */
/***********************************************************************
* pread
*
* FIXME: this is not thread-safe
*/
#ifndef HAVE_PREAD
ssize_t pread( int fd, void *buf, size_t count, off_t offset )
{
ssize_t ret;
off_t old_pos;
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
if ((ret = read( fd, buf, count )) == -1)
{
int err = errno; /* save errno */
lseek( fd, old_pos, SEEK_SET );
errno = err;
return -1;
}
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
return ret;
}
#endif /* HAVE_PREAD */
/***********************************************************************
* pwrite
*
* FIXME: this is not thread-safe
*/
#ifndef HAVE_PWRITE
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset )
{
ssize_t ret;
off_t old_pos;
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
if ((ret = write( fd, buf, count )) == -1)
{
int err = errno; /* save errno */
lseek( fd, old_pos, SEEK_SET );
errno = err;
return -1;
}
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
return ret;
}
#endif /* HAVE_PWRITE */
#if defined(__svr4__) || defined(__NetBSD__)
/***********************************************************************

1
libs/.cvsignore Normal file
View File

@ -0,0 +1 @@
Makefile

25
libs/Makefile.in Normal file
View File

@ -0,0 +1,25 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
SUBDIRS = \
port
# Sub-directories to install for install-lib
INSTALLLIBSUBDIRS =
# Sub-directories to install for install-dev
INSTALLDEVSUBDIRS =
INSTALLSUBDIRS = $(INSTALLDEVSUBDIRS) $(INSTALLLIBSUBDIRS)
@MAKE_RULES@
all: $(SUBDIRS)
install-lib:: $(INSTALLLIBSUBDIRS:%=%/__install__)
install-dev:: $(INSTALLDEVSUBDIRS:%=%/__install__)
### Dependencies:

1
libs/port/.cvsignore Normal file
View File

@ -0,0 +1 @@
Makefile

30
libs/port/Makefile.in Normal file
View File

@ -0,0 +1,30 @@
DEFS = @DLLFLAGS@ -D__WINESRC__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = libwine_port.a
C_SRCS = \
getpagesize.c \
lstat.c \
memmove.c \
mkstemp.c \
pread.c \
pwrite.c \
statfs.c \
strcasecmp.c \
strerror.c \
strncasecmp.c \
usleep.c
all: $(MODULE)
@MAKE_RULES@
$(MODULE): $(OBJS) Makefile.in
$(RM) $@
$(AR) $@ $(OBJS)
$(RANLIB) $@
### Dependencies:

39
libs/port/getpagesize.c Normal file
View File

@ -0,0 +1,39 @@
/*
* getpagesize function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef HAVE_GETPAGESIZE
size_t getpagesize(void)
{
# ifdef __svr4__
return sysconf(_SC_PAGESIZE);
# elif defined(__i386__)
return 4096;
# else
# error Cannot get the page size on this platform
# endif
}
#endif /* HAVE_GETPAGESIZE */

29
libs/port/lstat.c Normal file
View File

@ -0,0 +1,29 @@
/*
* lstat function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_LSTAT
int lstat(const char *file_name, struct stat *buf)
{
return stat( file_name, buf );
}
#endif /* HAVE_LSTAT */

47
libs/port/memmove.c Normal file
View File

@ -0,0 +1,47 @@
/*
* memmove function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_MEMMOVE
void *memmove( void *dest, const void *src, size_t len )
{
register char *dst = dest;
/* Use memcpy if not overlapping */
if ((dst + len <= (char *)src) || ((char *)src + len <= dst))
{
memcpy( dst, src, len );
}
/* Otherwise do it the hard way (FIXME: could do better than this) */
else if (dst < (char *)src)
{
while (len--) *dst++ = *((char *)src)++;
}
else
{
dst += len - 1;
src = (char *)src + len - 1;
while (len--) *dst-- = *((char *)src)--;
}
return dest;
}
#endif /* HAVE_MEMMOVE */

55
libs/port/mkstemp.c Normal file
View File

@ -0,0 +1,55 @@
/*
* mkstemp function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <fcntl.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef HAVE_MKSTEMP
int mkstemp(char *tmpfn)
{
int tries;
char *xstart;
xstart = tmpfn+strlen(tmpfn)-1;
while ((xstart > tmpfn) && (*xstart == 'X'))
xstart--;
tries = 10;
while (tries--)
{
char *newfn = mktemp(tmpfn);
int fd;
if (!newfn) /* something else broke horribly */
return -1;
fd = open(newfn,O_CREAT|O_RDWR|O_EXCL,0600);
if (fd!=-1)
return fd;
newfn = xstart;
/* fill up with X and try again ... */
while (*newfn) *newfn++ = 'X';
}
return -1;
}
#endif /* HAVE_MKSTEMP */

49
libs/port/pread.c Normal file
View File

@ -0,0 +1,49 @@
/*
* pread function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* FIXME: this is not thread-safe */
#ifndef HAVE_PREAD
ssize_t pread( int fd, void *buf, size_t count, off_t offset )
{
ssize_t ret;
off_t old_pos;
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
if ((ret = read( fd, buf, count )) == -1)
{
int err = errno; /* save errno */
lseek( fd, old_pos, SEEK_SET );
errno = err;
return -1;
}
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
return ret;
}
#endif /* HAVE_PREAD */

49
libs/port/pwrite.c Normal file
View File

@ -0,0 +1,49 @@
/*
* pwrite function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* FIXME: this is not thread-safe */
#ifndef HAVE_PWRITE
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset )
{
ssize_t ret;
off_t old_pos;
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
if ((ret = write( fd, buf, count )) == -1)
{
int err = errno; /* save errno */
lseek( fd, old_pos, SEEK_SET );
errno = err;
return -1;
}
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
return ret;
}
#endif /* HAVE_PWRITE */

76
libs/port/statfs.c Normal file
View File

@ -0,0 +1,76 @@
/*
* statfs function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifdef __BEOS__
#include <be/kernel/fs_info.h>
#include <be/kernel/OS.h>
#endif
#include <errno.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifdef STATFS_DEFINED_BY_SYS_VFS
# include <sys/vfs.h>
#else
# ifdef STATFS_DEFINED_BY_SYS_MOUNT
# include <sys/mount.h>
# else
# ifdef STATFS_DEFINED_BY_SYS_STATFS
# include <sys/statfs.h>
# endif
# endif
#endif
#ifndef HAVE_STATFS
int statfs(const char *name, struct statfs *info)
{
#ifdef __BEOS__
dev_t mydev;
fs_info fsinfo;
if(!info) {
errno = ENOSYS;
return -1;
}
if ((mydev = dev_for_path(name)) < 0) {
errno = ENOSYS;
return -1;
}
if (fs_stat_dev(mydev,&fsinfo) < 0) {
errno = ENOSYS;
return -1;
}
info->f_bsize = fsinfo.block_size;
info->f_blocks = fsinfo.total_blocks;
info->f_bfree = fsinfo.free_blocks;
return 0;
#else /* defined(__BEOS__) */
errno = ENOSYS;
return -1;
#endif /* defined(__BEOS__) */
}
#endif /* !defined(HAVE_STATFS) */

38
libs/port/strcasecmp.c Normal file
View File

@ -0,0 +1,38 @@
/*
* strcasecmp function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <ctype.h>
#ifndef HAVE_STRCASECMP
int strcasecmp( const char *str1, const char *str2 )
{
const unsigned char *ustr1 = (const unsigned char *)str1;
const unsigned char *ustr2 = (const unsigned char *)str2;
while (*ustr1 && toupper(*ustr1) == toupper(*ustr2)) {
ustr1++;
ustr2++;
}
return toupper(*ustr1) - toupper(*ustr2);
}
#endif /* HAVE_STRCASECMP */

30
libs/port/strerror.c Normal file
View File

@ -0,0 +1,30 @@
/*
* strerror function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_STRERROR
const char *strerror( int err )
{
/* Let's hope we have sys_errlist then */
return sys_errlist[err];
}
#endif /* HAVE_STRERROR */

42
libs/port/strncasecmp.c Normal file
View File

@ -0,0 +1,42 @@
/*
* strncasecmp function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <ctype.h>
#ifndef HAVE_STRNCASECMP
int strncasecmp( const char *str1, const char *str2, size_t n )
{
const unsigned char *ustr1 = (const unsigned char *)str1;
const unsigned char *ustr2 = (const unsigned char *)str2;
int res;
if (!n) return 0;
while ((--n > 0) && *ustr1)
{
if ((res = toupper(*ustr1) - toupper(*ustr2))) return res;
ustr1++;
ustr2++;
}
return toupper(*ustr1) - toupper(*ustr2);
}
#endif /* HAVE_STRNCASECMP */

45
libs/port/usleep.c Normal file
View File

@ -0,0 +1,45 @@
/*
* usleep function
*
* Copyright 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_USLEEP
int usleep (unsigned int useconds)
{
#if defined(__EMX__)
DosSleep(useconds);
return 0;
#elif defined(__BEOS__)
return snooze(useconds);
#elif defined(HAVE_SELECT)
struct timeval delay;
delay.tv_sec = useconds / 1000000;
delay.tv_usec = useconds % 1000000;
select( 0, 0, 0, 0, &delay );
return 0;
#else /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
errno = ENOSYS;
return -1;
#endif /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
}
#endif /* HAVE_USLEEP */

View File

@ -18,7 +18,7 @@ all: $(MODULE)
ALL_OBJS = $(SPEC_SRCS:.spec=.spec.o) $(OBJS)
$(MODULE): $(ALL_OBJS)
$(CC) -o $@ $(ALL_OBJS) -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS)
$(CC) -o $@ $(ALL_OBJS) -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBPORT) $(LIBS) $(LDFLAGS)
wine.spec.c: $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe wine -mgui -e wine_initial_task -L$(DLLDIR) $(IMPORTS:%=-l%)

View File

@ -12,7 +12,7 @@
DEFS = @DLLFLAGS@ $(EXTRADEFS)
LDDLLFLAGS = @LDDLLFLAGS@
ALL_OBJS = $(OBJS) $(MODULE).dbg.o
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
BASEMODULE = $(MODULE:.exe=)
TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR) $(PLTESTPROGRAM:%=-p %)

View File

@ -6,7 +6,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = aviinfo.exe aviplay.exe icinfo.exe
ALL_LIBS = $(LIBWINE) $(LIBS)
ALL_LIBS = $(LIBWINE) $(LIBPORT) $(LIBS)
C_SRCS = \
aviinfo.c \

View File

@ -50,7 +50,7 @@ all: $(PROGRAMS)
@MAKE_RULES@
wineserver: $(OBJS)
$(CC) -o $(PROGRAMS) $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS)
$(CC) -o $(PROGRAMS) $(OBJS) $(LIBUNICODE) $(LIBPORT) $(LIBS) $(LDFLAGS)
install:: $(PROGRAMS)
$(MKINSTALLDIRS) $(bindir)

View File

@ -1,9 +1,9 @@
DEFS = -DNO_LIBWINE -DLEX_OUTPUT_ROOT="\"@LEX_OUTPUT_ROOT@\"" -DINCLUDEDIR="\"$(includedir)\"" -DBINDIR="\"$(bindir)\""
DEFS = -DLEX_OUTPUT_ROOT="\"@LEX_OUTPUT_ROOT@\"" -DINCLUDEDIR="\"$(includedir)\"" -DBINDIR="\"$(bindir)\""
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
MODULE = none
PROGRAMS = \
bin2res \
@ -40,19 +40,19 @@ all: $(PROGRAMS) $(SUBDIRS)
widl wrc: wpp
makedep: makedep.o
$(CC) $(CFLAGS) -o makedep makedep.o
$(CC) $(CFLAGS) -o makedep makedep.o $(LIBPORT)
fnt2bdf: fnt2bdf.o
$(CC) $(CFLAGS) -o fnt2bdf fnt2bdf.o
$(CC) $(CFLAGS) -o fnt2bdf fnt2bdf.o $(LIBPORT)
bin2res: bin2res.o
$(CC) $(CFLAGS) -o bin2res bin2res.o
$(CC) $(CFLAGS) -o bin2res bin2res.o $(LIBPORT)
winegcc: winegcc.o
$(CC) $(CFLAGS) -o winegcc winegcc.o
$(CC) $(CFLAGS) -o winegcc winegcc.o $(LIBPORT)
winewrap: winewrap.o
$(CC) $(CFLAGS) -o winewrap winewrap.o
$(CC) $(CFLAGS) -o winewrap winewrap.o $(LIBPORT)
install::
$(MKINSTALLDIRS) $(bindir) $(mandir)/man$(prog_manext)

View File

@ -23,11 +23,8 @@ all: $(PROGRAMS)
@MAKE_RULES@
widl: $(OBJS) $(TOPOBJDIR)/tools/wpp/libwpp.a
$(CC) $(CFLAGS) -o widl $(OBJS) $(EXTRALIBS) $(LIBWINE) $(LIBUNICODE) $(LEXLIB) $(LDFLAGS)
widl.exe: $(OBJS) $(TOPOBJDIR)/tools/wpp/libwpp.a
$(CC) $(CFLAGS) -o widl.exe $(OBJS) $(EXTRALIBS) $(LIBWINE) $(LIBUNICODE) $(LEXLIB) -liberty $(LDFLAGS)
widl$(EXEEXT): $(OBJS) $(TOPOBJDIR)/tools/wpp/libwpp.a
$(CC) $(CFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(LIBPORT) $(LEXLIB) $(LDFLAGS)
y.tab.c y.tab.h: parser.y
$(YACC) $(YACCOPT) -d -t $(SRCDIR)/parser.y

View File

@ -29,7 +29,6 @@
#include <assert.h>
#include <ctype.h>
#include "wine/unicode.h"
#include "widl.h"
#include "utils.h"
#include "parser.h"

View File

@ -23,7 +23,7 @@ all: $(PROGRAMS) winebuild.man
@MAKE_RULES@
winebuild$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LDFLAGS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBUNICODE) $(LIBPORT) $(LDFLAGS)
winebuild.man: winebuild.man.in
sed -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $(SRCDIR)/winebuild.man.in >$@ || $(RM) $@

View File

@ -22,7 +22,7 @@ all: $(PROGRAMS)
@MAKE_RULES@
winedump: $(OBJS)
$(CC) $(CFLAGS) -o winedump $(OBJS) $(LIBWINE) $(LDFLAGS)
$(CC) $(CFLAGS) -o winedump $(OBJS) $(LIBPORT) $(LDFLAGS)
install:: $(PROGRAMS)
$(MKINSTALLDIRS) $(bindir)

View File

@ -24,11 +24,8 @@ mcl.o: y.tab.h
@MAKE_RULES@
wmc: $(OBJS)
$(CC) $(CFLAGS) -o wmc $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LEXLIB) $(LDFLAGS)
wmc.exe: $(OBJS)
$(CC) $(CFLAGS) -o wmc.exe $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LEXLIB) -liberty $(LDFLAGS)
wmc$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBUNICODE) $(LIBPORT) $(LEXLIB) $(LDFLAGS)
y.tab.c y.tab.h: mcy.y
$(YACC) $(YACCOPT) -d -t $(SRCDIR)/mcy.y

View File

@ -27,11 +27,8 @@ all: $(PROGRAMS)
@MAKE_RULES@
wrc: $(OBJS) $(TOPOBJDIR)/tools/wpp/libwpp.a
$(CC) $(CFLAGS) -o wrc $(OBJS) $(EXTRALIBS) $(LIBWINE) $(LIBUNICODE) $(LEXLIB) $(LDFLAGS)
wrc.exe: $(OBJS) $(TOPOBJDIR)/tools/wpp/libwpp.a
$(CC) $(CFLAGS) -o wrc.exe $(OBJS) $(EXTRALIBS) $(LIBWINE) $(LIBUNICODE) $(LEXLIB) -liberty $(LDFLAGS)
wrc$(EXEEXT): $(OBJS) $(TOPOBJDIR)/tools/wpp/libwpp.a
$(CC) $(CFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(LIBUNICODE) $(LIBPORT) $(LEXLIB) $(LDFLAGS)
y.tab.c y.tab.h: parser.y
$(YACC) $(YACCOPT) -d -t $(SRCDIR)/parser.y