aboutsummaryrefslogtreecommitdiff
path: root/lib/enca/topline.sh
blob: f133c67abb4158cbecf7647a526617afda4fd047 (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
#! /bin/sh
# topline.sh.
# update top lines in docs.

# get version number and current date
ver=$(grep PACKAGE_VERSION config.h | sed 's/.*VERSION *"\(.*\)".*/\1/')
if test -z "$ver"; then
  echo "Cannot get version from config.h" 1>&2
  exit 1
fi
date=$(date +"%Y-%m-%d")
# update
shopt -s nullglob
if test -z "$@"; then
  files=$(grep -l '^#=====' * 2>/dev/null)
else
  files=$@
fi
for fnm in $files; do
  echo "Updating $fnm..." 1>&2
  { echo "#============================================================================"
    echo "# Enca v$ver ($date)  guess and convert encoding of text files"
    echo "# Copyright (C) 2000-2003 David Necas (Yeti) <yeti@physics.muni.cz>"
    echo "# Copyright (C) 2009 Michal Cihar <michal@cihar.com>"
    echo "#============================================================================"
    sed -e '1,5 d' "$fnm"
  } > tmp$$
  mv -f tmp$$ $fnm
done
rm -f tmp$$