Mercurial > vim
comparison src/option.c @ 170:8c60f65311fa v7.0052
updated for version 7.0052
author | vimboss |
---|---|
date | Sat, 26 Feb 2005 23:04:13 +0000 |
parents | 4d9eabb1396e |
children | 141a8ad5e2b3 |
comparison
equal
deleted
inserted
replaced
169:0e902b8f511f | 170:8c60f65311fa |
---|---|
2627 # ifdef UNIX | 2627 # ifdef UNIX |
2628 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"}; | 2628 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"}; |
2629 # else | 2629 # else |
2630 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"}; | 2630 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"}; |
2631 # endif | 2631 # endif |
2632 int len; | 2632 int len; |
2633 garray_T ga; | 2633 garray_T ga; |
2634 int mustfree; | |
2634 | 2635 |
2635 ga_init2(&ga, 1, 100); | 2636 ga_init2(&ga, 1, 100); |
2636 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n) | 2637 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n) |
2637 { | 2638 { |
2639 mustfree = FALSE; | |
2638 # ifdef UNIX | 2640 # ifdef UNIX |
2639 if (*names[n] == NUL) | 2641 if (*names[n] == NUL) |
2640 p = (char_u *)"/tmp"; | 2642 p = (char_u *)"/tmp"; |
2641 else | 2643 else |
2642 # endif | 2644 # endif |
2643 p = mch_getenv((char_u *)names[n]); | 2645 p = vim_getenv((char_u *)names[n], &mustfree); |
2644 if (p != NULL && *p != NUL) | 2646 if (p != NULL && *p != NUL) |
2645 { | 2647 { |
2646 /* First time count the NUL, otherwise count the ','. */ | 2648 /* First time count the NUL, otherwise count the ','. */ |
2647 len = STRLEN(p) + 3; | 2649 len = STRLEN(p) + 3; |
2648 if (ga_grow(&ga, len) == OK) | 2650 if (ga_grow(&ga, len) == OK) |
2653 add_pathsep(ga.ga_data); | 2655 add_pathsep(ga.ga_data); |
2654 STRCAT(ga.ga_data, "*"); | 2656 STRCAT(ga.ga_data, "*"); |
2655 ga.ga_len += len; | 2657 ga.ga_len += len; |
2656 } | 2658 } |
2657 } | 2659 } |
2660 if (mustfree) | |
2661 vim_free(p); | |
2658 } | 2662 } |
2659 if (ga.ga_data != NULL) | 2663 if (ga.ga_data != NULL) |
2660 { | 2664 { |
2661 set_string_default("bsk", ga.ga_data); | 2665 set_string_default("bsk", ga.ga_data); |
2662 vim_free(ga.ga_data); | 2666 vim_free(ga.ga_data); |
2703 { | 2707 { |
2704 char_u *cdpath; | 2708 char_u *cdpath; |
2705 char_u *buf; | 2709 char_u *buf; |
2706 int i; | 2710 int i; |
2707 int j; | 2711 int j; |
2712 int mustfree = FALSE; | |
2708 | 2713 |
2709 /* Initialize the 'cdpath' option's default value. */ | 2714 /* Initialize the 'cdpath' option's default value. */ |
2710 cdpath = mch_getenv((char_u *)"CDPATH"); | 2715 cdpath = vim_getenv((char_u *)"CDPATH", &mustfree); |
2711 if (cdpath != NULL) | 2716 if (cdpath != NULL) |
2712 { | 2717 { |
2713 buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2)); | 2718 buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2)); |
2714 if (buf != NULL) | 2719 if (buf != NULL) |
2715 { | 2720 { |
2729 buf[j] = NUL; | 2734 buf[j] = NUL; |
2730 opt_idx = findoption((char_u *)"cdpath"); | 2735 opt_idx = findoption((char_u *)"cdpath"); |
2731 options[opt_idx].def_val[VI_DEFAULT] = buf; | 2736 options[opt_idx].def_val[VI_DEFAULT] = buf; |
2732 options[opt_idx].flags |= P_DEF_ALLOCED; | 2737 options[opt_idx].flags |= P_DEF_ALLOCED; |
2733 } | 2738 } |
2739 if (mustfree) | |
2740 vim_free(cdpath); | |
2734 } | 2741 } |
2735 } | 2742 } |
2736 #endif | 2743 #endif |
2737 | 2744 |
2738 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux)) | 2745 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux)) |
2959 convert_setup(&output_conv, p_enc, p_tenc); | 2966 convert_setup(&output_conv, p_enc, p_tenc); |
2960 } | 2967 } |
2961 else | 2968 else |
2962 p_tenc = empty_option; | 2969 p_tenc = empty_option; |
2963 } | 2970 } |
2971 # endif | |
2972 # if defined(WIN3264) && defined(FEAT_MBYTE) | |
2973 /* $HOME may have characters in active code page. */ | |
2974 init_homedir(); | |
2964 # endif | 2975 # endif |
2965 } | 2976 } |
2966 else | 2977 else |
2967 { | 2978 { |
2968 vim_free(p_enc); | 2979 vim_free(p_enc); |
5087 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) | 5098 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) |
5088 { | 5099 { |
5089 convert_setup(&input_conv, p_tenc, p_enc); | 5100 convert_setup(&input_conv, p_tenc, p_enc); |
5090 convert_setup(&output_conv, p_enc, p_tenc); | 5101 convert_setup(&output_conv, p_enc, p_tenc); |
5091 } | 5102 } |
5103 | |
5104 # if defined(WIN3264) && defined(FEAT_MBYTE) | |
5105 /* $HOME may have characters in active code page. */ | |
5106 if (varp == &p_enc) | |
5107 init_homedir(); | |
5108 # endif | |
5092 } | 5109 } |
5093 } | 5110 } |
5094 #endif | 5111 #endif |
5095 | 5112 |
5096 #if defined(FEAT_POSTSCRIPT) | 5113 #if defined(FEAT_POSTSCRIPT) |