1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Changed the definition of alloca() for GCC, which now defaults

to the built-in function.

- Updated the stdio.h, stdlib.h, string.h and unistd.h header files
  to declare function prototypes for the __MEM_DEBUG versions of the
  library functions only if that preprocessor symbol is defined.

- If a SIGINT signal is caught and processed by the default signal
  handler, the localized "*** BREAK" string will be printed rather
  than the built-in one.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14786 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2004-12-26 10:28:57 +00:00
parent d74535f87f
commit ad0880d204
31 changed files with 237 additions and 216 deletions

View File

@ -1,5 +1,5 @@
# #
# $Id: GNUmakefile.68k,v 1.18 2004-12-24 18:31:37 obarthel Exp $ # $Id: GNUmakefile.68k,v 1.19 2004-12-26 10:28:56 obarthel Exp $
# #
# :ts=8 # :ts=8
# #
@ -237,9 +237,7 @@ C_LIB = \
stdio_translateioerror.o \ stdio_translateioerror.o \
stdio_ungetc.o \ stdio_ungetc.o \
stdio_vasprintf.o \ stdio_vasprintf.o \
stdio_vasprintf_debug.o \
stdio_vasprintf_hook_entry.o \ stdio_vasprintf_hook_entry.o \
stdio_vasprintf_hook_entry_debug.o \
stdio_vfprintf.o \ stdio_vfprintf.o \
stdio_vfscanf.o \ stdio_vfscanf.o \
stdio_vprintf.o \ stdio_vprintf.o \
@ -250,14 +248,12 @@ C_LIB = \
stdlib_abort.o \ stdlib_abort.o \
stdlib_abs.o \ stdlib_abs.o \
stdlib_alloca.o \ stdlib_alloca.o \
stdlib_alloca_debug.o \
stdlib_assertion_failure.o \ stdlib_assertion_failure.o \
stdlib_atexit.o \ stdlib_atexit.o \
stdlib_atoi.o \ stdlib_atoi.o \
stdlib_atol.o \ stdlib_atol.o \
stdlib_bsearch.o \ stdlib_bsearch.o \
stdlib_calloc.o \ stdlib_calloc.o \
stdlib_calloc_debug.o \
stdlib_checkdetach.o \ stdlib_checkdetach.o \
stdlib_constructor.o \ stdlib_constructor.o \
stdlib_constructor_begin.o \ stdlib_constructor_begin.o \
@ -274,7 +270,6 @@ C_LIB = \
stdlib_dosbase.o \ stdlib_dosbase.o \
stdlib_exit.o \ stdlib_exit.o \
stdlib_free.o \ stdlib_free.o \
stdlib_free_debug.o \
stdlib_getdefstacksize.o \ stdlib_getdefstacksize.o \
stdlib_getenv.o \ stdlib_getenv.o \
stdlib_getsp.o \ stdlib_getsp.o \
@ -284,7 +279,6 @@ C_LIB = \
stdlib_ldiv.o \ stdlib_ldiv.o \
stdlib_machine_test.o \ stdlib_machine_test.o \
stdlib_malloc.o \ stdlib_malloc.o \
stdlib_malloc_debug.o \
stdlib_math.o \ stdlib_math.o \
stdlib_mkdtemp.o \ stdlib_mkdtemp.o \
stdlib_mkstemp.o \ stdlib_mkstemp.o \
@ -303,6 +297,7 @@ C_LIB = \
stdlib_red_black.o \ stdlib_red_black.o \
stdlib_setenv.o \ stdlib_setenv.o \
stdlib_setjmp.o \ stdlib_setjmp.o \
stdlib_set_process_window.o \
stdlib_shell_escape.o \ stdlib_shell_escape.o \
stdlib_showerror.o \ stdlib_showerror.o \
stdlib_socket.o \ stdlib_socket.o \
@ -348,7 +343,6 @@ C_LIB = \
string_strcpy.o \ string_strcpy.o \
string_strcspn.o \ string_strcspn.o \
string_strdup.o \ string_strdup.o \
string_strdup_debug.o \
string_strerror.o \ string_strerror.o \
string_strlcat.o \ string_strlcat.o \
string_strlcpy.o \ string_strlcpy.o \
@ -391,7 +385,6 @@ C_LIB = \
unistd_fileno.o \ unistd_fileno.o \
unistd_ftruncate.o \ unistd_ftruncate.o \
unistd_getcwd.o \ unistd_getcwd.o \
unistd_getcwd_debug.o \
unistd_getopt.o \ unistd_getopt.o \
unistd_getpid.o \ unistd_getpid.o \
unistd_init_exit.o \ unistd_init_exit.o \
@ -446,7 +439,6 @@ UNIX_LIB = \
unistd_chdir_exit.o \ unistd_chdir_exit.o \
unistd_chown.o \ unistd_chown.o \
unistd_getcwd.o \ unistd_getcwd.o \
unistd_getcwd_debug.o \
unistd_lchown.o \ unistd_lchown.o \
unistd_link.o \ unistd_link.o \
unistd_readlink.o \ unistd_readlink.o \
@ -504,7 +496,6 @@ MATH_LIB = \
stdio_sprintf.o \ stdio_sprintf.o \
stdio_sscanf.o \ stdio_sscanf.o \
stdio_vasprintf.o \ stdio_vasprintf.o \
stdio_vasprintf_debug.o \
stdio_vfprintf.o \ stdio_vfprintf.o \
stdio_vfscanf.o \ stdio_vfscanf.o \
stdio_vprintf.o \ stdio_vprintf.o \
@ -702,6 +693,17 @@ AMIGA_LIB = \
amiga_timedelay.o \ amiga_timedelay.o \
amiga_waitbeam.o amiga_waitbeam.o
MEMDEBUG_LIB = \
stdio_vasprintf_debug.o \
stdio_vasprintf_debug.o \
stdio_vasprintf_hook_entry_debug.o \
stdlib_alloca_debug.o \
stdlib_calloc_debug.o \
stdlib_free_debug.o \
stdlib_malloc_debug.o \
string_strdup_debug.o \
unistd_getcwd_debug.o
############################################################################## ##############################################################################
LIBS_68K := $(LIBC_OBJS)/libc.a $(LIBSTACK_OBJS)/libstack.a $(LIBUNIX_OBJS)/libunix.a \ LIBS_68K := $(LIBC_OBJS)/libc.a $(LIBSTACK_OBJS)/libstack.a $(LIBUNIX_OBJS)/libunix.a \

