summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2022-04-23 22:02:06 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2022-05-26 18:41:20 +0200
commite5d35d6b643dbb8ecbd3ece2a0d84ec93cadbfc1 (patch)
treecedeebe12a5062e1c7d4c644a54297203e29e59e /tools
parent54860b9c436f31cce71afd180e03b4bf93512b58 (diff)
First contact
Diffstat (limited to 'tools')
-rwxr-xr-xtools/add_file64
1 files changed, 64 insertions, 0 deletions
diff --git a/tools/add_file b/tools/add_file
new file mode 100755
index 0000000..d64275a
--- /dev/null
+++ b/tools/add_file
@@ -0,0 +1,64 @@
+#!/bin/bash
+PROJECT="Qookie"
+
+function allfile() {
+ WHO="`whoami`"
+
+ echo "/* -*- c++ -*- */" > $1;
+ echo "/***************************************************************************" >> $1;
+ echo " * $1" >> $1;
+ echo " *" >> $1 ;
+ echo " * `date`" >> $1;
+ echo -n " * Copyright " >> $1
+ echo -n `date +%Y | xargs` >> $1
+ if [ "$WHO" == "deva" ];
+ then
+ echo " Bent Bisballe Nyeng" >> $1;
+ echo " * deva@aasimon.org" >> $1;
+ fi
+ echo " ****************************************************************************/" >> $1;
+ echo "" >> $1;
+ echo "/*" >> $1;
+ echo " * This file is part of $PROJECT." >> $1;
+ echo " *" >> $1;
+ echo " * $PROJECT is free software; you can redistribute it and/or modify" >> $1;
+ echo " * it under the terms of the GNU General Public License as published by" >> $1;
+ echo " * the Free Software Foundation; either version 2 of the License, or" >> $1;
+ echo " * (at your option) any later version." >> $1;
+ echo " *" >> $1;
+ echo " * $PROJECT is distributed in the hope that it will be useful," >> $1;
+ echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $1;
+ echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" >> $1;
+ echo " * GNU General Public License for more details." >> $1;
+ echo " *" >> $1;
+ echo " * You should have received a copy of the GNU General Public License" >> $1;
+ echo " * along with $PROJECT; if not, write to the Free Software" >> $1;
+ echo " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA." >> $1;
+ echo " */" >> $1;
+}
+
+function ccfile() {
+ local hf=`echo -n $1 | cut -d'.' -f1`.h;
+ hfile $hf;
+
+ allfile $1;
+ echo -n '#include "' >> $1;
+ echo -n $hf >> $1;
+ echo '"' >> $1;
+ echo '' >> $1;
+}
+
+function hfile() {
+ allfile $1;
+ echo "#pragma once" >> $1;
+}
+
+if [ "$#" = "1" ]; then
+if [ "CC" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then
+ ccfile $1;
+fi;
+if [ "H" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then
+ hfile $1;
+fi;
+else echo "Usage: $0 filename";
+fi;