Added -e option to escape back-slashes in output.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
eval 'exec perl -S -w $0 ${1+"$@"}' # -*- Mode: perl -*-
|
||||
if 0;
|
||||
#*************************************************************************
|
||||
# Copyright (c) 2008 The University of Chicago, as Operator of Argonne
|
||||
# Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
|
||||
# National Laboratory.
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
@@ -11,14 +11,33 @@ eval 'exec perl -S -w $0 ${1+"$@"}' # -*- Mode: perl -*-
|
||||
|
||||
# Determines an absolute pathname for its argument,
|
||||
# which may be either a relative or absolute path and
|
||||
# might have trailing parts that don't exist yet.
|
||||
# might have trailing directory names that don't exist yet.
|
||||
# The -e option escapes any back-slashes by doubling them.
|
||||
|
||||
use strict;
|
||||
|
||||
use FindBin qw($Bin);
|
||||
use lib "$Bin/../../lib/perl";
|
||||
|
||||
use Getopt::Std;
|
||||
use EPICS::Path;
|
||||
|
||||
print AbsPath(shift), "\n";
|
||||
our ($opt_e);
|
||||
|
||||
$Getopt::Std::OUTPUT_HELP_VERSION = 1;
|
||||
getopts('e') or &HELP_MESSAGE;
|
||||
&HELP_MESSAGE unless @ARGV == 1;
|
||||
|
||||
my $path = AbsPath(shift);
|
||||
|
||||
$path =~ s/\\/\\\\/gx if $opt_e;
|
||||
|
||||
print "$path\n";
|
||||
|
||||
|
||||
sub HELP_MESSAGE {
|
||||
print STDERR <<EOF;
|
||||
Usage: fullPathName.pl [-e] filepath
|
||||
EOF
|
||||
exit 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user