mirror of
http://mpg123.de/trunk/.git
synced 2025-10-23 16:48:31 +03:00
Moved that replacement strdup to commpat.c, also check for it instead of assuming some specific system.
git-svn-id: svn://scm.orgis.org/mpg123/trunk@1594 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
@@ -382,6 +382,8 @@ AC_CHECK_FUNCS( setpriority )
|
|||||||
|
|
||||||
AC_CHECK_FUNCS( strerror )
|
AC_CHECK_FUNCS( strerror )
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS( strdup )
|
||||||
|
|
||||||
AC_CHECK_FUNCS( mkfifo, [ have_mkfifo=yes ], [ have_mkfifo=no ] )
|
AC_CHECK_FUNCS( mkfifo, [ have_mkfifo=yes ], [ have_mkfifo=no ] )
|
||||||
|
|
||||||
if test $fifo = "auto"; then
|
if test $fifo = "auto"; then
|
||||||
|
|||||||
@@ -10,23 +10,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "getlopt.h"
|
#include "getlopt.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
int loptind = 1; /* index in argv[] */
|
int loptind = 1; /* index in argv[] */
|
||||||
int loptchr = 0; /* index in argv[loptind] */
|
int loptchr = 0; /* index in argv[loptind] */
|
||||||
char *loptarg; /* points to argument if present, else to option */
|
char *loptarg; /* points to argument if present, else to option */
|
||||||
|
|
||||||
#if defined(ultrix) || defined(ULTRIX)
|
|
||||||
char *strdup (char *src)
|
|
||||||
{
|
|
||||||
char *dest;
|
|
||||||
|
|
||||||
if (!(dest = (char *) malloc(strlen(src)+1)))
|
|
||||||
return (NULL);
|
|
||||||
return (strcpy(dest, src));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
topt *findopt (int islong, char *opt, topt *opts)
|
topt *findopt (int islong, char *opt, topt *opts)
|
||||||
{
|
{
|
||||||
if (!opts)
|
if (!opts)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
compat: Some compatibility functions.
|
compat: Some compatibility functions. Basic standard C stuff, that may barely be above/around C89.
|
||||||
|
|
||||||
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
|
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
|
||||||
|
|
||||||
|
copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
|
||||||
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
||||||
initially written by Thomas Orgis
|
initially written by Thomas Orgis
|
||||||
*/
|
*/
|
||||||
@@ -25,3 +27,15 @@ const char *strerror(int errnum)
|
|||||||
return (errnum < sys_nerr) ? sys_errlist[errnum] : "";
|
return (errnum < sys_nerr) ? sys_errlist[errnum] : "";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STRDUP
|
||||||
|
char *strdup(const char *src)
|
||||||
|
{
|
||||||
|
char *dest;
|
||||||
|
|
||||||
|
if (!(dest = (char *) malloc(strlen(src)+1)))
|
||||||
|
return NULL;
|
||||||
|
else
|
||||||
|
return strcpy(dest, src);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
compat: Some compatibility functions.
|
compat: Some compatibility functions. Basic standard C stuff, that may barely be above/around C89.
|
||||||
|
|
||||||
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
|
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
|
||||||
|
It is envisioned to include this compat header instead of any of the "standard" headers, to catch compatibility issues.
|
||||||
|
So, don't include stdlib.h or string.h ... include compat.h.
|
||||||
|
|
||||||
|
copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
|
||||||
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
||||||
initially written by Thomas Orgis
|
initially written by Thomas Orgis
|
||||||
*/
|
*/
|
||||||
@@ -9,12 +13,24 @@
|
|||||||
#ifndef MPG123_COMPAT_H
|
#ifndef MPG123_COMPAT_H
|
||||||
#define MPG123_COMPAT_H
|
#define MPG123_COMPAT_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
/* realloc, size_t */
|
/* realloc, size_t */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void *safe_realloc(void *ptr, size_t size);
|
void *safe_realloc(void *ptr, size_t size);
|
||||||
#ifndef HAVE_STRERROR
|
#ifndef HAVE_STRERROR
|
||||||
const char *strerror(int errnum);
|
const char *strerror(int errnum);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STRDUP
|
||||||
|
char *strdup(const char *s);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user