Changeset 1122 in kBuild
- Timestamp:
- Sep 25, 2007 6:16:26 AM (18 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/Makefile.am ¶
r1121 r1122 113 113 -DCONFIG_WITH_SET_CONDITIONALS \ 114 114 -DCONFIG_WITH_DATE \ 115 -DCONFIG_WITH_FILE_SIZE \ 115 116 -DCONFIG_PRETTY_COMMAND_PRINTING \ 116 117 \ -
trunk/src/kmk/Makefile.kmk ¶
r1121 r1122 115 115 CONFIG_WITH_SET_CONDITIONALS \ 116 116 CONFIG_WITH_DATE \ 117 CONFIG_WITH_FILE_SIZE \ 117 118 CONFIG_PRETTY_COMMAND_PRINTING \ 118 119 \ -
trunk/src/kmk/function.c ¶
r1121 r1122 43 43 #include <assert.h> /* bird */ 44 44 45 #if defined (CONFIG_WITH_MATH) || defined (CONFIG_WITH_NANOTS) /* bird */45 #if defined (CONFIG_WITH_MATH) || defined (CONFIG_WITH_NANOTS) || defined (CONFIG_WITH_FILE_SIZE) /* bird */ 46 46 # include <ctype.h> 47 47 # ifdef _MSC_VER … … 51 51 typedef int64_t math_int; 52 52 # endif 53 static char *math_int_to_variable_buffer (char *, math_int); 53 54 #endif 54 55 … … 2674 2675 2675 2676 #ifdef CONFIG_WITH_DATE 2677 /* The first argument is the strftime format string, a iso 2678 timestamp is the default if nothing is given. 2679 2680 The second argument is a time value if given. The format 2681 is either the format from the first argument or given as 2682 an additional third argument. */ 2676 2683 static char * 2677 2684 func_date (char *o, char **argv, const char *funcname) … … 2689 2696 buf++; 2690 2697 if (*buf) 2691 format = buf;2698 format = argv[0]; 2692 2699 } 2693 2700 … … 2709 2716 free (buf); 2710 2717 return o; 2718 } 2719 #endif 2720 2721 #ifdef CONFIG_WITH_FILE_SIZE 2722 /* Prints the size of the specified file. Only one file is 2723 permitted, notthing is stripped. -1 is returned if stat 2724 fails. */ 2725 static char * 2726 func_file_size (char *o, char **argv, const char *funcname) 2727 { 2728 struct stat st; 2729 if (stat (argv[0], &st)) 2730 return variable_buffer_output (o, "-1", 2); 2731 return math_int_to_variable_buffer (o, st.st_size); 2711 2732 } 2712 2733 #endif … … 2762 2783 #endif /* CONFIG_WITH_STACK */ 2763 2784 2764 #if defined (CONFIG_WITH_MATH) || defined (CONFIG_WITH_NANOTS) 2785 #if defined (CONFIG_WITH_MATH) || defined (CONFIG_WITH_NANOTS) || defined (CONFIG_WITH_FILE_SIZE) 2765 2786 /* outputs the number (as a string) into the variable buffer. */ 2766 2787 static char * … … 3196 3217 { STRING_SIZE_TUPLE("date-utc"), 0, 1, 1, func_date}, 3197 3218 #endif 3219 #ifdef CONFIG_WITH_FILE_SIZE 3220 { STRING_SIZE_TUPLE("file-size"), 1, 1, 1, func_file_size}, 3221 #endif 3198 3222 #ifdef CONFIG_WITH_STACK 3199 3223 { STRING_SIZE_TUPLE("stack-push"), 2, 2, 1, func_stack_push}, -
trunk/src/kmk/variable.c ¶
r1121 r1122 1038 1038 && defined (CONFIG_WITH_SET_CONDITIONALS) \ 1039 1039 && defined (CONFIG_WITH_DATE) \ 1040 && defined (CONFIG_WITH_FILE_SIZE) \ 1040 1041 && defined (KMK_HELPERS) 1041 1042 (void) define_variable ("KMK_FEATURES", 12, … … 1052 1053 " set-conditionals" 1053 1054 " date" 1055 " file-size" 1054 1056 " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one " 1055 1057 , o_default, 0); … … 1090 1092 strcat (buf, " date"); 1091 1093 # endif 1094 # if defined (CONFIG_WITH_FILE_SIZE) 1095 strcat (buf, " file-size"); 1096 # endif 1092 1097 # if defined (KMK_HELPERS) 1093 1098 strcat (buf, " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one");
Note:
See TracChangeset
for help on using the changeset viewer.