format.prl
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/local/bin/perl5 -w
#
# Copyright (C) 1996-1998 by the Board of Trustees
# of Leland Stanford Junior University.
#
# This file is part of the SimOS distribution.
# See LICENSE file for terms of the license.
#
# First check for any directory aliases in the environment, if necessary
$string = "@ARGV";
if ($string =~ m!/!){
while (($var, $value) = each(%ENV)) {
if ($value =~ m!/!) {
if (($var ne "PWD") && ($var ne "CONFIGDIR") &&
($var !~ /PATH/) && ($var ne "TERMCAP")) {
$alias{$value} = $var;
}
}
}
# Then substitute them if it's applicable
foreach $dir (reverse(sort(keys(%alias)))) {
foreach $item (@ARGV) {
if ($item =~ /$dir/) {
$item =~ s/$dir/\$($alias{$dir})/;
}
}
}
}
$line_length = 79;
$tab = 15; # Determined by Makefile
$i = 0;
grep($lengths[$i++] = length($_) + 1, @ARGV); # for perl4
# @lengths = map { length($_) + 1 } @ARGV; # for perl5
$len = $tab;
for ($i = 0; $i < @ARGV; $i++) {
$len += $lengths[$i];
if ($len > $line_length) {
print "\n", " " x $tab;
$len = $tab + $lengths[$i];
}
print "$ARGV[$i] ";
}
print "\n";