Fix build by #if 0 out unused de_sgsap_tmsi() function.
[obnox/wireshark/wip.git] / tools / textify.sh
1 #!/bin/bash
2 #
3 # $Id$
4 #
5 # Text file conversion script for packaging on Windows
6 #
7 # This script copies a text file from a source to a destination,
8 # converting line endings and adding a ".txt" filename extension
9 # if needed. If the destination is a directory the source file
10 # name is used. Newer files will not be overwritten.
11 #
12 # The destination file should be double-clickable and usable
13 # when Notepad is the default editor.
14
15 SRC="$1"
16 DST="$2"
17
18 err_exit () {
19     for str in "$@" ; do
20         echo "ERROR: $str"
21     done
22     echo "Usage:"
23     echo "  $0 <source file> <destination file>"
24     echo ""
25     exit 1
26 }
27
28 if [ -z "$SRC" -o -z "$DST" ] ; then
29     err_exit
30 fi
31
32 if [ ! -r "$SRC" ] ; then
33     err_exit "Can't read $SRC"
34 fi    
35
36 if [ -f "$DST" -a "$DST" -nt "SRC" ]; then
37     exit 0
38 fi
39
40 if [ -d "$DST" ] ; then
41     DSTBASE=`basename "$SRC" txt`
42     DST="$DST/$DSTBASE.txt"
43 else
44     DSTDIR=`dirname "$DST"`
45     DSTBASE=`basename "$DST" txt`
46     DST="$DSTDIR/$DSTBASE.txt"
47 fi
48
49 cp "$SRC" "$DST"
50 u2d "$DST"