Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f850cb

Browse files
committed
Add script to find .c and .h files that are missing CVS PostgreSQL markers
and add them. Avoids third party files or those that would cause regressionfailures.
1 parent906f27d commit3f850cb

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

‎src/tools/add_cvs_markers

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
3+
# $PostgreSQL: pgsql/src/tools/add_cvs_markers,v 1.1 2008/06/15 21:46:02 adunstan Exp $
4+
5+
# Author: Andrew Dunstan
6+
7+
# Script to add PostgreSQL markers to source files that are lacking them.
8+
# currently only works for .c and .h files
9+
10+
# Needs a sed that understands the -i switch.
11+
# Really only tested on my Linux box.
12+
13+
# We try to avoid adding markers to third party files, or files that will
14+
# cause regression problems (e.g. some ecpg headers).
15+
16+
# If the file begins with a comment, we put the marker in there,
17+
# otherwise we add a new comment at the top of the file. This makes things
18+
# a bit prettier.
19+
20+
# This script should be run at the top of the source tree.
21+
# If we're in the tools directory, the script tries to take us to the
22+
# right spot.
23+
CWD=`pwd`
24+
test"`basename$CWD`" ="tools"&&cd ../..
25+
26+
# need a dummy file in case we don't find any with missing markers,
27+
# to suppress messages about sed not finding any input files
28+
touch dummy
29+
30+
# first process the files that already start with a comment:
31+
32+
find.\(\( -name'libstemmer' -o -name'expected' -o -name'ppport.h' \
33+
-o -name'regression.h' -o -name'sql3types.h' -o -name'sqlca.h'\) \
34+
-prune\) -o\( -name'*.[ch]'\)\( -exec grep -q'\$PostgreSQL' {}\; \
35+
-o -print\)| \
36+
{whileread file;do
37+
head -n 1<$file| grep -q'^/\*'&&echo$file
38+
done;echo dummy;}| \
39+
xargs -l sed -i -e'1s/^\// /' -e'1i/*\n * $PostgreSQL: pgsql/src/tools/add_cvs_markers,v 1.1 2008/06/15 21:46:02 adunstan Exp $ \n *'
40+
41+
# now all the rest (i.e. the files that don't start with a comment)
42+
43+
{ find.\(\( -name'libstemmer' -o -name'expected' -o -name'ppport.h' \
44+
-o -name'regression.h' -o -name'sql3types.h' -o -name'sqlca.h'\) \
45+
-prune\) -o\( -name'*.[ch]'\)\( -exec grep -q'\$PostgreSQL' {}\; \
46+
-o -print\);echo dummy;}| \
47+
xargs -l sed -i -e'1i/*\n * $PostgreSQL: pgsql/src/tools/add_cvs_markers,v 1.1 2008/06/15 21:46:02 adunstan Exp $ \n */'
48+
49+
rm -f dummy
50+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp