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 # Wireshark - Network traffic analyzer
16 # By Gerald Combs <gerald@wireshark.org>
17 # Copyright 1998 Gerald Combs
19 # This program is free software; you can redistribute it and/or
20 # modify it under the terms of the GNU General Public License
21 # as published by the Free Software Foundation; either version 2
22 # of the License, or (at your option) any later version.
24 # This program is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write to the Free Software
31 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
41 echo " $0 <source file> <destination file>"
46 if [ -z "$SRC" -o -z "$DST" ] ; then
50 if [ ! -r "$SRC" ] ; then
51 err_exit "Can't read $SRC"
54 if [ -f "$DST" -a "$DST" -nt "SRC" ]; then
58 if [ -d "$DST" ] ; then
59 DSTBASE=`basename "$SRC" txt`
60 DST="$DST/$DSTBASE.txt"
62 DSTDIR=`dirname "$DST"`
63 DSTBASE=`basename "$DST" txt`
64 DST="$DSTDIR/$DSTBASE.txt"