View File

@ -1,5 +1,5 @@
# #
# $Id: GNUmakefile.os4,v 1.18 2004-12-24 18:31:37 obarthel Exp $ # $Id: GNUmakefile.os4,v 1.19 2004-12-26 10:28:56 obarthel Exp $
# #
# :ts=8 # :ts=8
# #
@ -241,9 +241,7 @@ C_LIB = \
stdio_translateioerror.o \ stdio_translateioerror.o \
stdio_ungetc.o \ stdio_ungetc.o \
stdio_vasprintf.o \ stdio_vasprintf.o \
stdio_vasprintf_debug.o \
stdio_vasprintf_hook_entry.o \ stdio_vasprintf_hook_entry.o \
stdio_vasprintf_hook_entry_debug.o \
stdio_vfprintf.o \ stdio_vfprintf.o \
stdio_vfscanf.o \ stdio_vfscanf.o \
stdio_vprintf.o \ stdio_vprintf.o \
@ -254,14 +252,12 @@ C_LIB = \
stdlib_abort.o \ stdlib_abort.o \
stdlib_abs.o \ stdlib_abs.o \
stdlib_alloca.o \ stdlib_alloca.o \
stdlib_alloca_debug.o \
stdlib_assertion_failure.o \ stdlib_assertion_failure.o \
stdlib_atexit.o \ stdlib_atexit.o \
stdlib_atoi.o \ stdlib_atoi.o \
stdlib_atol.o \ stdlib_atol.o \
stdlib_bsearch.o \ stdlib_bsearch.o \
stdlib_calloc.o \ stdlib_calloc.o \
stdlib_calloc_debug.o \
stdlib_checkdetach.o \ stdlib_checkdetach.o \
stdlib_constructor.o \ stdlib_constructor.o \
stdlib_constructor_begin.o \ stdlib_constructor_begin.o \
@ -278,7 +274,6 @@ C_LIB = \
stdlib_dosbase.o \ stdlib_dosbase.o \
stdlib_exit.o \ stdlib_exit.o \
stdlib_free.o \ stdlib_free.o \
stdlib_free_debug.o \
stdlib_getdefstacksize.o \ stdlib_getdefstacksize.o \
stdlib_getenv.o \ stdlib_getenv.o \
stdlib_getsp.o \ stdlib_getsp.o \
@ -288,7 +283,6 @@ C_LIB = \
stdlib_ldiv.o \ stdlib_ldiv.o \
stdlib_machine_test.o \ stdlib_machine_test.o \
stdlib_malloc.o \ stdlib_malloc.o \
stdlib_malloc_debug.o \
stdlib_math.o \ stdlib_math.o \
stdlib_mkdtemp.o \ stdlib_mkdtemp.o \
stdlib_mkstemp.o \ stdlib_mkstemp.o \
@ -307,6 +301,7 @@ C_LIB = \
stdlib_red_black.o \ stdlib_red_black.o \
stdlib_setenv.o \ stdlib_setenv.o \
stdlib_setjmp.o \ stdlib_setjmp.o \
stdlib_set_process_window.o \
stdlib_shell_escape.o \ stdlib_shell_escape.o \
stdlib_showerror.o \ stdlib_showerror.o \
stdlib_socket.o \ stdlib_socket.o \
@ -352,7 +347,6 @@ C_LIB = \
string_strcpy.o \ string_strcpy.o \
string_strcspn.o \ string_strcspn.o \
string_strdup.o \ string_strdup.o \
string_strdup_debug.o \
string_strerror.o \ string_strerror.o \
string_strlcat.o \ string_strlcat.o \
string_strlcpy.o \ string_strlcpy.o \
@ -395,7 +389,6 @@ C_LIB = \
unistd_fileno.o \ unistd_fileno.o \
unistd_ftruncate.o \ unistd_ftruncate.o \
unistd_getcwd.o \ unistd_getcwd.o \
unistd_getcwd_debug.o \
unistd_getopt.o \ unistd_getopt.o \
unistd_getpid.o \ unistd_getpid.o \
unistd_init_exit.o \ unistd_init_exit.o \
@ -451,7 +444,6 @@ UNIX_LIB = \
unistd_chdir_exit.o \ unistd_chdir_exit.o \
unistd_chown.o \ unistd_chown.o \
unistd_getcwd.o \ unistd_getcwd.o \
unistd_getcwd_debug.o \
unistd_lchown.o \ unistd_lchown.o \
unistd_link.o \ unistd_link.o \
unistd_readlink.o \ unistd_readlink.o \
@ -516,7 +508,6 @@ MATH_LIB = \
stdio_sprintf.o \ stdio_sprintf.o \
stdio_sscanf.o \ stdio_sscanf.o \
stdio_vasprintf.o \ stdio_vasprintf.o \
stdio_vasprintf_debug.o \
stdio_vfprintf.o \ stdio_vfprintf.o \
stdio_vfscanf.o \ stdio_vfscanf.o \
stdio_vprintf.o \ stdio_vprintf.o \
@ -669,6 +660,16 @@ AMIGA_LIB = \
amiga_timedelay.o \ amiga_timedelay.o \
amiga_waitbeam.o amiga_waitbeam.o
MEMDEBUG_LIB = \
stdio_vasprintf_debug.o \
stdio_vasprintf_hook_entry_debug.o \
stdlib_alloca_debug.o \
stdlib_calloc_debug.o \
stdlib_free_debug.o \
stdlib_malloc_debug.o \
string_strdup_debug.o \
unistd_getcwd_debug.o
############################################################################## ##############################################################################
# The libraries to be built, prefixed by the respective path names # The libraries to be built, prefixed by the respective path names

