From 27b8143944dc0585597bdaa3ae5e5b49a4760def Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 5 Jun 1999 19:09:48 +0000 Subject: Hi, I have updated my contrib code for version 6.5. In the attachment you will find the directories array, datetime, miscutil, string, tools and userlocks which replace the corresponding directories under contrib. In contrib/tools you will find some developement scripts which I use while hacking the sources. I hope they will be useful for some other people. I have also added a contrib/Makefile which tries to compile and install all the contribs. Unfortunately many of them don't have a Makefile or don't compile cleanly. -- Massimo Dal Zotto --- contrib/tools/Makefile | 21 ++++++++++++++++ contrib/tools/add-emacs-variables | 28 ++++++++++++++++++++++ contrib/tools/find-sources | 50 +++++++++++++++++++++++++++++++++++++++ contrib/tools/make-tags | 9 +++++++ 4 files changed, 108 insertions(+) create mode 100644 contrib/tools/Makefile create mode 100755 contrib/tools/add-emacs-variables create mode 100755 contrib/tools/find-sources create mode 100755 contrib/tools/make-tags (limited to 'contrib/tools') diff --git a/contrib/tools/Makefile b/contrib/tools/Makefile new file mode 100644 index 0000000000..95e97d72ba --- /dev/null +++ b/contrib/tools/Makefile @@ -0,0 +1,21 @@ +#------------------------------------------------------------------------- +# +# Makefile -- +# +# Makefile for contrib tools. +# +#------------------------------------------------------------------------- + +PGDIR = ../.. +SRCDIR = $(PGDIR)/src + +include $(SRCDIR)/Makefile.global + +all: + +install: + +clean: + rm -f *~ + +distclean: clean diff --git a/contrib/tools/add-emacs-variables b/contrib/tools/add-emacs-variables new file mode 100755 index 0000000000..7b50aef659 --- /dev/null +++ b/contrib/tools/add-emacs-variables @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Add local variables to C sources files to set emacs C style to 4-space tabs. +# +# Usage: cd $PG_HOME && add-emacs-variables `find . -name \*.[chy] -print` + +for f in $*; do + if [ -L $f ] || grep -q '^ \* Local Variables:' $f; then + continue + fi + echo $f + touch -r $f /tmp/.add-local-variables.$$ + cat <<- ' EOF' >> $f + + /* + * Local Variables: + * tab-width: 4 + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ + EOF + touch -r /tmp/.add-local-variables.$$ $f +done + +rm -f /tmp/.add-local-variables.$$ + +# end of file diff --git a/contrib/tools/find-sources b/contrib/tools/find-sources new file mode 100755 index 0000000000..6d4c5ae60e --- /dev/null +++ b/contrib/tools/find-sources @@ -0,0 +1,50 @@ +#!/bin/echo Usage: source +# +# Set the shell variables files, cfiles, hfiles, yfiles and sfiles with +# the names of all .c, .h, .y, and .S files in current directory tree. +# Define also some shell functions to grep the files. Typical usage is: +# +# $ cd src/ +# $ source ../contrib/tools/find-sources +# $ gh BLCKSZ # grep BLCKSZ in .h files +# $ gcl MAXTUPLEN # list all .c files containing MAXTUPLEN +# +# THIS SCRIPT MUST BE SOURCED FROM BASH. +# +# Copyright (C) 1999 Massimo Dal Zotto +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + +# Build the file lists +dir=${1-`pwd`}/ +cfiles=`find $dir -name \*.c | sort` +hfiles=`find $dir -name \*.h | sort` +yfiles=`find $dir -name \*.y | sort` +sfiles=`find $dir -name \*.S | sort` +files="$hfiles $cfiles $yfiles $sfiles" + +# Define some functions to grep the files in the lists +function g() { grep -- "$*" $files /dev/null; } +function gc() { grep -- "$*" $cfiles /dev/null; } +function gh() { grep -- "$*" $hfiles /dev/null; } +function gy() { grep -- "$*" $yfiles /dev/null; } +function gS() { grep -- "$*" $sfiles /dev/null; } +function gl() { grep -l -- "$*" $files /dev/null; } +function gcl() { grep -l -- "$*" $cfiles /dev/null; } +function ghl() { grep -l -- "$*" $hfiles /dev/null; } +function gyl() { grep -l -- "$*" $yfiles /dev/null; } +function gSl() { grep -l -- "$*" $sfiles /dev/null; } + +# end of file diff --git a/contrib/tools/make-tags b/contrib/tools/make-tags new file mode 100755 index 0000000000..b5b606314a --- /dev/null +++ b/contrib/tools/make-tags @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Makes an emacs tagfile for all .[chS] and .el files in the current +# directory tree. + +etags $(find . -name \*.h) 2>/dev/null || true +etags -a $(find . -name \*.c) 2>/dev/null || true +etags -a $(find . -name \*.S) 2>/dev/null || true +etags -a $(find . -name \*.el) 2>/dev/null || true -- cgit v1.2.1