Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 5404c6b
  • /
  • util
  • /
  • dirname.pl
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:d7a66d96accf22be920e8b263d61ee6af4b0e120
directory badge Iframe embedding
swh:1:dir:eb83acc5db8716318e6ef6b9b873a581cc1d0395
dirname.pl
#!/usr/local/bin/perl

if ($#ARGV < 0) {
    die "dirname.pl: too few arguments\n";
} elsif ($#ARGV > 0) {
    die "dirname.pl: too many arguments\n";
}

my $d = $ARGV[0];

if ($d =~ m|.*/.*|) {
    $d =~ s|/[^/]*$||;
} else {
    $d = ".";
}

print $d,"\n";
exit(0);

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top