MSWSP: give names to PropertySet ids
[wireshark-wip.git] / tools / textify.sh
blobbf88a9497ff41ec4921faf49a09543e6ee430729
1 #!/bin/bash
3 # Text file conversion script for packaging on Windows
5 # This script copies a text file from a source to a destination,
6 # converting line endings and adding a ".txt" filename extension
7 # if needed. If the destination is a directory the source file
8 # name is used. Newer files will not be overwritten.
10 # The destination file should be double-clickable and usable
11 # when Notepad is the default editor.
13 # Copyright 2013 Gerald Combs <gerald@wireshark.org>
15 # $Id$
17 # Wireshark - Network traffic analyzer
18 # By Gerald Combs <gerald@wireshark.org>
19 # Copyright 1998 Gerald Combs
21 # This program is free software; you can redistribute it and/or
22 # modify it under the terms of the GNU General Public License
23 # as published by the Free Software Foundation; either version 2
24 # of the License, or (at your option) any later version.
26 # This program is distributed in the hope that it will be useful,
27 # but WITHOUT ANY WARRANTY; without even the implied warranty of
28 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 # GNU General Public License for more details.
31 # You should have received a copy of the GNU General Public License
32 # along with this program; if not, write to the Free Software
33 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 SRC="$1"
36 DST="$2"
38 err_exit () {
39 for str in "$@" ; do
40 echo "ERROR: $str"
41 done
42 echo "Usage:"
43 echo " $0 <source file> <destination file>"
44 echo ""
45 exit 1
48 if [ -z "$SRC" -o -z "$DST" ] ; then
49 err_exit
52 if [ ! -r "$SRC" ] ; then
53 err_exit "Can't read $SRC"
54 fi
56 if [ -f "$DST" -a "$DST" -nt "SRC" ]; then
57 exit 0
60 if [ -d "$DST" ] ; then
61 DSTBASE=`basename "$SRC" txt`
62 DST="$DST/$DSTBASE.txt"
63 else
64 DSTDIR=`dirname "$DST"`
65 DSTBASE=`basename "$DST" txt`
66 DST="$DSTDIR/$DSTBASE.txt"
69 cp "$SRC" "$DST"
70 u2d "$DST"