View File

@ -16,6 +16,17 @@
normal versions. Let's see how well this works out in the GCC normal versions. Let's see how well this works out in the GCC
version. SAS/C does not seem to like it... version. SAS/C does not seem to like it...
- Changed the definition of alloca() for GCC, which now defaults
to the built-in function.
- Updated the stdio.h, stdlib.h, string.h and unistd.h header files
to declare function prototypes for the __MEM_DEBUG versions of the
library functions only if that preprocessor symbol is defined.
- If a SIGINT signal is caught and processed by the default signal
handler, the localized "*** BREAK" string will be printed rather
than the built-in one.
c.lib 1.184 (28.11.2004) c.lib 1.184 (28.11.2004)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdio.h,v 1.3 2004-08-25 15:27:28 obarthel Exp $ * $Id: stdio.h,v 1.4 2004-12-26 10:28:57 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -328,11 +328,9 @@ extern FILE * popen(const char *command, const char *type);
extern int vasprintf(char **ret,const char *format,va_list arg); extern int vasprintf(char **ret,const char *format,va_list arg);
/* This is the version for use with memory debugging; do not call #ifdef __MEM_DEBUG
it directly! */
extern int __vasprintf(const char *file,int line,char **ret,const char *format,va_list arg); extern int __vasprintf(const char *file,int line,char **ret,const char *format,va_list arg);
#ifdef __MEM_DEBUG
#define vasprintf(ret,format,arg) __vasprintf(__FILE__,__LINE__,(ret),(format),(arg)) #define vasprintf(ret,format,arg) __vasprintf(__FILE__,__LINE__,(ret),(format),(arg))
#endif /* __MEM_DEBUG */ #endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib.h,v 1.3 2004-09-20 17:16:07 obarthel Exp $ * $Id: stdlib.h,v 1.4 2004-12-26 10:28:57 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -83,14 +83,12 @@ extern void *calloc(size_t num_elements,size_t element_size);
extern void free(void *ptr); extern void free(void *ptr);
extern void *realloc(void *ptr,size_t size); extern void *realloc(void *ptr,size_t size);
/* This are the versions for use with memory debugging; do not call #ifdef __MEM_DEBUG
them directly! */
extern void *__malloc(size_t size,const char *file,int line); extern void *__malloc(size_t size,const char *file,int line);
extern void *__calloc(size_t num_elements,size_t element_size,const char *file,int line); extern void *__calloc(size_t num_elements,size_t element_size,const char *file,int line);
extern void __free(void *ptr,const char *file,int line); extern void __free(void *ptr,const char *file,int line);
extern void *__realloc(void *ptr,size_t size,const char *file,int line); extern void *__realloc(void *ptr,size_t size,const char *file,int line);
#ifdef __MEM_DEBUG
#define malloc(size) __malloc((size),__FILE__,__LINE__) #define malloc(size) __malloc((size),__FILE__,__LINE__)
#define calloc(num_elements,element_size) __calloc((num_elements),(element_size),__FILE__,__LINE__) #define calloc(num_elements,element_size) __calloc((num_elements),(element_size),__FILE__,__LINE__)
#define free(ptr) __free((ptr),__FILE__,__LINE__) #define free(ptr) __free((ptr),__FILE__,__LINE__)
@ -157,15 +155,14 @@ extern unsigned long long strtoull(const char *str, char **ptr, int base);
/****************************************************************************/ /****************************************************************************/
#if defined(__GNUC__) #if defined(__GNUC__)
#if defined(alloca) #undef alloca
#undef alloca #define alloca(size) __builtin_alloca(size)
#define alloca(size) __builtin_alloca(size)
#endif /* alloca */
#else #else
extern void * alloca(size_t size); extern void * alloca(size_t size);
extern void * __alloca(size_t size,const char *file,int line);
#ifdef __MEM_DEBUG #ifdef __MEM_DEBUG
extern void * __alloca(size_t size,const char *file,int line);
#define alloca(size) __alloca((size),__FILE__,__LINE__) #define alloca(size) __alloca((size),__FILE__,__LINE__)
#endif /* __MEM_DEBUG */ #endif /* __MEM_DEBUG */
#endif /* __GNUC__ */ #endif /* __GNUC__ */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: string.h,v 1.5 2004-11-17 19:07:26 obarthel Exp $ * $Id: string.h,v 1.6 2004-12-26 10:28:57 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -106,11 +106,9 @@ extern char * rindex(const char *s, int c);
extern char * strdup(const char *s); extern char * strdup(const char *s);
/* This is the version for use with memory debugging; do not call #ifdef __MEM_DEBUG
it directly! */
extern char * __strdup(const char *s,const char *file,int line); extern char * __strdup(const char *s,const char *file,int line);
#ifdef __MEM_DEBUG
#define strdup(s) __strdup((s),__FILE__,__LINE__) #define strdup(s) __strdup((s),__FILE__,__LINE__)
#endif /* __MEM_DEBUG */ #endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: unistd.h,v 1.6 2004-09-29 14:17:46 obarthel Exp $ * $Id: unistd.h,v 1.7 2004-12-26 10:28:57 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -103,11 +103,9 @@ extern char *realpath(const char *file_name, char *resolved_name);
extern char * getcwd(char * buffer, size_t buffer_size); extern char * getcwd(char * buffer, size_t buffer_size);
/* This is the version for use with memory debugging; do not call #ifdef __MEM_DEBUG
it directly! */
extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int line); extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int line);
#ifdef __MEM_DEBUG
#define getcwd(buffer,buffer_size) __getcwd((buffer),(buffer_size),__FILE__,__LINE__) #define getcwd(buffer,buffer_size) __getcwd((buffer),(buffer_size),__FILE__,__LINE__)
#endif /* __MEM_DEBUG */ #endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: signal_data.c,v 1.1.1.1 2004-07-26 16:31:04 obarthel Exp $ * $Id: signal_data.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -57,5 +57,4 @@ BOOL __check_abort_enabled = TRUE;
/****************************************************************************/ /****************************************************************************/
BOOL __termination_message_printed;
BOOL __termination_message_disabled; BOOL __termination_message_disabled;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: signal_headers.h,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: signal_headers.h,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -76,15 +76,10 @@ extern int NOCOMMON __signals_blocked;
/****************************************************************************/ /****************************************************************************/
extern BOOL NOCOMMON __termination_message_printed;
extern BOOL NOCOMMON __termination_message_disabled; extern BOOL NOCOMMON __termination_message_disabled;
/****************************************************************************/ /****************************************************************************/
extern const char NOCOMMON __abnormal_program_termination[];
/****************************************************************************/
#ifndef _STDLIB_HEADERS_H #ifndef _STDLIB_HEADERS_H
#include "stdlib_headers.h" #include "stdlib_headers.h"
#endif /* _STDLIB_HEADERS_H */ #endif /* _STDLIB_HEADERS_H */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: signal_raise.c,v 1.1.1.1 2004-07-26 16:31:05 obarthel Exp $ * $Id: signal_raise.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -68,12 +68,16 @@ raise(int sig)
if(handler == SIG_DFL) if(handler == SIG_DFL)
{ {
char break_string[80];
SHOWMSG("this is the default handler"); SHOWMSG("this is the default handler");
/* Don't trigger a recursion. */ /* Don't trigger a recursion. */
__check_abort_enabled = FALSE; __check_abort_enabled = FALSE;
__print_termination_message((sig == SIGINT) ? "*** BREAK\n" : __abnormal_program_termination); Fault(ERROR_BREAK,NULL,break_string,(LONG)sizeof(break_string));
__print_termination_message((sig == SIGINT) ? break_string : NULL);
SHOWMSG("bye, bye..."); SHOWMSG("bye, bye...");

View File

@ -1,5 +1,5 @@
# #
# $Id: smakefile,v 1.14 2004-12-24 18:31:38 obarthel Exp $ # $Id: smakefile,v 1.15 2004-12-26 10:28:56 obarthel Exp $
# #
# :ts=8 # :ts=8
# #
@ -345,9 +345,7 @@ STDIO_OBJ = \
stdio_translateioerror.o \ stdio_translateioerror.o \
stdio_ungetc.o \ stdio_ungetc.o \
stdio_vasprintf.o \ stdio_vasprintf.o \
stdio_vasprintf_debug.o \
stdio_vasprintf_hook_entry.o \ stdio_vasprintf_hook_entry.o \
stdio_vasprintf_hook_debug.o \
stdio_vfprintf.o \ stdio_vfprintf.o \
stdio_vfscanf.o \ stdio_vfscanf.o \
stdio_vprintf.o \ stdio_vprintf.o \
@ -360,10 +358,6 @@ STDLIB_OBJ = \
stdlib_abort.o \ stdlib_abort.o \
stdlib_abs.o \ stdlib_abs.o \
stdlib_alloca.o \ stdlib_alloca.o \
stdlib_alloca_debug.o \
stdlib_calloc_debug.o \
stdlib_free_debug.o \
stdlib_malloc_debug.o \
stdlib_assertion_failure.o \ stdlib_assertion_failure.o \
stdlib_atexit.o \ stdlib_atexit.o \
stdlib_atof.o \ stdlib_atof.o \
@ -413,6 +407,7 @@ STDLIB_OBJ = \
stdlib_red_black.o \ stdlib_red_black.o \
stdlib_setenv.o \ stdlib_setenv.o \
stdlib_setjmp.o \ stdlib_setjmp.o \
stdlib_set_process_window.o \
stdlib_shell_escape.o \ stdlib_shell_escape.o \
stdlib_showerror.o \ stdlib_showerror.o \
stdlib_srand.o \ stdlib_srand.o \
@ -452,7 +447,6 @@ STRING_OBJ = \
string_strcpy.o \ string_strcpy.o \
string_strcspn.o \ string_strcspn.o \
string_strdup.o \ string_strdup.o \
string_strdup_debug.o \
string_strerror.o \ string_strerror.o \
string_strlcat.o \ string_strlcat.o \
string_strlcpy.o \ string_strlcpy.o \
@ -504,7 +498,6 @@ UNISTD_OBJ = \
unistd_fileno.o \ unistd_fileno.o \
unistd_ftruncate.o \ unistd_ftruncate.o \
unistd_getcwd.o \ unistd_getcwd.o \
unistd_getcwd_debug.o \
unistd_getopt.o \ unistd_getopt.o \
unistd_getpid.o \ unistd_getpid.o \
unistd_init_exit.o \ unistd_init_exit.o \
@ -564,6 +557,16 @@ USERGROUP_OBJ = \
UTIME_OBJ = \ UTIME_OBJ = \
utime_utime.o utime_utime.o
MEMDEBUG_OBJ = \
stdio_vasprintf_debug.o \
stdio_vasprintf_hook_debug.o \
stdlib_alloca_debug.o \
stdlib_calloc_debug.o \
stdlib_free_debug.o \
stdlib_malloc_debug.o \
string_strdup_debug.o \
unistd_getcwd_debug.o
############################################################################## ##############################################################################
all: setup c.lib startup.o cleanup all: setup c.lib startup.o cleanup

View File

@ -1,5 +1,5 @@
/* /*
* $Id: socket_init_exit.c,v 1.5 2004-11-14 11:06:27 obarthel Exp $ * $Id: socket_init_exit.c,v 1.6 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -127,7 +127,6 @@ CLIB_DESTRUCTOR(__socket_exit)
int int
__socket_init(void) __socket_init(void)
{ {
struct Process * this_process;
struct TagItem tags[5]; struct TagItem tags[5];
int result = ERROR; int result = ERROR;
LONG status; LONG status;
@ -201,15 +200,25 @@ __socket_init(void)
/* Check if this program was launched as a server by the Internet /* Check if this program was launched as a server by the Internet
* superserver. * superserver.
*/ */
this_process = (struct Process *)FindTask(NULL); if(Cli() != NULL && NOT __detach)
if(this_process->pr_CLI != ZERO && NOT __detach)
{ {
struct DaemonMessage * dm; struct DaemonMessage * dm;
/* The socket the superserver may have launched this program /* The socket the superserver may have launched this program
* with is attached to the exit data entry of the process. * with is attached to the exit data entry of the process.
*/ */
dm = (struct DaemonMessage *)this_process->pr_ExitData; #if defined(__amigaos4__)
{
dm = (struct DaemonMessage *)GetExitData();
}
#else
{
struct Process * this_process = (struct Process *)FindTask(NULL);
dm = (struct DaemonMessage *)this_process->pr_ExitData;
}
#endif /* __amigaos4__ */
if(TypeOfMem(dm) != 0 && TypeOfMem(((char *)dm) + sizeof(*dm)-1) != 0) if(TypeOfMem(dm) != 0 && TypeOfMem(((char *)dm) + sizeof(*dm)-1) != 0)
{ {
int daemon_socket; int daemon_socket;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdio_init_exit.c,v 1.2 2004-09-29 14:17:44 obarthel Exp $ * $Id: stdio_init_exit.c,v 1.3 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -194,9 +194,8 @@ __stdio_init(void)
} }
/* If the program was launched from Workbench, we continue by /* If the program was launched from Workbench, we continue by
* duplicating the default output stream for use as the duplicating the default output stream for use as the
* standard error stream. standard error stream. */
*/
if(__WBenchMsg != NULL) if(__WBenchMsg != NULL)
{ {
PROFILE_OFF(); PROFILE_OFF();
@ -207,14 +206,26 @@ __stdio_init(void)
} }
else else
{ {
struct Process * this_process = (struct Process *)FindTask(NULL); BPTR ces;
/* Figure out what the default error output stream is. */
#if defined(__amigaos4__)
{
ces = ErrorOutput();
}
#else
{
struct Process * this_process = (struct Process *)FindTask(NULL);
ces = this_process->pr_CES;
}
#endif /* __amigaos4__ */
/* Is the standard error stream configured? If so, use it. /* Is the standard error stream configured? If so, use it.
* Otherwise, try to duplicate the standard output stream. Otherwise, try to duplicate the standard output stream. */
*/ if(ces != ZERO)
if(this_process->pr_CES != ZERO)
{ {
__fd[STDERR_FILENO]->fd_DefaultFile = this_process->pr_CES; __fd[STDERR_FILENO]->fd_DefaultFile = ces;
SET_FLAG(__fd[STDERR_FILENO]->fd_Flags,FDF_NO_CLOSE); SET_FLAG(__fd[STDERR_FILENO]->fd_Flags,FDF_NO_CLOSE);
} }
@ -231,8 +242,7 @@ __stdio_init(void)
PROFILE_OFF(); PROFILE_OFF();
/* Check if the standard error output refers to a console or must /* Check if the standard error output refers to a console or must
* be considered unusable for console output. be considered unusable for console output. */
*/
if(__fd[STDERR_FILENO]->fd_DefaultFile == ZERO || if(__fd[STDERR_FILENO]->fd_DefaultFile == ZERO ||
((struct FileHandle *)BADDR(__fd[STDERR_FILENO]->fd_DefaultFile))->fh_Type == NULL || ((struct FileHandle *)BADDR(__fd[STDERR_FILENO]->fd_DefaultFile))->fh_Type == NULL ||
NOT IsInteractive(__fd[STDERR_FILENO]->fd_DefaultFile)) NOT IsInteractive(__fd[STDERR_FILENO]->fd_DefaultFile))

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdio_tmpnam.c,v 1.1.1.1 2004-07-26 16:31:42 obarthel Exp $ * $Id: stdio_tmpnam.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -35,6 +35,10 @@
#include "stdio_headers.h" #include "stdio_headers.h"
#endif /* _STDIO_HEADERS_H */ #endif /* _STDIO_HEADERS_H */
#ifndef _STDLIB_HEADERS_H
#include "stdlib_headers.h"
#endif /* _STDLIB_HEADERS_H */
/****************************************************************************/ /****************************************************************************/
char * char *
@ -42,7 +46,6 @@ tmpnam(char *buf)
{ {
static char local_buffer[L_tmpnam]; static char local_buffer[L_tmpnam];
static unsigned short counter; static unsigned short counter;
struct Process * this_process;
APTR old_window_pointer; APTR old_window_pointer;
unsigned short c; unsigned short c;
char * result = NULL; /* ZZZ compiler claims that this assignment is unnecessary. */ char * result = NULL; /* ZZZ compiler claims that this assignment is unnecessary. */
@ -58,10 +61,6 @@ tmpnam(char *buf)
if(buf == NULL) if(buf == NULL)
buf = local_buffer; buf = local_buffer;
this_process = (struct Process *)FindTask(NULL);
old_window_pointer = this_process->pr_WindowPtr;
while(TRUE) while(TRUE)
{ {
if(__check_abort_enabled) if(__check_abort_enabled)
@ -85,7 +84,7 @@ tmpnam(char *buf)
D(("checking if '%s' exists",buf)); D(("checking if '%s' exists",buf));
/* Turn off DOS error requesters. */ /* Turn off DOS error requesters. */
this_process->pr_WindowPtr = (APTR)-1; old_window_pointer = __set_process_window((APTR)-1);
/* Does this object exist already? */ /* Does this object exist already? */
PROFILE_OFF(); PROFILE_OFF();
@ -93,7 +92,7 @@ tmpnam(char *buf)
PROFILE_ON(); PROFILE_ON();
/* Restore DOS requesters. */ /* Restore DOS requesters. */
this_process->pr_WindowPtr = old_window_pointer; __set_process_window(old_window_pointer);
if(lock == ZERO) if(lock == ZERO)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdio_vasprintf.c,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdio_vasprintf.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -123,10 +123,6 @@ __vasprintf(const char *file,int line,char **ret,const char *format,va_list arg)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
int int
vasprintf(char **ret,const char *format,va_list arg) vasprintf(char **ret,const char *format,va_list arg)
{ {
@ -136,7 +132,3 @@ vasprintf(char **ret,const char *format,va_list arg)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_abort.c,v 1.1.1.1 2004-07-26 16:31:50 obarthel Exp $ * $Id: stdlib_abort.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -52,7 +52,7 @@ abort(void)
__check_abort_enabled = FALSE; __check_abort_enabled = FALSE;
__print_termination_message(__abnormal_program_termination); __print_termination_message(NULL);
/* Note that we drop into the exit() function which /* Note that we drop into the exit() function which
* does not trigger the exit trap. * does not trigger the exit trap.

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_alloca.c,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdlib_alloca.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -90,7 +90,7 @@ __alloca_cleanup(const char * file,int line)
/* The assumption is that the stack grows downwards. If this function is /* The assumption is that the stack grows downwards. If this function is
called, we must get rid off all the allocations associated with stack called, we must get rid off all the allocations associated with stack
pointers whose addresses are less than the current stack pointer. pointers whose addresses are smaller than the current stack pointer.
Which so happen to be stored near the end of the list. The further Which so happen to be stored near the end of the list. The further
we move up from the end to the top of the list, the closer we get we move up from the end to the top of the list, the closer we get
to the allocations made in the context of a stack frame near to to the allocations made in the context of a stack frame near to
@ -104,7 +104,7 @@ __alloca_cleanup(const char * file,int line)
Remove((struct Node *)mcn); Remove((struct Node *)mcn);
__force_free(mcn->mcn_Memory,file,line); __force_free(mcn->mcn_Memory,file,line);
__force_free(mcn,file,line); __free(mcn,file,line);
} }
} }
} }
@ -151,7 +151,7 @@ __alloca(size_t size,const char * file,int line)
{ {
SHOWMSG("not enough memory"); SHOWMSG("not enough memory");
__force_free(mcn,file,line); __free(mcn,file,line);
goto out; goto out;
} }
@ -170,10 +170,6 @@ __alloca(size_t size,const char * file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
void * void *
alloca(size_t size) alloca(size_t size)
{ {
@ -183,7 +179,3 @@ alloca(size_t size)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_assertion_failure.c,v 1.1.1.1 2004-07-26 16:31:50 obarthel Exp $ * $Id: stdlib_assertion_failure.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -64,8 +64,7 @@ __assertion_failure(
BOOL use_stderr = FALSE; BOOL use_stderr = FALSE;
/* Figure out if the assertion failure message can be printed /* Figure out if the assertion failure message can be printed
* on the stderr stream. on the stderr stream. */
*/
if(__iob != NULL && NOT __no_standard_io) if(__iob != NULL && NOT __no_standard_io)
{ {
struct iob * iob; struct iob * iob;
@ -121,7 +120,7 @@ __assertion_failure(
{ {
if(IntuitionBase != NULL) if(IntuitionBase != NULL)
{ {
IIntuition = (struct IntuitionIFace *)GetInterface((struct Library *)IntuitionBase, "main", 1, 0); IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, "main", 1, 0);
if(IIntuition == NULL) if(IIntuition == NULL)
{ {
CloseLibrary(IntuitionBase); CloseLibrary(IntuitionBase);
@ -134,7 +133,6 @@ __assertion_failure(
if(IntuitionBase != NULL) if(IntuitionBase != NULL)
{ {
struct EasyStruct es; struct EasyStruct es;
ULONG args[3];
memset(&es,0,sizeof(es)); memset(&es,0,sizeof(es));
@ -143,11 +141,7 @@ __assertion_failure(
es.es_TextFormat = (STRPTR)"Assertion of expression\n'%s'\nfailed in file '%s', line %ld"; es.es_TextFormat = (STRPTR)"Assertion of expression\n'%s'\nfailed in file '%s', line %ld";
es.es_GadgetFormat = (STRPTR)"Sorry"; es.es_GadgetFormat = (STRPTR)"Sorry";
args[0] = (ULONG)expression; EasyRequest(NULL,&es,NULL,expression,file_name,line_number);
args[1] = (ULONG)file_name;
args[2] = (ULONG)line_number;
EasyRequestArgs(NULL,&es,NULL,args);
#if defined(__amigaos4__) #if defined(__amigaos4__)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_calloc.c,v 1.2 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdlib_calloc.c,v 1.3 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -82,10 +82,6 @@ __calloc(size_t num_elements,size_t element_size,const char * file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
void * void *
calloc(size_t num_elements,size_t element_size) calloc(size_t num_elements,size_t element_size)
{ {
@ -95,7 +91,3 @@ calloc(size_t num_elements,size_t element_size)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_free.c,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdlib_free.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -505,10 +505,6 @@ __free(void * ptr,const char * file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
void void
free(void * ptr) free(void * ptr)
{ {
@ -517,10 +513,6 @@ free(void * ptr)
/****************************************************************************/ /****************************************************************************/
#endif /* __MEM_DEBUG */
/****************************************************************************/
void void
__memory_exit(void) __memory_exit(void)
{ {
@ -535,11 +527,7 @@ __memory_exit(void)
__program_name,__current_num_memory_chunks_allocated,__maximum_num_memory_chunks_allocated); __program_name,__current_num_memory_chunks_allocated,__maximum_num_memory_chunks_allocated);
__check_memory_allocations(__FILE__,__LINE__); __check_memory_allocations(__FILE__,__LINE__);
}
#endif /* __MEM_DEBUG */
#if defined(__MEM_DEBUG)
{
__never_free = FALSE; __never_free = FALSE;
if(__memory_list.mlh_Head != NULL) if(__memory_list.mlh_Head != NULL)
@ -551,15 +539,15 @@ __memory_exit(void)
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__); __free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
} }
} }
#if defined(__USE_MEM_TREES)
{
__initialize_red_black_tree(&__memory_tree);
}
#endif /* __USE_MEM_TREES */
} }
#endif /* __MEM_DEBUG */ #endif /* __MEM_DEBUG */
#if defined(__USE_MEM_TREES) && defined(__MEM_DEBUG)
{
__initialize_red_black_tree(&__memory_tree);
}
#endif /* __USE_MEM_TREES && __MEM_DEBUG */
if(__memory_pool != NULL) if(__memory_pool != NULL)
{ {
NewList((struct List *)&__memory_list); NewList((struct List *)&__memory_list);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_main.c,v 1.7 2004-11-14 11:43:30 obarthel Exp $ * $Id: stdlib_main.c,v 1.8 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -285,8 +285,9 @@ detach_cleanup(REG(d0, LONG UNUSED unused_return_code),REG(d1, BPTR segment_list
/****************************************************************************/ /****************************************************************************/
static ULONG static ULONG
get_stack_size(struct Task * tc) get_stack_size(void)
{ {
struct Task * tc = FindTask(NULL);
ULONG upper,lower; ULONG upper,lower;
ULONG result; ULONG result;
@ -307,9 +308,9 @@ _main(void)
struct Process * child_process = NULL; struct Process * child_process = NULL;
struct WBStartup * startup_message; struct WBStartup * startup_message;
struct Process * this_process; struct Process * this_process;
APTR old_window_pointer = NULL;
int return_code = RETURN_FAIL; int return_code = RETURN_FAIL;
ULONG current_stack_size; ULONG current_stack_size;
APTR old_window_pointer;
int os_version; int os_version;
SysBase = *(struct Library **)4; SysBase = *(struct Library **)4;
@ -337,11 +338,6 @@ _main(void)
startup_message = NULL; startup_message = NULL;
} }
old_window_pointer = this_process->pr_WindowPtr;
if(__disable_dos_requesters)
this_process->pr_WindowPtr = (APTR)-1;
__WBenchMsg = startup_message; __WBenchMsg = startup_message;
/* Check which minimum operating system version we actually require. */ /* Check which minimum operating system version we actually require. */
@ -381,6 +377,19 @@ _main(void)
} }
#endif /* __amigaos4__ */ #endif /* __amigaos4__ */
if(__disable_dos_requesters)
{
/* Don't display any requesters. */
old_window_pointer = __set_process_window((APTR)-1);
}
else
{
/* Just remember the original pointer. */
old_window_pointer = __set_process_window(NULL);
__set_process_window(old_window_pointer);
}
/* If a callback was provided which can fill us in on which /* If a callback was provided which can fill us in on which
minimum stack size should be used, invoke it now and minimum stack size should be used, invoke it now and
store its result in the global __stack_size variable. */ store its result in the global __stack_size variable. */
@ -394,7 +403,7 @@ _main(void)
} }
/* How much stack size was provided? */ /* How much stack size was provided? */
current_stack_size = get_stack_size(&this_process->pr_Task); current_stack_size = get_stack_size();
/* If this is a resident program, don't allow for the detach /* If this is a resident program, don't allow for the detach
code to run. Same goes for launching the program from code to run. Same goes for launching the program from
@ -550,7 +559,8 @@ _main(void)
out: out:
this_process->pr_WindowPtr = old_window_pointer; if(DOSBase != NULL)
__set_process_window(old_window_pointer);
if(child_process == NULL) if(child_process == NULL)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_malloc.c,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdlib_malloc.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -250,10 +250,6 @@ __malloc(size_t size,const char * file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
void * void *
malloc(size_t size) malloc(size_t size)
{ {
@ -264,11 +260,6 @@ malloc(size_t size)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */
/****************************************************************************/ /****************************************************************************/
void void

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_mktemp.c,v 1.3 2004-11-10 17:45:40 obarthel Exp $ * $Id: stdlib_mktemp.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -162,8 +162,6 @@ mktemp(char * name_template)
SHOWSTRING(name_template); SHOWSTRING(name_template);
old_window_pointer = this_process->pr_WindowPtr;
/* Now check if the name we picked is unique. If not, make another name. */ /* Now check if the name we picked is unique. If not, make another name. */
while(TRUE) while(TRUE)
{ {
@ -193,7 +191,7 @@ mktemp(char * name_template)
#endif /* UNIX_PATH_SEMANTICS */ #endif /* UNIX_PATH_SEMANTICS */
/* Turn off DOS error requesters. */ /* Turn off DOS error requesters. */
this_process->pr_WindowPtr = (APTR)-1; old_window_pointer = __set_process_window((APTR)-1);
/* Does this object exist already? */ /* Does this object exist already? */
PROFILE_OFF(); PROFILE_OFF();
@ -201,7 +199,7 @@ mktemp(char * name_template)
PROFILE_ON(); PROFILE_ON();
/* Restore DOS requesters. */ /* Restore DOS requesters. */
this_process->pr_WindowPtr = old_window_pointer; __set_process_window(old_window_pointer);
if(lock == ZERO) if(lock == ZERO)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_protos.h,v 1.4 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdlib_protos.h,v 1.5 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -185,6 +185,9 @@ extern void __stkovf(void);
/* stdlib_termination_message.c */ /* stdlib_termination_message.c */
extern void __print_termination_message(const char * termination_message); extern void __print_termination_message(const char * termination_message);
/* stdlib_set_process_window.c */
APTR __set_process_window(APTR new_window_pointer);
/****************************************************************************/ /****************************************************************************/
#endif /* _STDLIB_PROTOS_H */ #endif /* _STDLIB_PROTOS_H */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_realloc.c,v 1.2 2004-12-24 18:31:38 obarthel Exp $ * $Id: stdlib_realloc.c,v 1.3 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -199,10 +199,6 @@ __realloc(void *ptr,size_t size,const char * file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
void * void *
realloc(void *ptr,size_t size) realloc(void *ptr,size_t size)
{ {
@ -212,7 +208,3 @@ realloc(void *ptr,size_t size)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */

View File

@ -0,0 +1,60 @@
/*
* $Id: stdlib_set_process_window.c,v 1.1 2004-12-26 10:28:56 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STDLIB_HEADERS_H
#include "stdlib_headers.h"
#endif /* _STDLIB_HEADERS_H */
/****************************************************************************/
APTR
__set_process_window(APTR new_window_pointer)
{
APTR result;
#if defined(__amigaos4__)
{
result = SetProcWindow(new_window_pointer);
}
#else
{
struct Process * this_process = (struct Process *)FindTask(NULL);
result = this_process->pr_WindowPtr;
this_process->pr_WindowPtr = new_window_pointer;
}
#endif /* __amigaos4__ */
return(result);
}

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_showerror.c,v 1.3 2004-12-24 10:52:02 obarthel Exp $ * $Id: stdlib_showerror.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -89,11 +89,11 @@ __show_error(const char * message)
#if defined(__amigaos4__) #if defined(__amigaos4__)
{ {
IDOS = (struct DOSIFace *)GetInterface((struct Library *)DOSBase, "main", 1, 0); IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0);
if (IDOS == NULL) if (IDOS == NULL)
goto out; goto out;
IIntuition = (struct IntuitionIFace *)GetInterface((struct Library *)IntuitionBase, "main", 1, 0); IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, "main", 1, 0);
if (IIntuition == NULL) if (IIntuition == NULL)
goto out; goto out;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stdlib_termination_message.c,v 1.1.1.1 2004-07-26 16:32:12 obarthel Exp $ * $Id: stdlib_termination_message.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -45,18 +45,20 @@
/****************************************************************************/ /****************************************************************************/
const char __abnormal_program_termination[] = "Abnormal program termination\n";
/****************************************************************************/
void void
__print_termination_message(const char * termination_message) __print_termination_message(const char * termination_message)
{ {
if(NOT __termination_message_printed) static BOOL termination_message_printed = FALSE;
if(NOT termination_message_printed)
{ {
__termination_message_printed = TRUE; termination_message_printed = TRUE;
if(NOT __termination_message_disabled && NOT __no_standard_io) if(NOT __termination_message_disabled && NOT __no_standard_io)
fputs(termination_message,stderr); {
fputs((termination_message != NULL) ? termination_message : "Abnormal program termination",stderr);
fputc('\n',stderr);
}
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: string_strdup.c,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: string_strdup.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -90,10 +90,6 @@ __strdup(const char *s,const char * file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
char * char *
strdup(const char *s) strdup(const char *s)
{ {
@ -103,7 +99,3 @@ strdup(const char *s)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */

View File

@ -1,5 +1,5 @@
/* /*
* $Id: time_asctime_r.c,v 1.1 2004-11-18 09:40:37 obarthel Exp $ * $Id: time_asctime_r.c,v 1.2 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -44,10 +44,9 @@
/****************************************************************************/ /****************************************************************************/
static void static void
add_to_string(char * to,int to_size,const char * string,int * offset_ptr) add_to_string(char * to,size_t to_size,const char * string,size_t * offset_ptr)
{ {
int offset; size_t offset, len;
int len;
assert( to != NULL && to_size > 0 && string != NULL && offset_ptr != NULL ); assert( to != NULL && to_size > 0 && string != NULL && offset_ptr != NULL );
@ -81,7 +80,7 @@ __asctime_r(const struct tm *tm,char * buffer,size_t buffer_size)
char number[16]; char number[16];
char * result = NULL; char * result = NULL;
const char * b; const char * b;
int offset = 0; size_t offset = 0;
ENTER(); ENTER();

View File

@ -1,5 +1,5 @@
/* /*
* $Id: unistd_getcwd.c,v 1.3 2004-12-24 18:31:38 obarthel Exp $ * $Id: unistd_getcwd.c,v 1.4 2004-12-26 10:28:56 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@ -215,10 +215,6 @@ __getcwd(char * buffer,size_t buffer_size,const char *file,int line)
/****************************************************************************/ /****************************************************************************/
#if NOT defined(__MEM_DEBUG)
/****************************************************************************/
char * char *
getcwd(char * buffer, size_t buffer_size) getcwd(char * buffer, size_t buffer_size)
{ {
@ -228,7 +224,3 @@ getcwd(char * buffer, size_t buffer_size)
return(result); return(result);
} }
/****************************************************************************/
#endif /* __MEM_DEBUG */