3 #=======================================================================
5 # File ID: 9867d624-f742-11dd-910a-000475e441b9
9 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
35 $progname =~ s/^.*\/(.*?)$/$1/;
38 my $id_date = $rcs_id;
39 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/;
41 push(@main::version_array
, $rcs_id);
43 Getopt
::Long
::Configure
("bundling");
46 "debug" => \
$Opt{'debug'},
47 "help|h" => \
$Opt{'help'},
48 "verbose|v+" => \
$Opt{'verbose'},
49 "version" => \
$Opt{'version'},
51 ) || die("$progname: Option error. Use -h for help.\n");
53 $Opt{'debug'} && ($Debug = 1);
54 $Opt{'help'} && usage
(0);
55 if ($Opt{'version'}) {
60 my $DIGIT = '0-9\.\-\+';
65 my ($Lat, $Lon, $Name, $Phone) = ("", "", "", "");
66 if (/^([$DIGIT]+),([$DIGIT]+),(.*) - (.*?)$/) {
67 ($Lon, $Lat, $Name, $Phone) =
68 (txt_to_xml
($1), txt_to_xml
($2), txt_to_xml
($3), txt_to_xml
($4));
70 <wpt lat="$Lat" lon="$Lon">
72 <cmt>$Name - $Phone</cmt>
76 warn(sprintf("%s: Unknown line: \"%s\"\n", $progname, chomp($_)));
83 # Convert plain text to XML {{{
95 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
99 creator="csv2gpx - http://svn.sunbase.org/repos/utils/trunk/csv2gpx"
100 xmlns="http://www.topografix.com/GPX/1/1"
101 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
102 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
109 # Print program version {{{
110 for (@main::version_array
) {
117 # Send the help message to stdout {{{
120 if ($Opt{'verbose'}) {
126 Usage: $progname [options] [file [files [...]]]
133 Increase level of verbosity. Can be repeated.
135 Print version information.
137 Print debugging messages.
145 # Print a status message to stderr based on verbosity level {{{
146 my ($verbose_level, $Txt) = @_;
148 if ($Opt{'verbose'} >= $verbose_level) {
149 print(STDERR
"$progname: $Txt\n");
155 # Print a debugging message {{{
157 my @call_info = caller;
158 chomp(my $Txt = shift);
159 my $File = $call_info[1];
161 $File =~ s
#^.*/(.*?)$#$1#;
162 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
169 # Plain Old Documentation (POD) {{{
183 [options] [file [files [...]]]
193 =item B<-h>, B<--help>
195 Print a brief help summary.
197 =item B<-v>, B<--verbose>
199 Increase level of verbosity. Can be repeated.
203 Print version information.
207 Print debugging messages.
217 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
221 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
222 This is free software; see the file F<COPYING> for legalese stuff.
226 This program is free software; you can redistribute it and/or modify it
227 under the terms of the GNU General Public License as published by the
228 Free Software Foundation; either version 2 of the License, or (at your
229 option) any later version.
231 This program is distributed in the hope that it will be useful, but
232 WITHOUT ANY WARRANTY; without even the implied warranty of
233 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
234 See the GNU General Public License for more details.
236 You should have received a copy of the GNU General Public License along
237 with this program; if not, write to the Free Software Foundation, Inc.,
238 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
246 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :