Index:bash-2.05a-appdirs/builtins/set.def *** bash-2.05a/builtins/set.def Mon Oct 29 18:33:31 2001 --- bash-2.05a-appdirs/builtins/set.def Wed Dec 18 10:30:35 2002 *************** *** 74,79 **** --- 74,82 ---- -o option-name Set the variable corresponding to option-name: allexport same as -a + #if defined (APP_DIRS) + appdirs same as -A + #endif /* APP_DIRS */ braceexpand same as -B #if defined (READLINE) emacs use an emacs-style line editing interface *************** *** 160,165 **** --- 163,171 ---- int letter; } o_options[] = { { "allexport", 'a' }, + #if defined (APP_DIRS) + { "appdirs", 'A' }, + #endif #if defined (BRACE_EXPANSION) { "braceexpand",'B' }, #endif Index:bash-2.05a-appdirs/config-top.h *** bash-2.05a/config-top.h Wed Oct 24 18:28:49 2001 --- bash-2.05a-appdirs/config-top.h Wed Dec 18 10:28:35 2002 *************** *** 58,63 **** --- 58,71 ---- run the startup files when not in posix mode. */ /* #define NON_INTERACTIVE_LOGIN_SHELLS */ + /* Define this to support application directories. Set APPRUN + the name of the file inside the directory to execute as the directory + */ + #define APP_DIRS 1 + #ifdef APP_DIRS + #define APPRUN "AppRun" + #endif + /* Define this if you want bash to try to check whether it's being run by sshd and source the .bashrc if so (like the rshd behavior). */ /* #define SSH_SOURCE_BASHRC */ Index:bash-2.05a-appdirs/findcmd.c *** bash-2.05a/findcmd.c Thu Sep 13 20:51:06 2001 --- bash-2.05a-appdirs/findcmd.c Wed Dec 18 10:28:35 2002 *************** *** 480,485 **** --- 480,515 ---- return (full_path); } + #ifdef APP_DIRS + /* If it is a directory, does it contain an executable AppRun ? */ + if((flags & (FS_EXECABLE | FS_EXEC_PREFERRED | FS_EXEC_ONLY)) && + application_directories && (status & FS_DIRECTORY)) { + char *appdir; + + appdir=malloc(strlen(full_path)+1+strlen(APPRUN)+1); + if(appdir) { + int st2; + + strcpy(appdir, full_path); + strcat(appdir, "/" APPRUN); + + st2=file_status(appdir); + /*printf("%s %d %d\n", appdir, st2, (st2 & FS_EXISTS));*/ + + if((st2 & FS_EXISTS) && (st2 & FS_EXECABLE) && !(st2 & FS_DIRECTORY)) { + FREE(file_to_lose_on); + file_to_lose_on = (char *)NULL; + free(full_path); + full_path=appdir; + + return full_path; + } else { + free(appdir); + } + } + } + #endif + /* The file is not executable, but it does exist. If we prefer an executable, then remember this one if it is the first one we have found. */ Index:bash-2.05a-appdirs/flags.c *** bash-2.05a/flags.c Mon Sep 24 13:16:35 2001 --- bash-2.05a-appdirs/flags.c Wed Dec 18 10:28:35 2002 *************** *** 151,156 **** --- 151,160 ---- int brace_expansion = 1; #endif + #if defined(APP_DIRS) + int application_directories = 0; + #endif /* APP_DIRS */ + /* **************************************************************** */ /* */ /* The Flags ALIST. */ *************** *** 197,202 **** --- 201,210 ---- #if defined (BANG_HISTORY) { 'H', &history_expansion }, #endif /* BANG_HISTORY */ + + #if defined(APP_DIRS) + { 'A', &application_directories }, + #endif /* APP_DIRS */ {0, (int *)NULL} }; Index:bash-2.05a-appdirs/flags.h *** bash-2.05a/flags.h Thu Aug 5 12:06:26 1999 --- bash-2.05a-appdirs/flags.h Wed Dec 18 10:28:35 2002 *************** *** 64,69 **** --- 64,73 ---- extern int restricted_shell; #endif /* RESTRICTED_SHELL */ + #if defined(APP_DIRS) + extern int application_directories; + #endif /* APP_DIRS */ + extern int *find_flag __P((int)); extern int change_flag __P((int, int)); extern char *which_set_flags __P((void));