forked from aniani/vim
		
	patch 8.2.4340: Amiga: mch_can_exe() is not implemented
Problem: Amiga: mch_can_exe() is not implemented. Solution: Implement mch_can_exe() for Amiga OS 4. (Ola Söder, closes #9731)
This commit is contained in:
		
				
					committed by
					
						 Bram Moolenaar
						Bram Moolenaar
					
				
			
			
				
	
			
			
			
						parent
						
							560dff49c0
						
					
				
				
					commit
					949b35d83b
				
			| @@ -891,8 +891,48 @@ mch_mkdir(char_u *name) | |||||||
|     int |     int | ||||||
| mch_can_exe(char_u *name, char_u **path, int use_path) | mch_can_exe(char_u *name, char_u **path, int use_path) | ||||||
| { | { | ||||||
|     // TODO |     int exe = -1; | ||||||
|     return -1; | #ifdef __amigaos4__ | ||||||
|  |     // Load file sections using elf.library or hunk.library. | ||||||
|  |     BPTR seg = LoadSeg(name); | ||||||
|  |  | ||||||
|  |     if (seg && GetSegListInfoTags(seg, GSLI_Native, NULL, TAG_DONE) != | ||||||
|  |         GetSegListInfoTags(seg, GSLI_68KHUNK, NULL, TAG_DONE)) | ||||||
|  |     { | ||||||
|  |         // Test if file permissions allow execution. | ||||||
|  |         struct ExamineData *exd = ExamineObjectTags(EX_StringNameInput, name); | ||||||
|  |  | ||||||
|  |         exe = (exd && !(exd->Protection & EXDF_NO_EXECUTE)) ? 1 : 0; | ||||||
|  |         FreeDosObject(DOS_EXAMINEDATA, exd); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         exe = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     UnLoadSeg(seg); | ||||||
|  |  | ||||||
|  |     // Search for executable in path if applicable. | ||||||
|  |     if (!exe && use_path) | ||||||
|  |     { | ||||||
|  |         // Save current working dir. | ||||||
|  |         BPTR cwd = GetCurrentDir(); | ||||||
|  |         struct PathNode *head = DupCmdPathList(NULL); | ||||||
|  |  | ||||||
|  |         // For each entry, recur to check for executable. | ||||||
|  |         for(struct PathNode *tail = head; !exe && tail; | ||||||
|  |             tail = (struct PathNode *) BADDR(tail->pn_Next)) | ||||||
|  |         { | ||||||
|  |             SetCurrentDir(tail->pn_Lock); | ||||||
|  |             exe = mch_can_exe(name, path, 0); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // Go back to where we were. | ||||||
|  |         FreeCmdPathList(head); | ||||||
|  |         SetCurrentDir(cwd); | ||||||
|  |     } | ||||||
|  | #endif | ||||||
|  |     return exe; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
| @@ -746,6 +746,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     4340, | ||||||
| /**/ | /**/ | ||||||
|     4339, |     4339, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user