+# Return: Formatted link (String)
+
+sub equal_url($$)
+{
+ my ($root,$path) = @_;
+ my $url;
+
+ $root =~ s!/$!!;
+ $path =~ s!^/!!;
+ $url = $root."/".$path;
+
+ return $url;
+}
+
+# file_name()
+#
+# Return the last part of a path
+#
+# Params: Path
+#
+# Return: Last part of the path
+
+sub file_name($)
+{
+ my $path = shift;
+ $path =~ tr!\\!/!;
+
+ unless($path eq "/")
+ {
+ $path = substr($path,0,-1) if($path =~ m!/$!);
+ $path = substr($path,rindex($path,"/")+1);
+ }
+
+ return $path;
+}
+
+# mode_string()
+#
+# Convert a binary file mode string into a human
+# readable string (rwxr-x-r-x)
+#
+# Params: Binary file mode string
+#
+# Return: Humand readable mode string
+
+sub mode_string($)
+{
+ my $mode = shift;
+
+ my $string = "";
+
+ # Owner
+ $string .= (($mode & 0x0100) ? 'r' : '-') .
+ (($mode & 0x0080) ? 'w' : '-') .
+ (($mode & 0x0040) ?
+ (($mode & 0x0800) ? 's' : 'x' ) :
+ (($mode & 0x0800) ? 'S' : '-')
+ );
+
+ # Group
+ $string .= (($mode & 0x0020) ? 'r' : '-') .
+ (($mode & 0x0010) ? 'w' : '-') .
+ (($mode & 0x0008) ?
+ (($mode & 0x0400) ? 's' : 'x') :
+ (($mode & 0x0400) ? 'S' : '-')
+ );
+
+ # World
+ $string .= (($mode & 0x0004) ? 'r' : '-') .
+ (($mode & 0x0002) ? 'w' : '-') .
+ (($mode & 0x0001) ?
+ (($mode & 0x0200) ? 't' : 'x' ) :
+ (($mode & 0x0200) ? 'T' : '-')
+ );
+
+ return $string;
+}
+
+# upper_path()