From 45a64ed7d5252a35f9aac30f1a758549eaf1d405 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20A=2E=20Holm?= Date: Fri, 13 Mar 2009 07:10:57 +0100 Subject: [PATCH] =?utf8?q?*=20/trunk/vg=20=20=20Den=20er=20forfremmet=20ti?= =?utf8?q?l=20Perl,=20det=20ble=20for=20kr=C3=B8kkete=20=C3=A5=20styre=20p?= =?utf8?q?=C3=A5=20i=20bash=20med=20=20=20de=20greiene=20som=20skal=20legg?= =?utf8?q?es=20inn.=20Voldsomt=20provisoriske=20greier,=20men=20det=20=20?= =?utf8?q?=20funker.=20Forel=C3=B8pig=20er=20det=20den=20samme=20funksjona?= =?utf8?q?liteten=20som=20var,=20med=20=20=20unntak=20av=20at=20den=20leve?= =?utf8?q?rer=20ting=20i=20XML=20til=20suuid.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit af2d2fe2-0f95-11de-a023-000475e441b9 git-svn-id: svn+ssh://svnhost/utils@3078 ddca7c6a-6bd8-0310-abd8-a0f6a7c394c1 --- vg | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 248 insertions(+), 32 deletions(-) rewrite vg (64%) diff --git a/vg b/vg dissimilarity index 64% index 4c37fb8..f650317 100755 --- a/vg +++ b/vg @@ -1,32 +1,248 @@ -#!/bin/bash - -# $Id$ -# File ID: 58ece940-08f3-11de-ab14-000475e441b9 - -cmdl=$* -uuid=`suuid -w eo -t vg -c "vg $*"` || { echo vg: suuid error >&1; exit 1; } -if [ "$1" = "-t" ]; then - shift - (echo "# Session ID: $uuid"; gpst -o csv -rt -e -d -t "$@") | rmspcall | uniq >/tmp/vg-t.tmp - cat </tmp/vg-t-cmd.tmp -# Session ID: $uuid -set mouse -# load "/tmp/label.gnuplot" -set zdata time -# set timefmt "%Y-%m-%dT%H:%M:%SZ" -set timefmt "%s" -splot "/tmp/vg-t.tmp" using 2:3:1 w l palette -pause -1 "Trykk Enter..." -END - gnuplot -persist /tmp/vg-t-cmd.tmp -else - (echo "# Session ID: $uuid"; gpst -o clean -ret -d -t "$@") | rmspcall | uniq >/tmp/vg.tmp - cat </tmp/vg-cmd.tmp -# Session ID: $uuid -set mouse -# load "/tmp/label.gnuplot" -splot "/tmp/vg.tmp" w l palette -pause -1 "Trykk Enter..." -END - gnuplot -persist /tmp/vg-cmd.tmp -fi +#!/usr/bin/perl -w + +#======================================================================= +# $Id$ +# File ID: 58ece940-08f3-11de-ab14-000475e441b9 +# View GPX files in gnuplot(1) +# +# Character set: UTF-8 +# ©opyleft 2009– Øyvind A. Holm +# License: GNU General Public License version 2 or later, see end of +# file for legal stuff. +#======================================================================= + +BEGIN { + our @version_array; +} + +use strict; +use Getopt::Long; + +$| = 1; + +our $Debug = 0; + +our %Opt = ( + + 'debug' => 0, + 'help' => 0, + 'time' => 0, + 'verbose' => 0, + 'version' => 0, + +); + +our $progname = $0; +$progname =~ s/^.*\/(.*?)$/$1/; + +my $rcs_id = '$Id$'; +my $id_date = $rcs_id; +$id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/; + +push(@main::version_array, $rcs_id); +my @cmdl = @ARGV; + +Getopt::Long::Configure("bundling"); +GetOptions( + + "debug" => \$Opt{'debug'}, + "help|h" => \$Opt{'help'}, + "time|t" => \$Opt{'time'}, + "verbose|v+" => \$Opt{'verbose'}, + "version" => \$Opt{'version'}, + +) || die("$progname: Option error. Use -h for help.\n"); + +$Opt{'debug'} && ($Debug = 1); +$Opt{'help'} && usage(0); +if ($Opt{'version'}) { + print_version(); + exit(0); +} + +my $cmdl_str = join(" ", @cmdl); +my $uuid=`suuid -w eo -t vg --raw -c " $cmdl_str "` || die("$progname: suuid error"); + +if ($Opt{'time'}) { + my $dat_file = "/tmp/vg-t.tmp"; + open(FP, ">$dat_file") || die("$progname: $dat_file: Cannot open file for write: $!\n"); + print(FP "# Session ID: $uuid\n"); + my @gpst_array = ("gpst", "-o", "csv", "-rt", "-e", "-d", "-t", @ARGV, "|", "rmspcall", "|", "uniq"); + print(FP `@gpst_array`); + close(FP); + my $cmd_file = "/tmp/vg-t-cmd.tmp"; + open(FP, ">$cmd_file") || die("$progname: $cmd_file: Cannot open file for write: $!\n"); + print(FP <$dat_file") || die("$progname: $dat_file: Cannot open file for write: $!\n"); + print(FP "# Session ID: $uuid\n"); + my @gpst_array = ("gpst", "-o", "clean", "-ret", "-d", "-t", @ARGV, "|", "rmspcall", "|", "uniq"); + print(FP `@gpst_array`); + close(FP); + my $cmd_file = "/tmp/vg-cmd.tmp"; + open(FP, ">$cmd_file") || die("$progname: $cmd_file: Cannot open file for write: $!\n"); + print(FP <= $verbose_level) { + print(STDERR "$progname: $Txt\n"); + } + # }}} +} # msg() + +sub D { + # Print a debugging message {{{ + $Debug || return; + my @call_info = caller; + chomp(my $Txt = shift); + my $File = $call_info[1]; + $File =~ s#\\#/#g; + $File =~ s#^.*/(.*?)$#$1#; + print(STDERR "$File:$call_info[2] $$ $Txt\n"); + return(""); + # }}} +} # D() + +__END__ + +# Plain Old Documentation (POD) {{{ + +=pod + +=head1 NAME + + + +=head1 REVISION + +$Id$ + +=head1 SYNOPSIS + + [options] [file [files [...]]] + +=head1 DESCRIPTION + + + +=head1 OPTIONS + +=over 4 + +=item B<-h>, B<--help> + +Print a brief help summary. + +=item B<-v>, B<--verbose> + +Increase level of verbosity. Can be repeated. + +=item B<--version> + +Print version information. + +=item B<--debug> + +Print debugging messages. + +=back + +=head1 BUGS + + + +=head1 AUTHOR + +Made by Øyvind A. Holm Ssunny@sunbase.orgE>. + +=head1 COPYRIGHT + +Copyleft © Øyvind A. Holm Esunny@sunbase.orgE +This is free software; see the file F for legalese stuff. + +=head1 LICENCE + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2 of the License, or (at your +option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +=head1 SEE ALSO + +=cut + +# }}} + +# vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w : +# End of file $Id$ -- 2.11.4.GIT