Mercurial > vim
comparison src/os_unix.c @ 7408:1886f2863437 v7.4.1008
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 31 19:07:19 2015 +0100
patch 7.4.1008
Problem: The OS/2 code pollutes the source while nobody uses it these days.
Solution: Drop the support for OS/2.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 31 Dec 2015 19:15:05 +0100 |
parents | c97735aaef9f |
children | 37092e334ef2 |
comparison
equal
deleted
inserted
replaced
7407:829dfc144dd4 | 7408:1886f2863437 |
---|---|
469 * it. | 469 * it. |
470 */ | 470 */ |
471 len = read_from_input_buf(buf, (long)maxlen); | 471 len = read_from_input_buf(buf, (long)maxlen); |
472 if (len > 0) | 472 if (len > 0) |
473 { | 473 { |
474 #ifdef OS2 | |
475 int i; | |
476 | |
477 for (i = 0; i < len; i++) | |
478 if (buf[i] == 0) | |
479 buf[i] = K_NUL; | |
480 #endif | |
481 return len; | 474 return len; |
482 } | 475 } |
483 } | 476 } |
484 } | 477 } |
485 | 478 |
1473 int | 1466 int |
1474 mch_check_win(argc, argv) | 1467 mch_check_win(argc, argv) |
1475 int argc UNUSED; | 1468 int argc UNUSED; |
1476 char **argv UNUSED; | 1469 char **argv UNUSED; |
1477 { | 1470 { |
1478 #ifdef OS2 | |
1479 /* | |
1480 * Store argv[0], may be used for $VIM. Only use it if it is an absolute | |
1481 * name, mostly it's just "vim" and found in the path, which is unusable. | |
1482 */ | |
1483 if (mch_isFullName(argv[0])) | |
1484 exe_name = vim_strsave((char_u *)argv[0]); | |
1485 #endif | |
1486 if (isatty(1)) | 1471 if (isatty(1)) |
1487 return OK; | 1472 return OK; |
1488 return FAIL; | 1473 return FAIL; |
1489 } | 1474 } |
1490 | 1475 |
2444 #else | 2429 #else |
2445 return (getwd((char *)buf) != NULL ? OK : FAIL); | 2430 return (getwd((char *)buf) != NULL ? OK : FAIL); |
2446 #endif | 2431 #endif |
2447 } | 2432 } |
2448 | 2433 |
2449 #if defined(OS2) || defined(PROTO) | |
2450 /* | |
2451 * Replace all slashes by backslashes. | |
2452 * When 'shellslash' set do it the other way around. | |
2453 */ | |
2454 void | |
2455 slash_adjust(p) | |
2456 char_u *p; | |
2457 { | |
2458 while (*p) | |
2459 { | |
2460 if (*p == psepcN) | |
2461 *p = psepc; | |
2462 mb_ptr_adv(p); | |
2463 } | |
2464 } | |
2465 #endif | |
2466 | |
2467 /* | 2434 /* |
2468 * Get absolute file name into "buf[len]". | 2435 * Get absolute file name into "buf[len]". |
2469 * | 2436 * |
2470 * return FAIL for failure, OK for success | 2437 * return FAIL for failure, OK for success |
2471 */ | 2438 */ |
2474 char_u *fname, *buf; | 2441 char_u *fname, *buf; |
2475 int len; | 2442 int len; |
2476 int force; /* also expand when already absolute path */ | 2443 int force; /* also expand when already absolute path */ |
2477 { | 2444 { |
2478 int l; | 2445 int l; |
2479 #ifdef OS2 | |
2480 int only_drive; /* file name is only a drive letter */ | |
2481 #endif | |
2482 #ifdef HAVE_FCHDIR | 2446 #ifdef HAVE_FCHDIR |
2483 int fd = -1; | 2447 int fd = -1; |
2484 static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */ | 2448 static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */ |
2485 #endif | 2449 #endif |
2486 char_u olddir[MAXPATHL]; | 2450 char_u olddir[MAXPATHL]; |
2515 /* | 2479 /* |
2516 * If the file name has a path, change to that directory for a moment, | 2480 * If the file name has a path, change to that directory for a moment, |
2517 * and then do the getwd() (and get back to where we were). | 2481 * and then do the getwd() (and get back to where we were). |
2518 * This will get the correct path name with "../" things. | 2482 * This will get the correct path name with "../" things. |
2519 */ | 2483 */ |
2520 #ifdef OS2 | |
2521 only_drive = 0; | |
2522 if (p != NULL | |
2523 || ((p = vim_strrchr(fname, '\\')) != NULL) | |
2524 || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive)) | |
2525 #else | |
2526 if (p != NULL) | 2484 if (p != NULL) |
2527 #endif | |
2528 { | 2485 { |
2529 #ifdef HAVE_FCHDIR | 2486 #ifdef HAVE_FCHDIR |
2530 /* | 2487 /* |
2531 * Use fchdir() if possible, it's said to be faster and more | 2488 * Use fchdir() if possible, it's said to be faster and more |
2532 * reliable. But on SunOS 4 it might not work. Check this by | 2489 * reliable. But on SunOS 4 it might not work. Check this by |
2556 p = NULL; /* can't get current dir: don't chdir */ | 2513 p = NULL; /* can't get current dir: don't chdir */ |
2557 retval = FAIL; | 2514 retval = FAIL; |
2558 } | 2515 } |
2559 else | 2516 else |
2560 { | 2517 { |
2561 #ifdef OS2 | |
2562 /* | |
2563 * compensate for case where ':' from "D:" was the only | |
2564 * path separator detected in the file name; the _next_ | |
2565 * character has to be removed, and then restored later. | |
2566 */ | |
2567 if (only_drive) | |
2568 p++; | |
2569 #endif | |
2570 /* The directory is copied into buf[], to be able to remove | 2518 /* The directory is copied into buf[], to be able to remove |
2571 * the file name without changing it (could be a string in | 2519 * the file name without changing it (could be a string in |
2572 * read-only memory) */ | 2520 * read-only memory) */ |
2573 if (p - fname >= len) | 2521 if (p - fname >= len) |
2574 retval = FAIL; | 2522 retval = FAIL; |
2579 retval = FAIL; | 2527 retval = FAIL; |
2580 else | 2528 else |
2581 fname = p + 1; | 2529 fname = p + 1; |
2582 *buf = NUL; | 2530 *buf = NUL; |
2583 } | 2531 } |
2584 #ifdef OS2 | |
2585 if (only_drive) | |
2586 { | |
2587 p--; | |
2588 if (retval != FAIL) | |
2589 fname--; | |
2590 } | |
2591 #endif | |
2592 } | 2532 } |
2593 } | 2533 } |
2594 if (mch_dirname(buf, len) == FAIL) | 2534 if (mch_dirname(buf, len) == FAIL) |
2595 { | 2535 { |
2596 retval = FAIL; | 2536 retval = FAIL; |
3203 | 3143 |
3204 if (stat((char *)name, &st)) | 3144 if (stat((char *)name, &st)) |
3205 return NODE_NORMAL; | 3145 return NODE_NORMAL; |
3206 if (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode)) | 3146 if (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode)) |
3207 return NODE_NORMAL; | 3147 return NODE_NORMAL; |
3208 #ifndef OS2 | |
3209 if (S_ISBLK(st.st_mode)) /* block device isn't writable */ | 3148 if (S_ISBLK(st.st_mode)) /* block device isn't writable */ |
3210 return NODE_OTHER; | 3149 return NODE_OTHER; |
3211 #endif | |
3212 /* Everything else is writable? */ | 3150 /* Everything else is writable? */ |
3213 return NODE_WRITABLE; | 3151 return NODE_WRITABLE; |
3214 } | 3152 } |
3215 | 3153 |
3216 void | 3154 void |
6319 mch_has_exp_wildcard(p) | 6257 mch_has_exp_wildcard(p) |
6320 char_u *p; | 6258 char_u *p; |
6321 { | 6259 { |
6322 for ( ; *p; mb_ptr_adv(p)) | 6260 for ( ; *p; mb_ptr_adv(p)) |
6323 { | 6261 { |
6324 #ifndef OS2 | |
6325 if (*p == '\\' && p[1] != NUL) | 6262 if (*p == '\\' && p[1] != NUL) |
6326 ++p; | 6263 ++p; |
6327 else | 6264 else |
6328 #endif | |
6329 if (vim_strchr((char_u *) | 6265 if (vim_strchr((char_u *) |
6330 #ifdef VMS | 6266 #ifdef VMS |
6331 "*?%" | 6267 "*?%" |
6332 #else | 6268 #else |
6333 # ifdef OS2 | |
6334 "*?" | |
6335 # else | |
6336 "*?[{'" | 6269 "*?[{'" |
6337 # endif | |
6338 #endif | 6270 #endif |
6339 , *p) != NULL) | 6271 , *p) != NULL) |
6340 return TRUE; | 6272 return TRUE; |
6341 } | 6273 } |
6342 return FALSE; | 6274 return FALSE; |
6350 mch_has_wildcard(p) | 6282 mch_has_wildcard(p) |
6351 char_u *p; | 6283 char_u *p; |
6352 { | 6284 { |
6353 for ( ; *p; mb_ptr_adv(p)) | 6285 for ( ; *p; mb_ptr_adv(p)) |
6354 { | 6286 { |
6355 #ifndef OS2 | |
6356 if (*p == '\\' && p[1] != NUL) | 6287 if (*p == '\\' && p[1] != NUL) |
6357 ++p; | 6288 ++p; |
6358 else | 6289 else |
6359 #endif | |
6360 if (vim_strchr((char_u *) | 6290 if (vim_strchr((char_u *) |
6361 #ifdef VMS | 6291 #ifdef VMS |
6362 "*?%$" | 6292 "*?%$" |
6363 #else | 6293 #else |
6364 # ifdef OS2 | |
6365 # ifdef VIM_BACKTICK | |
6366 "*?$`" | |
6367 # else | |
6368 "*?$" | |
6369 # endif | |
6370 # else | |
6371 "*?[{`'$" | 6294 "*?[{`'$" |
6372 # endif | |
6373 #endif | 6295 #endif |
6374 , *p) != NULL | 6296 , *p) != NULL |
6375 || (*p == '~' && p[1] != NUL)) | 6297 || (*p == '~' && p[1] != NUL)) |
6376 return TRUE; | 6298 return TRUE; |
6377 } | 6299 } |