From 9f3d5e50b47ceeb71786288ade62f5a99e95cb12 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Sun, 24 Apr 2005 14:04:36 +0000 Subject: [PATCH] - Fixed two linker errors which were caused by duplicate symbol definitions. - Added code to the startup routine which allows you to monitor where command was started from and which parameters it was invoked with. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14925 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/GNUmakefile.68k | 4 +++- library/stat_umask.c | 10 ++++---- library/stdlib_getdefstacksize.c | 12 +++++++++- library/stdlib_main.c | 39 +++++++++++++++++++++++++++++--- library/stdlib_stack_usage.c | 6 +---- 5 files changed, 56 insertions(+), 15 deletions(-) diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k index a89accf..6d351cf 100644 --- a/library/GNUmakefile.68k +++ b/library/GNUmakefile.68k @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.68k,v 1.48 2005-04-03 10:22:47 obarthel Exp $ +# $Id: GNUmakefile.68k,v 1.49 2005-04-24 14:04:36 obarthel Exp $ # # :ts=8 # @@ -929,6 +929,8 @@ $(LIBAMIGA_OBJS)/amiga.lib_rev.o : amiga.lib_rev.c amiga.lib_rev.h $(LIBC_OBJS)/stdlib_stacksize.o : stdlib_stacksize.c stdlib_gcc_help.h +$(LIBC_OBJS)/stdlib_getdefstacksize.o : stdlib_getdefstacksize.c stdlib_gcc_help.h + $(LIBC_OBJS)/stdlib_shell_escape.o : stdlib_shell_escape.c stdlib_gcc_help.h $(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h diff --git a/library/stat_umask.c b/library/stat_umask.c index e24160c..045e462 100644 --- a/library/stat_umask.c +++ b/library/stat_umask.c @@ -1,5 +1,5 @@ /* - * $Id: stat_umask.c,v 1.4 2005-03-09 10:48:59 obarthel Exp $ + * $Id: stat_umask.c,v 1.5 2005-04-24 14:04:36 obarthel Exp $ * * :ts=4 * @@ -41,6 +41,10 @@ /****************************************************************************/ +mode_t __current_umask = S_IWGRP | S_IWOTH; + +/****************************************************************************/ + #if defined(USERGROUP_SUPPORT) /****************************************************************************/ @@ -51,10 +55,6 @@ /****************************************************************************/ -mode_t __current_umask = S_IWGRP | S_IWOTH; - -/****************************************************************************/ - mode_t umask(mode_t new_mask) { diff --git a/library/stdlib_getdefstacksize.c b/library/stdlib_getdefstacksize.c index f309861..aac9e74 100644 --- a/library/stdlib_getdefstacksize.c +++ b/library/stdlib_getdefstacksize.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_getdefstacksize.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ + * $Id: stdlib_getdefstacksize.c,v 1.3 2005-04-24 14:04:36 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,14 @@ /****************************************************************************/ +#ifndef _STDLIB_GCC_HELP_H +#include "stdlib_gcc_help.h" +#endif /* _STDLIB_GCC_HELP_H */ + +/****************************************************************************/ + +#ifndef GCC_HELP_SUPPORT + unsigned int (* __get_default_stack_size)(void); + +#endif /* GCC_HELP_SUPPORT */ diff --git a/library/stdlib_main.c b/library/stdlib_main.c index 9a34dbb..70a1f76 100644 --- a/library/stdlib_main.c +++ b/library/stdlib_main.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_main.c,v 1.23 2005-04-04 11:56:22 obarthel Exp $ + * $Id: stdlib_main.c,v 1.24 2005-04-24 14:04:36 obarthel Exp $ * * :ts=4 * @@ -90,6 +90,39 @@ call_main(void) call chains, switch it on now. */ __show_profile_names(); + /* This can be helpful for debugging purposes: print the name of the current + directory, followed by the name of the command and all the parameters + passed to it. */ + #ifndef NDEBUG + { + UBYTE value_str[10]; + LONG value; + + /* Careful: only echo this information if a global environment + variable is set to enable this feature! */ + if(GetVar("_echo",value_str,sizeof(value_str),GVF_GLOBAL_ONLY) > 0 && StrToLong(value_str,&value) > 0 && value != 0) + { + struct Process * this_process = (struct Process *)FindTask(NULL); + UBYTE * arg_str = GetArgStr(); + size_t arg_str_len = strlen(arg_str); + UBYTE * arg_str_copy = AllocVec(arg_str_len+1,MEMF_ANY); + UBYTE current_dir_name[256]; + + if(arg_str_copy != NULL && NameFromLock(this_process->pr_CurrentDir,current_dir_name,sizeof(current_dir_name))) + { + strcpy(arg_str_copy,arg_str); + + while(arg_str_len > 0 && arg_str_copy[arg_str_len-1] <= ' ') + arg_str_copy[--arg_str_len] = '\0'; + + kprintf("[%s] %s %s\n",current_dir_name,__program_name,arg_str_copy); + } + + FreeVec(arg_str_copy); + } + } + #endif /* NDEBUG */ + /* After all these preparations, get this show on the road... */ exit(main((int)__argc,(char **)__argv)); @@ -268,8 +301,8 @@ get_stack_size(void) int _main(void) { - volatile struct Process * child_process = NULL; - volatile struct WBStartup * startup_message; + struct Process * volatile child_process = NULL; + struct WBStartup * volatile startup_message; volatile APTR old_window_pointer = NULL; volatile BOOL old_window_pointer_valid = FALSE; struct Process * this_process; diff --git a/library/stdlib_stack_usage.c b/library/stdlib_stack_usage.c index c2ff250..472e517 100644 --- a/library/stdlib_stack_usage.c +++ b/library/stdlib_stack_usage.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_stack_usage.c,v 1.5 2005-03-18 12:38:25 obarthel Exp $ + * $Id: stdlib_stack_usage.c,v 1.6 2005-04-24 14:04:36 obarthel Exp $ * * :ts=4 * @@ -43,13 +43,9 @@ static struct StackSwapStruct stack_swap_struct; /****************************************************************************/ -#if defined(__SASC) - ULONG __stk_extensions; /* number of stack extensions performed */ ULONG __stk_maxsize; /* maximum amount of memory allocated for stack extension */ -#endif /* __SASC */ - /****************************************************************************/ #define STACK_FILL_COOKIE 0xA1