From a8cfdb651a486641b6671c6bc5ce6c8fb506a995 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 5 Jul 2020 00:48:51 -0600 Subject: * Unix Alpine displays configure options and flags when invoked as "alpine -v". Suggested by Matt Ackeret. --- alpine/Makefile.am | 1 + alpine/Makefile.in | 1 + alpine/arg.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++- pico/blddate.c | 1 + pith/pine.hlp | 5 +++- 5 files changed, 75 insertions(+), 2 deletions(-) diff --git a/alpine/Makefile.am b/alpine/Makefile.am index 0542aad8..da6f661e 100644 --- a/alpine/Makefile.am +++ b/alpine/Makefile.am @@ -52,3 +52,4 @@ CLEANFILES = date.c date.c: echo "char datestamp[]="\"$(ALPINE_DATESTAMP)\"";" > date.c echo "char hoststamp[]="\"$(ALPINE_HOSTSTAMP)\"";" >> date.c + echo "char configoptions[]="\"`../config.status --config`\"";" >> date.c diff --git a/alpine/Makefile.in b/alpine/Makefile.in index a2b7af87..0e84230d 100644 --- a/alpine/Makefile.in +++ b/alpine/Makefile.in @@ -904,6 +904,7 @@ uninstall-am: uninstall-binPROGRAMS date.c: echo "char datestamp[]="\"$(ALPINE_DATESTAMP)\"";" > date.c echo "char hoststamp[]="\"$(ALPINE_HOSTSTAMP)\"";" >> date.c + echo "char configoptions[]="\"`../config.status --config`\"";" >> date.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/alpine/arg.c b/alpine/arg.c index 57c39fca..8e00a210 100644 --- a/alpine/arg.c +++ b/alpine/arg.c @@ -38,7 +38,9 @@ static char rcsid[] = "$Id: arg.c 900 2008-01-05 01:13:26Z hubert@u.washington.e int process_debug_str(char *); void args_add_attach(PATMT **, char *, int); int pinerc_cmdline_opt(char *); +void display_config_options(char *, char *); +extern char configoptions[]; /* * Name started as to invoke function key mode @@ -192,7 +194,68 @@ N_("\tNote: All of -xoauth options above must be used, if any of them is used"), NULL }; - +void +display_config_options(char *configopts, char *defprefix) +{ + char *copts = configopts ? cpystr(configopts) : NULL; + char **options = NULL; + char *s, *t, *prefix; + int len, nlines, pending; + + for(nlines = 0, s = copts; s != NULL; nlines++){ + s = strchr(s, '\''); + if(s != NULL) s++; + } + options = fs_get((nlines/2 + 4)*sizeof(char *)); /* 4 in worst case scenario */ + memset((void *) options, 0, (nlines/2 + 4)*sizeof(char *)); + for(s = copts, len = 0, nlines = 0; s != NULL; ){ + pending = 0; + prefix = len == 0 ? (nlines == 0 ? defprefix : " ") : " "; + if((s = strchr(s, '\'')) != NULL){ + t = strchr(s+1, '\''); + *t = '\0'; + if(!strncmp(s+1, "CFLAGS=", 7) + || !strncmp(s+1, "CC=", 3) + || !strncmp(s+1, "LIBS=", 5) + || !strncmp(s+1, "CPP=", 4) + || !strncmp(s+1, "CPPFLAGS=", 9) + || !strncmp(s+1, "LT_SYS_LIBRARY_PATH=", 20) + || !strncmp(s+1, "LDFLAGS=", 8)){ + display_args_err(s+1, NULL, 0); + *t++ = '\''; + s = t; + continue; + } + if(len + strlen(prefix) + strlen(s+1) > 74 ){ + if(len == 0){ + options[nlines] = fs_get((strlen(prefix) + strlen(s+1) + 3)*sizeof(char)); + sprintf(options[nlines++], "%s%s \\", prefix, s+1); + } + else{ + strcat(options[nlines++], " \\"); + pending++; + } + len = 0; + } + else{ + if(len == 0){ + options[nlines] = fs_get(76*sizeof(char)); + *options[nlines] = '\0'; + } + strcat(options[nlines], prefix); + strcat(options[nlines], s+1); + len = strlen(options[nlines]); + } + if(t != NULL) + *t = '\''; + if(!pending) + s = t ? t + 1 : NULL; + } + } + display_args_err(NULL, options, 0); + free_list_array(&options); + fs_give((void **) &copts); +} /* * Parse the command line args. @@ -1002,6 +1065,10 @@ Loop: while(--ac > 0) datestamp, hoststamp); tmp_20k_buf[SIZEOF_20KBUF-1] = '\0'; display_args_err(tmp_20k_buf, NULL, 0); + if(*configoptions){ + display_args_err(_("Alpine was built with the following options:"), NULL, 0); + display_config_options(configoptions, "./configure "); + } exit(0); } diff --git a/pico/blddate.c b/pico/blddate.c index 00f0b558..8ad7c231 100644 --- a/pico/blddate.c +++ b/pico/blddate.c @@ -46,6 +46,7 @@ main(argc, argv) 1900 + t->tm_year); fprintf(outfile, "char hoststamp[]=\"random-pc\";\n"); + fprintf(outfile, "char *configoptions[] = \"\"";\n"); fclose(outfile); diff --git a/pith/pine.hlp b/pith/pine.hlp index 777b53f5..5fd05293 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 481 2020-07-04 02:42:49 +Alpine Commit 482 2020-07-05 00:48:47 ============= h_news ================= @@ -217,6 +217,9 @@ problems you find with this release. replaced by a random string. +
  • Unix Alpine displays configure options and flags when + invoked as "alpine -v". Suggested by Matt Ackeret. +
  • Alpine will ding the terminal bell when asking about quitting when new mail arrives. This is consistent with Alpine dinging the bell when new mail arrives. The bell will not ding if it is disabled -- cgit v1.2.3-70-g09d2