Mercurial > vim
comparison src/ex_getln.c @ 1754:28d0c20ad8a0 v7.2.051
updated for version 7.2-051
author | vimboss |
---|---|
date | Fri, 28 Nov 2008 10:01:10 +0000 |
parents | 734d5bdae499 |
children | eb1ce51c1cb0 |
comparison
equal
deleted
inserted
replaced
1753:5098908178cd | 1754:28d0c20ad8a0 |
---|---|
2522 if (ccline.xpc != NULL | 2522 if (ccline.xpc != NULL |
2523 && ccline.xpc->xp_pattern != NULL | 2523 && ccline.xpc->xp_pattern != NULL |
2524 && ccline.xpc->xp_context != EXPAND_NOTHING | 2524 && ccline.xpc->xp_context != EXPAND_NOTHING |
2525 && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) | 2525 && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) |
2526 { | 2526 { |
2527 int i = ccline.xpc->xp_pattern - p; | 2527 int i = (int)(ccline.xpc->xp_pattern - p); |
2528 | 2528 |
2529 /* If xp_pattern points inside the old cmdbuff it needs to be adjusted | 2529 /* If xp_pattern points inside the old cmdbuff it needs to be adjusted |
2530 * to point into the newly allocated memory. */ | 2530 * to point into the newly allocated memory. */ |
2531 if (i >= 0 && i <= ccline.cmdlen) | 2531 if (i >= 0 && i <= ccline.cmdlen) |
2532 ccline.xpc->xp_pattern = ccline.cmdbuff + i; | 2532 ccline.xpc->xp_pattern = ccline.cmdbuff + i; |
4895 *file = NULL; | 4895 *file = NULL; |
4896 s = alloc((unsigned)(STRLEN(pat) + STRLEN(dirname) + 7)); | 4896 s = alloc((unsigned)(STRLEN(pat) + STRLEN(dirname) + 7)); |
4897 if (s == NULL) | 4897 if (s == NULL) |
4898 return FAIL; | 4898 return FAIL; |
4899 sprintf((char *)s, "%s/%s*.vim", dirname, pat); | 4899 sprintf((char *)s, "%s/%s*.vim", dirname, pat); |
4900 all = globpath(p_rtp, s); | 4900 all = globpath(p_rtp, s, 0); |
4901 vim_free(s); | 4901 vim_free(s); |
4902 if (all == NULL) | 4902 if (all == NULL) |
4903 return FAIL; | 4903 return FAIL; |
4904 | 4904 |
4905 ga_init2(&ga, (int)sizeof(char *), 3); | 4905 ga_init2(&ga, (int)sizeof(char *), 3); |
4936 * Expand "file" for all comma-separated directories in "path". | 4936 * Expand "file" for all comma-separated directories in "path". |
4937 * Returns an allocated string with all matches concatenated, separated by | 4937 * Returns an allocated string with all matches concatenated, separated by |
4938 * newlines. Returns NULL for an error or no matches. | 4938 * newlines. Returns NULL for an error or no matches. |
4939 */ | 4939 */ |
4940 char_u * | 4940 char_u * |
4941 globpath(path, file) | 4941 globpath(path, file, expand_options) |
4942 char_u *path; | 4942 char_u *path; |
4943 char_u *file; | 4943 char_u *file; |
4944 int expand_options; | |
4944 { | 4945 { |
4945 expand_T xpc; | 4946 expand_T xpc; |
4946 char_u *buf; | 4947 char_u *buf; |
4947 garray_T ga; | 4948 garray_T ga; |
4948 int i; | 4949 int i; |
4967 copy_option_part(&path, buf, MAXPATHL, ","); | 4968 copy_option_part(&path, buf, MAXPATHL, ","); |
4968 if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) | 4969 if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) |
4969 { | 4970 { |
4970 add_pathsep(buf); | 4971 add_pathsep(buf); |
4971 STRCAT(buf, file); | 4972 STRCAT(buf, file); |
4972 if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL | 4973 if (ExpandFromContext(&xpc, buf, &num_p, &p, |
4973 && num_p > 0) | 4974 WILD_SILENT|expand_options) != FAIL && num_p > 0) |
4974 { | 4975 { |
4975 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT); | 4976 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); |
4976 for (len = 0, i = 0; i < num_p; ++i) | 4977 for (len = 0, i = 0; i < num_p; ++i) |
4977 len += (int)STRLEN(p[i]) + 1; | 4978 len += (int)STRLEN(p[i]) + 1; |
4978 | 4979 |
4979 /* Concatenate new results to previous ones. */ | 4980 /* Concatenate new results to previous ones. */ |
4980 if (ga_grow(&ga, len) == OK) | 4981 if (ga_grow(&ga, len) == OK) |