Index:bash-2.05b-appdirs/builtins/set.def *** bash-2.05b/builtins/set.def Wed Jul 10 21:17:20 2002 --- bash-2.05b-appdirs/builtins/set.def Fri Dec 20 07:22:18 2002 *************** *** 72,77 **** --- 72,80 ---- -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 *************** *** 165,170 **** --- 168,176 ---- setopt_get_func_t *get_func; } o_options[] = { { "allexport", 'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, + #if defined (APP_DIRS) + { "appdirs",'A', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, + #endif #if defined (BRACE_EXPANSION) { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, #endif Index:bash-2.05b-appdirs/config-top.h *** bash-2.05b/config-top.h Tue Apr 16 22:01:17 2002 --- bash-2.05b-appdirs/config-top.h Fri Dec 20 07:07:03 2002 *************** *** 82,87 **** --- 82,95 ---- 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.05b-appdirs/findcmd.c *** bash-2.05b/findcmd.c Tue Mar 19 15:19:05 2002 --- bash-2.05b-appdirs/findcmd.c Fri Dec 20 07:07:03 2002 *************** *** 477,482 **** --- 477,512 ---- 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.05b-appdirs/flags.c *** bash-2.05b/flags.c Mon Apr 8 18:28:47 2002 --- bash-2.05b-appdirs/flags.c Fri Dec 20 07:07:03 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} }; diff -cr bash-2.05b/flags.h bash-2.05b-appdirs/flags.h *** bash-2.05b/flags.h Mon Apr 8 18:28:51 2002 --- bash-2.05b-appdirs/flags.h Fri Dec 20 07:07:03 2002 *************** *** 65,70 **** --- 65,74 ---- 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));