You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sander Temme <sc...@apache.org> on 2007/02/01 18:19:00 UTC
Re: apxs -q [end of statement]
On Dec 8, 2006, at 1:56 PM, William A. Rowe, Jr. wrote:
> It always irked me that apxs -q {arbitraryvariable} throws up.
> Which ones
> are valid anyways?
Yes, highly irksome. How can Joe Developer find out which variables
APXS knows? Yes, they can read ${installbuilddir}/config_vars.mk,
but how is that obvious?
> The attached patch would provide a list of the values from apxs -q
> if no variable name is passed.
+1
> Feedback? If the list likes, please commit.
Yes! Like! I extended it a little bit to pretty-print the list.
Thoughts?
S.
--
sctemme@apache.org http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4 B7B8 B2BE BC40 1529 24AF
Index: support/apxs.in
===================================================================
--- support/apxs.in (revision 501957)
+++ support/apxs.in (working copy)
@@ -155,7 +155,7 @@
my $rc;
($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);
&usage if ($rc == 0);
-&usage if ($#ARGV == -1 and not $opt_g);
+&usage if ($#ARGV == -1 and not $opt_g and not $opt_q);
&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and
not $opt_c and not $opt_e);
# argument handling
@@ -303,8 +303,26 @@
##
## QUERY INFORMATION
##
- my $result = get_vars(@args);
- print "$result\n";
+ my $result;
+ if ($#args >= 0) {
+ $result = get_vars(@args);
+ print "$result\n";
+ } else {
+ # -q without var name prints all variables and their values
+ # Variable names in alphabetic order
+ my @vars = sort {uc($a) cmp uc($b)} keys %config_vars;
+
+ # Make the left column as wide as the longest variable name
+ my $width = 0;
+ foreach (@vars) {
+ my $l = length $_;
+ $width = $l unless ($l <= $width);
+ }
+
+ foreach (@vars) {
+ printf "%-${width}s = %s\n", $_, $config_vars{$_};
+ }
+ }
}
my $apr_config = get_vars("APR_CONFIG");
Re: apxs -q [end of statement]
Posted by Paul Querna <ch...@force-elite.com>.
>William A. Rowe, Jr. wrote:
>> Sander Temme wrote:
...
> I'd like to hear one more voice say this is useful to them, and then commit.
+1, its useful to me.
-Paul
Re: apxs -q [end of statement]
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Sander Temme wrote:
>
> On Feb 1, 2007, at 9:37 AM, William A. Rowe, Jr. wrote:
>
>> I'm almost thinking that a --qq or -q -v sort of option could provide the
>> pretty-print format. Once nice thing about the raw version is that it's
>> more directly usable as input to other things.
>
> +1
>
> Like below? Hm... my mailer does weird formatting. Attaching as file as
> well.
>
> S.
>
> --sctemme@apache.org http://www.temme.net/sander/
> PGP FP: 51B4 8727 466A 0BC3 69F4 B7B8 B2BE BC40 1529 24AF
>
>
> Index: support/apxs.in
> ===================================================================
> --- support/apxs.in (revision 501957)
> +++ support/apxs.in (working copy)
> @@ -75,6 +75,7 @@
> my $opt_q = 0;
> my $opt_h = 0;
> my $opt_p = 0;
> +my $opt_v = 0;
> # this subroutine is derived from Perl's getopts.pl with the
> enhancement of
> # the "+" metacharacter at the format string to allow a list to be
> built by
> @@ -142,7 +143,7 @@
> sub usage {
> print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n";
> - print STDERR " apxs -q [-S <var>=<val>] <query> ...\n";
> + print STDERR " apxs -q [-S <var>=<val>] [<query> ...]\n";
print STDERR " apxs -q [-v] [-S <var>=<val>] [<query> ...]\n";
?
I'd like to hear one more voice say this is useful to them, and then commit.
Re: apxs -q [end of statement]
Posted by Sander Temme <sc...@apache.org>.
On Feb 1, 2007, at 9:37 AM, William A. Rowe, Jr. wrote:
> I'm almost thinking that a --qq or -q -v sort of option could
> provide the
> pretty-print format. Once nice thing about the raw version is that
> it's
> more directly usable as input to other things.
+1
Like below? Hm... my mailer does weird formatting. Attaching as file
as well.
S.
--
sctemme@apache.org http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4 B7B8 B2BE BC40 1529 24AF
Index: support/apxs.in
===================================================================
--- support/apxs.in (revision 501957)
+++ support/apxs.in (working copy)
@@ -75,6 +75,7 @@
my $opt_q = 0;
my $opt_h = 0;
my $opt_p = 0;
+my $opt_v = 0;
# this subroutine is derived from Perl's getopts.pl with the
enhancement of
# the "+" metacharacter at the format string to allow a list to be
built by
@@ -142,7 +143,7 @@
sub usage {
print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n";
- print STDERR " apxs -q [-S <var>=<val>] <query> ...\n";
+ print STDERR " apxs -q [-S <var>=<val>] [<query> ...]\n";
print STDERR " apxs -c [-S <var>=<val>] [-o <dsofile>] [-
D <name>[=<value>]]\n";
print STDERR " [-I <incdir>] [-L <libdir>] [-l
<libname>] [-Wc,<flags>]\n";
print STDERR " [-Wl,<flags>] [-p] <files> ...\n";
@@ -153,9 +154,9 @@
# option handling
my $rc;
-($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);
+($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApv", @ARGV);
&usage if ($rc == 0);
-&usage if ($#ARGV == -1 and not $opt_g);
+&usage if ($#ARGV == -1 and not $opt_g and not $opt_q);
&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and
not $opt_c and not $opt_e);
# argument handling
@@ -303,8 +304,35 @@
##
## QUERY INFORMATION
##
- my $result = get_vars(@args);
- print "$result\n";
+ my $result;
+ if ($#args >= 0) {
+ $result = get_vars(@args);
+ print "$result\n";
+ } else {
+ # -q without var name prints all variables and their values
+
+ # Additional -v pretty-prints output
+ if ($opt_v) {
+ # Variable names in alphabetic order
+ my @vars = sort {uc($a) cmp uc($b)} keys %config_vars;
+
+ # Make the left column as wide as the longest variable name
+ my $width = 0;
+ foreach (@vars) {
+ my $l = length $_;
+ $width = $l unless ($l <= $width);
+ }
+
+ foreach (@vars) {
+ printf "%-${width}s = %s\n", $_, $config_vars{$_};
+ }
+ } else {
+ # Unprettified name=value list
+ foreach (keys %config_vars) {
+ print "$_=$config_vars{$_}\n";
+ }
+ }
+ }
}
my $apr_config = get_vars("APR_CONFIG");
Re: apxs -q [end of statement]
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
I'm almost thinking that a --qq or -q -v sort of option could provide the
pretty-print format. Once nice thing about the raw version is that it's
more directly usable as input to other things.
Thoughts?
Sander Temme wrote:
>
> On Dec 8, 2006, at 1:56 PM, William A. Rowe, Jr. wrote:
>
>> It always irked me that apxs -q {arbitraryvariable} throws up. Which
>> ones
>> are valid anyways?
>
> Yes, highly irksome. How can Joe Developer find out which variables
> APXS knows? Yes, they can read ${installbuilddir}/config_vars.mk, but
> how is that obvious?
>
>> The attached patch would provide a list of the values from apxs -q
>> if no variable name is passed.
>
> +1
>
>> Feedback? If the list likes, please commit.
>
> Yes! Like! I extended it a little bit to pretty-print the list.
>
> Thoughts?
>
> S.
>
> --sctemme@apache.org http://www.temme.net/sander/
> PGP FP: 51B4 8727 466A 0BC3 69F4 B7B8 B2BE BC40 1529 24AF
>
>
> Index: support/apxs.in
> ===================================================================
> --- support/apxs.in (revision 501957)
> +++ support/apxs.in (working copy)
> @@ -155,7 +155,7 @@
> my $rc;
> ($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);
> &usage if ($rc == 0);
> -&usage if ($#ARGV == -1 and not $opt_g);
> +&usage if ($#ARGV == -1 and not $opt_g and not $opt_q);
> &usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not
> $opt_c and not $opt_e);
> # argument handling
> @@ -303,8 +303,26 @@
> ##
> ## QUERY INFORMATION
> ##
> - my $result = get_vars(@args);
> - print "$result\n";
> + my $result;
> + if ($#args >= 0) {
> + $result = get_vars(@args);
> + print "$result\n";
> + } else {
> + # -q without var name prints all variables and their values
> + # Variable names in alphabetic order
> + my @vars = sort {uc($a) cmp uc($b)} keys %config_vars;
> +
> + # Make the left column as wide as the longest variable name
> + my $width = 0;
> + foreach (@vars) {
> + my $l = length $_;
> + $width = $l unless ($l <= $width);
> + }
> +
> + foreach (@vars) {
> + printf "%-${width}s = %s\n", $_, $config_vars{$_};
> + }
> + }
> }
> my $apr_config = get_vars("APR_CONFIG");