format.prl

来自「一个用在mips体系结构中的操作系统」· PRL 代码 · 共 51 行

PRL
51
字号
#!/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";

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?