| 1 | #!/bin/bash |
| 2 | PROJECT="DrumGizmo" |
| 3 | |
| 4 | function allfile() { |
| 5 | if [ "$USER" == "nemo" ] |
| 6 | then |
| 7 | NAME="Jonas Suhr Christensen"; EMAIL="[email protected]" |
| 8 | fi |
| 9 | if [ "$USER" == "deva" ] |
| 10 | then |
| 11 | NAME="Bent Bisballe Nyeng"; EMAIL="[email protected]" |
| 12 | fi |
| 13 | if [ "$USER" == "senator" ] |
| 14 | then |
| 15 | NAME="Lars Bisballe Jensen"; EMAIL="[email protected]" |
| 16 | fi |
| 17 | if [ "$USER" == "chaot" ] |
| 18 | then |
| 19 | NAME="André Nusser"; EMAIL="[email protected]" |
| 20 | fi |
| 21 | if [ "$DGUSER" == "glocke" ] |
| 22 | then |
| 23 | NAME="Christian Glöckner"; EMAIL="[email protected]" |
| 24 | fi |
| 25 | if [ "$USER" == "meka" ] |
| 26 | then |
| 27 | NAME="Goran Mekić"; EMAIL="[email protected]" |
| 28 | fi |
| 29 | |
| 30 | echo "/* -*- Mode: c++ -*- */" > $1; |
| 31 | echo "/***************************************************************************" >> $1; |
| 32 | echo " * $1" >> $1; |
| 33 | echo " *" >> $1 ; |
| 34 | echo " * `LANG=C date`" >> $1; |
| 35 | echo " * Copyright "`date +%Y | xargs`" $NAME" >> $1; |
| 36 | echo " * $EMAIL" >> $1; |
| 37 | echo " ****************************************************************************/" >> $1; |
| 38 | echo "" >> $1; |
| 39 | echo "/*" >> $1; |
| 40 | echo " * This file is part of $PROJECT." >> $1; |
| 41 | echo " *" >> $1; |
| 42 | echo " * $PROJECT is free software; you can redistribute it and/or modify" >> $1; |
| 43 | echo " * it under the terms of the GNU Lesser General Public License as published by" >> $1; |
| 44 | echo " * the Free Software Foundation; either version 3 of the License, or" >> $1; |
| 45 | echo " * (at your option) any later version." >> $1; |
| 46 | echo " *" >> $1; |
| 47 | echo " * $PROJECT is distributed in the hope that it will be useful," >> $1; |
| 48 | echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $1; |
| 49 | echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" >> $1; |
| 50 | echo " * GNU Lesser General Public License for more details." >> $1; |
| 51 | echo " *" >> $1; |
| 52 | echo " * You should have received a copy of the GNU Lesser General Public License" >> $1; |
| 53 | echo " * along with $PROJECT; if not, write to the Free Software" >> $1; |
| 54 | echo " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA." >> $1; |
| 55 | echo " */" >> $1; |
| 56 | } |
| 57 | |
| 58 | function ccfile() { |
| 59 | local hf=`echo -n $1 | cut -d'.' -f1`.h; |
| 60 | hfile $hf; |
| 61 | |
| 62 | allfile $1; |
| 63 | echo -n '#include "' >> $1; |
| 64 | echo -n $hf >> $1; |
| 65 | echo '"' >> $1; |
| 66 | echo '' >> $1; |
| 67 | } |
| 68 | |
| 69 | function hfile() { |
| 70 | allfile $1; |
| 71 | local hn=`echo $1 | tr 'a-z.' 'A-Z_'` |
| 72 | local pr=`echo $PROJECT | tr 'a-z.' 'A-Z_'` |
| 73 | echo "#pragma once" >> $1; |
| 74 | } |
| 75 | |
| 76 | if [ "$#" = "1" ]; then |
| 77 | if [ "CC" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then |
| 78 | ccfile $1; |
| 79 | fi; |
| 80 | if [ "H" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then |
| 81 | hfile $1; |
| 82 | fi; |
| 83 | else echo "Usage: $0 filename"; |
| 84 | fi; |