about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2019-12-07 01:41:39 +0100
committerAlexander Barton <alex@barton.de>2019-12-07 01:41:39 +0100
commitb03fcaab5aaa07d943561dca6948358f9dc51d4c (patch)
treed286619057e90777d5f2742db172507fd94b1016
parent70eb1ee57da9cd0d09d94c05e52308ec2e5ba45b (diff)
downloadngircd-b03fcaab5aaa07d943561dca6948358f9dc51d4c.tar.gz
ngircd-b03fcaab5aaa07d943561dca6948358f9dc51d4c.zip
contrib/ngindent.sh: Enhance and rename script
Add more GNU indent options for better results, and add the ".sh" suffix
to bring this script in line with the others in the contrib/ folder.
-rw-r--r--contrib/README4
-rwxr-xr-xcontrib/ngindent17
-rwxr-xr-xcontrib/ngindent.sh46
3 files changed, 48 insertions, 19 deletions
diff --git a/contrib/README b/contrib/README
index e7285bf7..333cf61c 100644
--- a/contrib/README
+++ b/contrib/README
@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2013 Alexander Barton and Contributors.
+               (c)2001-2019 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -18,7 +18,7 @@ MacOSX/
  - Project files for XCode, the "project builder" of Apple Mac OS X.
 	- de.barton.ngircd.plist[.tmpl]: launchd(8) property list.
 
-ngindent
+ngindent.sh
  - Script to indent the code of ngIRCd in the "standard way".
 
 ngircd-bsd.sh
diff --git a/contrib/ngindent b/contrib/ngindent
deleted file mode 100755
index 69636a4b..00000000
--- a/contrib/ngindent
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl"
-
-# check if indent(1) is available
-command -v indent >/dev/null 2>&1 && INDENT="indent"
-command -v gindent >/dev/null 2>&1 && INDENT="gindent"
-command -v gnuindent >/dev/null 2>&1 && INDENT="gnuindent"
-
-if [ -z "$INDENT" ]; then
-	echo "Error: GNU \"indent\" not found!"
-	exit 1
-fi
-
-$INDENT -v $INDENTARGS "$@"
-
-# -eof-
diff --git a/contrib/ngindent.sh b/contrib/ngindent.sh
new file mode 100755
index 00000000..57cbf81e
--- /dev/null
+++ b/contrib/ngindent.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors
+#
+# 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.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+# This script uses GNU indent(1) to format C source code files of ngIRCd.
+# Usage:
+#  - ./contrib/ngindent.sh [<file> [<file> [...]]]
+#  - cat ./src/ngircd/<c_file> | ./contrib/ngindent.sh
+
+# Use a coding-style based on "Kernighan & Ritchie" (-kr):
+INDENTARGS="-kr
+	-bad
+	-c3
+	-cd41
+	-i8
+	-l80
+	-ncs
+	-psl
+	-sob
+	-ss
+	-ts8
+	-blf
+	-il0
+"
+
+# check if indent(1) is available
+command -v indent >/dev/null 2>&1 && INDENT="indent"
+command -v gindent >/dev/null 2>&1 && INDENT="gindent"
+command -v gnuindent >/dev/null 2>&1 && INDENT="gnuindent"
+
+if [ -z "$INDENT" ]; then
+	echo "Error: GNU \"indent\" not found!"
+	exit 1
+fi
+
+# shellcheck disable=SC2086
+$INDENT -v $INDENTARGS "$@"
+
+# -eof-