comparison src/os_unix.c @ 5704:47a673b20e49 v7.4.197

updated for version 7.4.197 Problem: Various problems on VMS. Solution: Fix several VMS problems. (Zoltan Arpadffy)
author Bram Moolenaar <bram@vim.org>
date Wed, 12 Mar 2014 16:51:55 +0100
parents 2f99966971b0
children 5ab2946f7ce5
comparison
equal deleted inserted replaced
5703:69b2ec0c96cc 5704:47a673b20e49
2963 { 2963 {
2964 struct stat st; 2964 struct stat st;
2965 2965
2966 if (stat((char *)name, &st)) 2966 if (stat((char *)name, &st))
2967 return 0; 2967 return 0;
2968 #ifdef VMS
2969 /* Like on Unix system file can have executable rights but not necessarily
2970 * be an executable, but on Unix is not a default for an ordianry file to
2971 * have an executable flag - on VMS it is in most cases.
2972 * Therefore, this check does not have any sense - let keep us to the
2973 * conventions instead:
2974 * *.COM and *.EXE files are the executables - the rest are not. This is
2975 * not ideal but better then it was.
2976 */
2977 int vms_executable = 0;
2978 if (S_ISREG(st.st_mode) && mch_access((char *)name, X_OK) == 0)
2979 {
2980 if (strstr(vms_tolower((char*)name),".exe") != NULL
2981 || strstr(vms_tolower((char*)name),".com")!= NULL)
2982 vms_executable = 1;
2983 }
2984 return vms_executable;
2985 #else
2968 return S_ISREG(st.st_mode) && mch_access((char *)name, X_OK) == 0; 2986 return S_ISREG(st.st_mode) && mch_access((char *)name, X_OK) == 0;
2987 #endif
2969 } 2988 }
2970 2989
2971 /* 2990 /*
2972 * Return 1 if "name" can be found in $PATH and executed, 0 if not. 2991 * Return 1 if "name" can be found in $PATH and executed, 0 if not.
2973 * Return -1 if unknown. 2992 * Return -1 if unknown.
2981 int retval; 3000 int retval;
2982 3001
2983 /* If it's an absolute or relative path don't need to use $PATH. */ 3002 /* If it's an absolute or relative path don't need to use $PATH. */
2984 if (mch_isFullName(name) || (name[0] == '.' && (name[1] == '/' 3003 if (mch_isFullName(name) || (name[0] == '.' && (name[1] == '/'
2985 || (name[1] == '.' && name[2] == '/')))) 3004 || (name[1] == '.' && name[2] == '/'))))
3005 {
2986 return executable_file(name); 3006 return executable_file(name);
3007 }
2987 3008
2988 p = (char_u *)getenv("PATH"); 3009 p = (char_u *)getenv("PATH");
2989 if (p == NULL || *p == NUL) 3010 if (p == NULL || *p == NUL)
2990 return -1; 3011 return -1;
2991 buf = alloc((unsigned)(STRLEN(name) + STRLEN(p) + 2)); 3012 buf = alloc((unsigned)(STRLEN(name) + STRLEN(p) + 2));