File: mkcompdate

package info (click to toggle)
vrweb 1.5-5.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 15,124 kB
  • ctags: 27,485
  • sloc: cpp: 134,333; ansic: 95,670; sh: 1,072; asm: 712; makefile: 610; pascal: 536; perl: 347; csh: 26
file content (44 lines) | stat: -rwxr-xr-x 988 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
#
# mkcompdate
# usage: mkcompdate SRCDIR
# (e.g. mkcompdate $(SRC) in Imakefile)
# updates $SRCDIR/compdate.C if necessary
#
# created: jschipf, mpichler, 19960618
# changed: mpichler, 19960618
#
# $Id: mkcompdate,v 1.1 1996/06/19 13:34:47 mpichler Exp $

SRC="$1"
if [ ! -d "$SRC" ]
then
  echo "usage: mkcompdate SRCDIR"
  exit 1
fi

# "pretty" date format (as pretty as you can)
case "$CPU" in
  SUN4* | PMAX* )
    DATEFORMAT='+%a %d %h %y'
  ;;
  * )
    DATEFORMAT='+%a %e %b %Y'
  ;;
esac

tmpfile=.compdate."$CPU"

# date format for control file (supported on all machines)
date '+%y%m%d' > $tmpfile

if diff $tmpfile $SRC/.compdate >&2 2> /dev/null && [ -f $SRC/compdate.C ]
then
  echo "compdate unchanged:" `cat $SRC/.compdate`
  rm $tmpfile
else
  mv $tmpfile $SRC/.compdate
  echo '#include "compdate.h"' > $SRC/compdate.C
  echo 'const char* compDate () { return "'`date "$DATEFORMAT"`'"; }' >> $SRC/compdate.C
  echo "upgraded compdate:" `cat $SRC/.compdate`
fi