mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add compiler and configure info to mutt -v output (closes #3537)

Makefile(.am) updated to produce conststrings.c, which contains
C strings representing:

* the compiler's own version information;
* the CFLAGS value from the Make environment
* the ./configure options

main.c is updated to print them when running 'mutt -v'.

txt2c.sh is added to produce conststrings.c. txt2c.sh uses a compiled
txt2c binary if possible, for complete fidelity to the source strings
in whatever encoding they may use. If txt2c is not available (could
not be compiled, or was not compiled natively) it falls back on a shell
function to approximate the output using sed and tr.

+112 -17
+2
.hgignore
··· 27 27 ^mutt_dotlock(\.c)?$ 28 28 ^mutt_md5$ 29 29 ^patchlist\.c$ 30 + ^conststrings\.c$ 30 31 ^pgpewrap|pgpring$ 31 32 ^reldate\.h$ 32 33 ^smime_keys$ 34 + ^txt2c$ 33 35 ^stamp-doc-rc$ 34 36 ^doc/instdoc$ 35 37 ^doc/manual\.(txt|xml|aux|log|out|tex|pdf)$
+19 -2
Makefile.am
··· 17 17 HCVERSION = hcversion.h 18 18 endif 19 19 20 - BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h $(HCVERSION) 20 + BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c $(HCVERSION) 21 21 22 22 bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@ 23 23 mutt_SOURCES = \ ··· 94 94 mutt_dotlock.c: dotlock.c 95 95 cp $(srcdir)/dotlock.c mutt_dotlock.c 96 96 97 + # If this fails, we will fall back to the implementation in txt2c.sh 98 + txt2c: txt2c.c 99 + -$${NATIVECC-$(CC)} -o $@ $< 100 + 101 + conststrings.c: txt2c config.status 102 + ( \ 103 + $(CC) -v || \ 104 + $(CC) --version || \ 105 + $(CC) -V || \ 106 + echo "unknown compiler"; \ 107 + ) 2>&1 | ./txt2c.sh cc_version >conststrings_c 108 + echo "$(CFLAGS)" | ./txt2c.sh cc_cflags >>conststrings_c 109 + grep ac_cs_config= config.status | \ 110 + cut -d= -f2- | \ 111 + sed -e 's/^"//' -e 's/"$$//' | ./txt2c.sh configure_options >>conststrings_c 112 + mv -f conststrings_c conststrings.c 113 + 97 114 CLEANFILES = mutt_dotlock.c keymap_alldefs.h $(BUILT_SOURCES) 98 115 99 - DISTCLEANFILES= flea smime_keys 116 + DISTCLEANFILES= flea smime_keys txt2c 100 117 101 118 ACLOCAL_AMFLAGS = -I m4 102 119
+28
main.c
··· 154 154 exit (0); 155 155 } 156 156 157 + extern const char cc_version[]; 158 + extern const char cc_cflags[]; 159 + extern const char configure_options[]; 160 + 161 + static char * 162 + rstrip_in_place(char *s) 163 + { 164 + char *p; 165 + 166 + p = &s[strlen(s)]; 167 + if (p == s) 168 + return s; 169 + p--; 170 + while (p >= s && (*p == '\n' || *p == '\r')) 171 + *p-- = '\0'; 172 + return s; 173 + } 174 + 157 175 static void show_version (void) 158 176 { 159 177 struct utsname uts; ··· 192 210 #ifdef USE_HCACHE 193 211 printf ("\nhcache backend: %s", mutt_hcache_backend ()); 194 212 #endif 213 + 214 + puts ("\n\nCompiler:"); 215 + rstrip_in_place((char *)cc_version); 216 + puts (cc_version); 217 + 218 + rstrip_in_place((char *)configure_options); 219 + printf ("\nConfigure options: %s\n", configure_options); 220 + 221 + rstrip_in_place((char *)cc_cflags); 222 + printf ("\nCompilation CFLAGS: %s\n", cc_cflags); 195 223 196 224 puts (_("\nCompile options:")); 197 225
-15
muttbug.sh.in
··· 248 248 # Please provide more of these if you have any. 249 249 fi 250 250 251 - echo 252 - echo "-- Build environment information" 253 - echo 254 - echo "(Note: This is the build environment installed on the system" 255 - echo "muttbug is run on. Information may or may not match the environment" 256 - echo "used to build mutt.)" 257 - echo 258 - echo "- gcc version information" 259 - echo "@CC@" 260 - @CC@ -v 2>&1 261 - echo 262 - echo "- CFLAGS" 263 - echo @CFLAGS@ 264 - 265 - 266 251 echo 267 252 echo "-- Mutt Version Information" 268 253 echo
+37
txt2c.c
··· 1 + #include <stdio.h> 2 + 3 + #define per_line 12 4 + 5 + void 6 + txt2c(char *sym, FILE *fp) 7 + { 8 + unsigned char buf[per_line]; 9 + int i; 10 + int sz = 0; 11 + 12 + printf("unsigned char %s[] = {\n", sym); 13 + while (1) { 14 + sz = fread(buf, sizeof(unsigned char), per_line, fp); 15 + if (sz == 0) 16 + break; 17 + printf("\t"); 18 + for (i = 0; i < sz; i++) 19 + printf("0x%02x, ", buf[i]); 20 + printf("\n"); 21 + } 22 + 23 + printf("\t0x00\n};\n"); 24 + } 25 + 26 + 27 + int 28 + main(int argc, char *argv[]) 29 + { 30 + if (argc != 2) { 31 + fprintf(stderr, "usage: %s symbol <textfile >textfile.c\n", argv[0]); 32 + return 2; 33 + } 34 + 35 + txt2c(argv[1], stdin); 36 + return 0; 37 + }
+26
txt2c.sh
··· 1 + #!/bin/sh 2 + 3 + txt2c_fallback () { 4 + # consumes stdin 5 + 6 + # declaration 7 + echo "unsigned char $1[] = " 8 + 9 + # initializer - filter out unwanted characters, then convert problematic 10 + # or odd-looking sequences. The result is a sequence of quote-bounded 11 + # C strings, which the compiler concatenates into a single C string. 12 + tr -c '\011\012\015\040[!-~]' '?' | 13 + sed \ 14 + -e 's/\\/\\\\/g' \ 15 + -e 's/"/\\"/g' \ 16 + -e 's/??/\?\?/g' \ 17 + -e 's/\t/\\t/'g \ 18 + -e 's/\r/\\r/g' \ 19 + -e 's/^/ "/g' \ 20 + -e 's/$/\\n"/g' 21 + echo ";" 22 + } 23 + 24 + ./txt2c test </dev/null >/dev/null 2>&1 && 25 + ./txt2c "$1" || 26 + txt2c_fallback "$1"