Mercurial > vim
comparison src/os_vms.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 |
---|---|
294 0, 0, 0, &status, 0, 0, 0, 0, 0, 0); | 294 0, 0, 0, &status, 0, 0, 0, 0, 0, 0); |
295 return status; | 295 return status; |
296 } | 296 } |
297 | 297 |
298 /* | 298 /* |
299 * Convert string to lowercase - most often filename | |
300 */ | |
301 char * | |
302 vms_tolower( char *name ) | |
303 { | |
304 int i,nlen = strlen(name); | |
305 for (i = 0; i < nlen; i++) | |
306 name[i] = TOLOWER_ASC(name[i]); | |
307 return name; | |
308 } | |
309 | |
310 /* | |
299 * Convert VMS system() or lib$spawn() return code to Unix-like exit value. | 311 * Convert VMS system() or lib$spawn() return code to Unix-like exit value. |
300 */ | 312 */ |
301 int | 313 int |
302 vms_sys_status(int status) | 314 vms_sys_status(int status) |
303 { | 315 { |
359 */ | 371 */ |
360 static int | 372 static int |
361 vms_wproc(char *name, int val) | 373 vms_wproc(char *name, int val) |
362 { | 374 { |
363 int i; | 375 int i; |
364 int nlen; | |
365 static int vms_match_alloced = 0; | 376 static int vms_match_alloced = 0; |
366 | 377 |
367 if (val != DECC$K_FILE) /* Directories and foreign non VMS files are not | 378 if (val == DECC$K_FOREIGN ) /* foreign non VMS files are not counting */ |
368 counting */ | |
369 return 1; | 379 return 1; |
370 | 380 |
381 /* accept all DECC$K_FILE and DECC$K_DIRECTORY */ | |
371 if (vms_match_num == 0) { | 382 if (vms_match_num == 0) { |
372 /* first time through, setup some things */ | 383 /* first time through, setup some things */ |
373 if (NULL == vms_fmatch) { | 384 if (NULL == vms_fmatch) { |
374 vms_fmatch = (char_u **)alloc(EXPL_ALLOC_INC * sizeof(char *)); | 385 vms_fmatch = (char_u **)alloc(EXPL_ALLOC_INC * sizeof(char *)); |
375 if (!vms_fmatch) | 386 if (!vms_fmatch) |
381 /* re-use existing space */ | 392 /* re-use existing space */ |
382 vms_match_free = vms_match_alloced; | 393 vms_match_free = vms_match_alloced; |
383 } | 394 } |
384 } | 395 } |
385 | 396 |
397 /* make matches look uniform */ | |
386 vms_remove_version(name); | 398 vms_remove_version(name); |
387 | 399 name=vms_tolower(name); |
388 /* convert filename to lowercase */ | |
389 nlen = strlen(name); | |
390 for (i = 0; i < nlen; i++) | |
391 name[i] = TOLOWER_ASC(name[i]); | |
392 | 400 |
393 /* if name already exists, don't add it */ | 401 /* if name already exists, don't add it */ |
394 for (i = 0; i<vms_match_num; i++) { | 402 for (i = 0; i<vms_match_num; i++) { |
395 if (0 == STRCMP((char_u *)name,vms_fmatch[i])) | 403 if (0 == STRCMP((char_u *)name,vms_fmatch[i])) |
396 return 1; | 404 return 1; |
426 int | 434 int |
427 mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags) | 435 mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags) |
428 { | 436 { |
429 int i, cnt = 0; | 437 int i, cnt = 0; |
430 char_u buf[MAXPATHL]; | 438 char_u buf[MAXPATHL]; |
439 char *result; | |
431 int dir; | 440 int dir; |
432 int files_alloced, files_free; | 441 int files_alloced, files_free; |
433 | 442 |
434 *num_file = 0; /* default: no files found */ | 443 *num_file = 0; /* default: no files found */ |
435 files_alloced = EXPL_ALLOC_INC; | 444 files_alloced = EXPL_ALLOC_INC; |
447 expand_env(pat[i],buf,MAXPATHL); | 456 expand_env(pat[i],buf,MAXPATHL); |
448 else | 457 else |
449 STRCPY(buf,pat[i]); | 458 STRCPY(buf,pat[i]); |
450 | 459 |
451 vms_match_num = 0; /* reset collection counter */ | 460 vms_match_num = 0; /* reset collection counter */ |
452 cnt = decc$to_vms(decc$translate_vms(vms_fixfilename(buf)), vms_wproc, 1, 0); | 461 result = decc$translate_vms(vms_fixfilename(buf)); |
453 /* allow wild, no dir */ | 462 if ( (int) result == 0 || (int) result == -1 ) { |
463 cnt = 0; | |
464 } | |
465 else { | |
466 cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ; | |
467 } | |
454 if (cnt > 0) | 468 if (cnt > 0) |
455 cnt = vms_match_num; | 469 cnt = vms_match_num; |
456 | 470 |
457 if (cnt < 1) | 471 if (cnt < 1) |
458 continue; | 472 continue; |
495 | 509 |
496 int | 510 int |
497 mch_expandpath(garray_T *gap, char_u *path, int flags) | 511 mch_expandpath(garray_T *gap, char_u *path, int flags) |
498 { | 512 { |
499 int i,cnt = 0; | 513 int i,cnt = 0; |
514 char *result; | |
515 | |
500 vms_match_num = 0; | 516 vms_match_num = 0; |
501 | 517 /* the result from the decc$translate_vms needs to be handled */ |
502 cnt = decc$to_vms(decc$translate_vms(vms_fixfilename(path)), vms_wproc, 1, 0); | 518 /* otherwise it might create ACCVIO error in decc$to_vms */ |
503 /* allow wild, no dir */ | 519 result = decc$translate_vms(vms_fixfilename(path)); |
520 if ( (int) result == 0 || (int) result == -1 ) { | |
521 cnt = 0; | |
522 } | |
523 else { | |
524 cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); | |
525 } | |
504 if (cnt > 0) | 526 if (cnt > 0) |
505 cnt = vms_match_num; | 527 cnt = vms_match_num; |
506 for (i = 0; i < cnt; i++) | 528 for (i = 0; i < cnt; i++) |
507 { | 529 { |
508 if (mch_getperm(vms_fmatch[i]) >= 0) /* add existing file */ | 530 if (mch_getperm(vms_fmatch[i]) >= 0) /* add existing file */ |
519 { | 541 { |
520 char *lastcolon; | 542 char *lastcolon; |
521 char *end_of_dir; | 543 char *end_of_dir; |
522 char ch; | 544 char ch; |
523 int len; | 545 int len; |
546 char *out_str=out; | |
524 | 547 |
525 /* copy vms filename portion up to last colon | 548 /* copy vms filename portion up to last colon |
526 * (node and/or disk) | 549 * (node and/or disk) |
527 */ | 550 */ |
528 lastcolon = strrchr(in, ':'); /* find last colon */ | 551 lastcolon = strrchr(in, ':'); /* find last colon */ |
600 | 623 |
601 if (end_of_dir != NULL) /* Terminate directory portion */ | 624 if (end_of_dir != NULL) /* Terminate directory portion */ |
602 *end_of_dir = ']'; | 625 *end_of_dir = ']'; |
603 } | 626 } |
604 | 627 |
605 | |
606 /* | 628 /* |
607 * for decc$to_vms in vms_fixfilename | 629 * for decc$to_vms in vms_fixfilename |
608 */ | 630 */ |
609 static int | 631 static int |
610 vms_fspec_proc(char *fil, int val) | 632 vms_fspec_proc(char *fil, int val) |
708 int status; | 730 int status; |
709 struct _generic_64 time_curr; | 731 struct _generic_64 time_curr; |
710 struct _generic_64 time_diff; | 732 struct _generic_64 time_diff; |
711 struct _generic_64 time_out; | 733 struct _generic_64 time_out; |
712 unsigned int convert_operation = LIB$K_DELTA_SECONDS_F; | 734 unsigned int convert_operation = LIB$K_DELTA_SECONDS_F; |
713 float sec = (float) msec / 1000; | 735 float sec =(float) msec/1000; |
714 | 736 |
715 /* make sure the iochan is set */ | 737 /* make sure the iochan is set */ |
716 if (!iochan) | 738 if (!iochan) |
717 get_tty(); | 739 get_tty(); |
718 | 740 |
719 if (msec > 0) { | 741 if (sec > 0) { |
720 /* time-out specified; convert it to absolute time */ | 742 /* time-out specified; convert it to absolute time */ |
743 /* sec>0 requirement of lib$cvtf_to_internal_time()*/ | |
721 | 744 |
722 /* get current time (number of 100ns ticks since the VMS Epoch) */ | 745 /* get current time (number of 100ns ticks since the VMS Epoch) */ |
723 status = sys$gettim(&time_curr); | 746 status = sys$gettim(&time_curr); |
724 if (status != SS$_NORMAL) | 747 if (status != SS$_NORMAL) |
725 return 0; /* error */ | 748 return 0; /* error */ |
726 | |
727 /* construct the delta time */ | 749 /* construct the delta time */ |
750 #if __G_FLOAT==0 | |
751 # ifndef VAX | |
752 /* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */ | |
753 status = lib$cvts_to_internal_time( | |
754 &convert_operation, &sec, &time_diff); | |
755 # endif | |
756 #else /* default on Alpha and VAX */ | |
728 status = lib$cvtf_to_internal_time( | 757 status = lib$cvtf_to_internal_time( |
729 &convert_operation, &sec, &time_diff); | 758 &convert_operation, &sec, &time_diff); |
759 #endif | |
730 if (status != LIB$_NORMAL) | 760 if (status != LIB$_NORMAL) |
731 return 0; /* error */ | 761 return 0; /* error */ |
732 | |
733 /* add them up */ | 762 /* add them up */ |
734 status = lib$add_times( | 763 status = lib$add_times( |
735 &time_curr, | 764 &time_curr, |
736 &time_diff, | 765 &time_diff, |
737 &time_out); | 766 &time_out); |