Changeset 1847 for trunk/src/kmk/expand.c
- Timestamp:
- Oct 12, 2008, 6:25:03 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/expand.c
r1837 r1847 753 753 expand_argument (const char *str, const char *end) 754 754 { 755 #ifndef CONFIG_WITH_VALUE_LENGTH /** @todo the hacks are no longer required. Clean up !! */ 755 756 char *tmp; 757 #endif 756 758 757 759 if (str == end) … … 823 825 824 826 Differs from variable_expand_for_file in that it takes a pointer to 825 where in the variable buffer to start outputting the expanded string. */ 827 where in the variable buffer to start outputting the expanded string, 828 and that it can returned the length of the string if you wish. */ 826 829 827 830 char * 828 variable_expand_for_file_2 (char *o, const char *line, struct file *file) 831 variable_expand_for_file_2 (char *o, const char *line, unsigned int length, 832 struct file *file, unsigned int *value_lenp) 829 833 { 830 834 char *result; 831 835 struct variable_set_list *save; 832 836 const struct floc *reading_file_saved; 837 long len = length == ~0U ? (long)-1 : (long)length; 833 838 char *eol; 834 839 840 if (!o) 841 o = initialize_variable_output(); 842 835 843 if (file == 0) 836 return variable_expand_string_2 (o, line, (long)-1, &eol); 837 838 save = current_variable_set_list; 839 current_variable_set_list = file->variables; 840 reading_file_saved = reading_file; 841 if (file->cmds && file->cmds->fileinfo.filenm) 842 reading_file = &file->cmds->fileinfo; 844 result = variable_expand_string_2 (o, line, len, &eol); 843 845 else 844 reading_file = 0; 845 result = variable_expand_string_2 (o, line, (long)-1, &eol); 846 current_variable_set_list = save; 847 reading_file = reading_file_saved; 846 { 847 save = current_variable_set_list; 848 current_variable_set_list = file->variables; 849 reading_file_saved = reading_file; 850 if (file->cmds && file->cmds->fileinfo.filenm) 851 reading_file = &file->cmds->fileinfo; 852 else 853 reading_file = 0; 854 result = variable_expand_string_2 (o, line, len, &eol); 855 current_variable_set_list = save; 856 reading_file = reading_file_saved; 857 } 858 859 if (value_lenp) 860 *value_lenp = eol - result; 848 861 849 862 return result;
Note:
See TracChangeset
for help on using the changeset viewer.