summaryrefslogtreecommitdiff
path: root/tools/add_file
blob: be232fb8cc5ced65206fb9af7706be5078d3f842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
PROJECT="DrumGizmo"

function allfile() {
  if [ "$USER" == "nemo" ]
  then
    NAME="Jonas Suhr Christensen"; EMAIL="jsc@umbraculum.org"
  fi
  if [ "$USER" == "deva" ]
  then
    NAME="Bent Bisballe Nyeng"; EMAIL="deva@aasimon.org"
  fi
  if [ "$USER" == "senator" ]
  then
    NAME="Lars Bisballe Jensen"; EMAIL="elsenator@gmail.com"
  fi
  if [ "$USER" == "chaot" ]
  then
    NAME="André Nusser"; EMAIL="andre.nusser@googlemail.com"
  fi
  if [ "$DGUSER" == "glocke" ]
  then
    NAME="Christian Glöckner"; EMAIL="cgloeckner@freenet.de"
  fi
  if [ "$USER" == "meka" ]
  then
    NAME="Goran Mekić"; EMAIL="meka@tilda.center"
  fi
  if [ "$USER" == "savo" ]
  then
    NAME="Sander Vocke"; EMAIL="sandervocke@gmail.com"
  fi

  echo "/* -*- Mode: c++ -*- */" > $1;
  echo "/***************************************************************************" >> $1;
  echo " *            $1" >> $1;
  echo " *" >> $1 ;
  echo " *  `LANG=C date`" >> $1;
  echo " *  Copyright "`date +%Y | xargs`" $NAME" >> $1;
  echo " *  $EMAIL" >> $1;
  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 Lesser General Public License as published by" >> $1;
  echo " *  the Free Software Foundation; either version 3 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 Lesser General Public License for more details." >> $1;
  echo " *" >> $1;
  echo " *  You should have received a copy of the GNU Lesser 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;
  local hn=`echo $1 | tr 'a-z.' 'A-Z_'`
  local pr=`echo $PROJECT | tr 'a-z.' 'A-Z_'`
  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;