Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fc67e1f

Browse files
committed
Script cleanups.
1 parent f20ec2e commit fc67e1f

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/backend/utils/misc/check_guc

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/sh
22

33
## currently, this script makes a lot of assumptions:
4-
## 1) location of guc.c and postgresql.conf.sample relative to script
5-
## For postgresql.conf.sample
6-
## 2) the valid config settings may be preceded by a '#', but NOT '# '
7-
## 3) the valid config settings will be followed immediately by ' ='
8-
## (at least one space preceding the '='
9-
## For guc.c
10-
## 4) the options have PGC_ on the same line as the option
11-
## 5) the options have '{ ' on the same line as the option
4+
## 1) the valid config settings may be preceded by a '#', but NOT '# '
5+
## (we use this to skip comments)
6+
## 2) the valid config settings will be followed immediately by ' ='
7+
## (at least one space preceding the '=' for guc.c)
8+
## 3) the options have PGC_ on the same line as the option
9+
## 4) the options have '{ ' on the same line as the option
1210

1311
## Problems
1412
## 1) Don't know what to do with TRANSACTION ISOLATION LEVEL
@@ -23,21 +21,25 @@ lc_time lc_numeric fixbtree"
2321
### in guc.h?
2422

2523
# grab everything that looks like a setting and convert it to lower case
26-
SETTINGS=`grep ' =' postgresql.conf.sample | grep -v '^# ' | \
27-
sed -e 's/^#//' | awk '{print $1}'`
28-
SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'`
24+
SETTINGS=`grep ' =' postgresql.conf.sample |
25+
grep -v '^# ' | # strip comments
26+
sed -e 's/^#//' |
27+
awk '{print $1}'`
28+
29+
SETTINGS=`echo "$SETTINGS" |
30+
tr 'A-Z' 'a-z' # lowercase`
2931

3032
for i in $SETTINGS ; do
3133
hidden=0
3234
## it sure would be nice to replace this with an sql "not in" statement
3335
for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do
34-
if [ "$i" = "$hidethis" ] ; then
36+
if [ "$hidethis" = "$i" ] ; then
3537
hidden=1
3638
fi
3739
done
38-
if [ "0" = "$hidden" ] ; then
39-
grep -i $i guc.c > /dev/null;
40-
if [ ! $? = 0 ] ; then
40+
if [ "$hidden" -eq 0 ] ; then
41+
grep -i $i guc.c > /dev/null
42+
if [ $? -ne 0 ] ; then
4143
echo "$i seems to be missing from guc.c";
4244
fi;
4345
fi
@@ -55,13 +57,13 @@ SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'`
5557
for i in $SETTINGS ; do
5658
hidden=0
5759
for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do
58-
if [ "$i" = "$hidethis" ] ; then
60+
if [ "$hidethis" = "$i" ] ; then
5961
hidden=1
6062
fi
6163
done
62-
if [ "0" = "$hidden" ] ; then
63-
grep -i $i postgresql.conf.sample > /dev/null;
64-
if [ ! $? = 0 ] ; then
64+
if [ "$hidden" -eq 0 ] ; then
65+
grep -i $i postgresql.conf.sample > /dev/null
66+
if [ $? -ne 0 ] ; then
6567
echo "$i seems to be missing from postgresql.conf.sample";
6668
fi
6769
fi

0 commit comments

Comments
 (0)