⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmuegel

📁 早期freebsd实现
💻
📖 第 1 页 / 共 5 页
字号:
X               {X                  push (@current_leftovers, $first);X               }X               elseX               {X                  warn "${Script_Name}: unknown option: $first\n";X                  ++$errs;X               };X               if($rest ne '') X               {X                   $ARGV[0] = "-$rest";X               }X               else X               {X                   shift(@ARGV);X               }X           }X        }XX        elseX        {X           push (@leftovers, shift (@ARGV));X        };XX        # Save any other switches if $Pass_ValidX        if ((@current_leftovers) && ($rest eq ''))X        {X           push (@leftovers, "-" . join ("", @current_leftovers));X           @current_leftovers = ();X        };X    };XX    # Automatically print Usage if a warning was givenX    @ARGV = @leftovers;X    if ($errs != 0)X    {X       warn $Usage;X       return (0);X    }X    elseX    {X       return (1);X    }X       }X1;SHAR_EOFchmod 0444 libs/newgetopts.pl ||echo 'restore of libs/newgetopts.pl failed'Wc_c="`wc -c < 'libs/newgetopts.pl'`"test 7024 -eq "$Wc_c" ||	echo 'libs/newgetopts.pl: original size 7024, current size' "$Wc_c"fi# ============= libs/strings1.pl ==============if test -f 'libs/strings1.pl' -a X"$1" != X"-c"; then	echo 'x - skipping libs/strings1.pl (File already exists)'elseecho 'x - extracting libs/strings1.pl (Text)'sed 's/^X//' << 'SHAR_EOF' > 'libs/strings1.pl' &&;# NAME;#    strings1.pl - FUN with strings #1;#;# NOTES;#    I wrote Format_Text_Block when I just started programming Perl so;#    it is probably not very Perlish code. Center is more like it :-).;#;# AUTHOR;#    Michael S. Muegel (mmuegel@mot.com);#;# RCS INFORMATION;#    mmuegel;#    /usr/local/ustart/src/mail-tools/dist/foo/libs/strings1.pl,v 1.1 1993/07/28 08:07:19 mmuegel ExpXpackage strings1;X;###############################################################################;# Center;#;# Center $Text assuming the output should be $Columns wide. $Text can span;# multiple lines, of course :-). Lines within $Text that contain only ;# whitespace are not centered and are instead collapsed. This may save time ;# when printing them later.;#;# Arguments:;#    $Text, $Columns;#;# Returns:;#    $Centered_Text;###############################################################################sub main'Center{X   local ($_, $Columns) = @_;X   local ($*) = 1;XX   s@^(.*)$@" " x (($Columns - length ($1)) / 2) . $1@eg;X   s/^[\t ]*$//g;X   return ($_);};X;###############################################################################;# Format_Text_Block;#;# Formats a text string to be printed to the display or other similar device.;# Text in $String will be fomratted such that the following hold:;#;#    + $String contains the (possibly) multi-line text to print. It is;#	automatically word-wrapped to fit in $Columns. ;#;#    + \n'd are maintained and are not folded.;#;#    + $Offset	is pre-pended before each separate line of text. ;#;#    + If $Offset_Once	is $TRUE $Offset will only appear on the first line.;#      All other lines will be indented to match the amount of whitespace of;#      $Offset.;#;#    + If $Bullet_Indent is $TRUE $Offset will only be applied to the begining;#      of lines as they occured in the original $String. Lines that are created;#      by this routine will always be indented by blank spaces.;#;#    + If $Columns is 0 no word-wrap is done. This might be useful to still;#      to offset each line in a buffer.;#;#    + If $Split_Expr is supplied the string is split on it. If not supplied;#      the string is split on " \t\/\-\,\." by default.;#;#    + If $Offset_Blank is $TRUE then empty lines will have $Offset pre-pended;#      to them. Otherwise, they will still empty.;#;# This is a realy workhorse routine that I use in many places because of its;# veratility.;#;# Arguments:;#    $String, $Offset, $Offset_Once, $Bullet_Indent, $Columns, $Split_Expr,;#    $Offset_Blank;#;# Returns:;#    $Buffer;###############################################################################sub main'Format_Text_Block{X   local ($String, $Real_Offset, $Offset_Once, $Bullet_Indent, $Columns, X      $Split_Expr, $Offset_Blank) = @_;XX   local ($New_Line, $Line, $Chars_Per_Line, $Space_Offset, $Buffer,X      $Next_New_Line, $Num_Lines, $Num_Offsets, $Offset);X   local ($*) = 0;X   local ($BLANK_TAG) = "__FORMAT_BLANK__";X   local ($Blank_Offset) = $Real_Offset if ($Offset_Blank);XX   # What should we split on?X   $Split_Expr = " \\t\\/\\-\\,\\." if (! $Split_Expr);XX   # Pre-process the string - convert blank lines to __FORMAT_BLANK__ sequenceX   $String =~ s/\n\n/\n$BLANK_TAG\n/g;X   $String =~ s/^\n/$BLANK_TAG\n/g;X   $String =~ s/\n$/\n$BLANK_TAG/g;XX   # If bad $Columns/$Offset combo or no $Columns make a VERRRYYY wide $ColumnX   $Offset = $Real_Offset;X   $Chars_Per_Line = 16000 if (($Chars_Per_Line = $Columns - length ($Offset)) <= 0);X   $Space_Offset = " " x length ($Offset);XX   # Get a bufferX   foreach $Line (split ("\n", $String))X   {X      $Offset = $Real_Offset if ($Bullet_Indent);XX      # Find where to split the lineX      if ($Line ne $BLANK_TAG)X      { X         $New_Line = "";X         while ($Line =~ /^([$Split_Expr]*)([^$Split_Expr]+)/)X         {X            if (length ("$New_Line$&") >= $Chars_Per_Line)X            {X               $Next_New_Line = $+;X               $New_Line = "$Offset$New_Line$1";X               $Buffer .= "\n" if ($Num_Lines++);X               $Buffer .= $New_Line;X               $Offset = $Space_Offset if (($Offset) && ($Offset_Once));X               $New_Line = $Next_New_Line;X               ++$Num_Lines;X            }X            elseX            {X               $New_Line .= $&;X            };X            $Line = $';X         };XX         $Buffer .= "\n" if ($Num_Lines++);X         $Buffer .= "$Offset$New_Line$Line";X         $Offset = $Space_Offset if (($Offset) && ($Offset_Once));X      }XX      elseX      {X         $Buffer .= "\n$Blank_Offset";X      };X   };XX   return ($Buffer);X};X1;SHAR_EOFchmod 0444 libs/strings1.pl ||echo 'restore of libs/strings1.pl failed'Wc_c="`wc -c < 'libs/strings1.pl'`"test 4687 -eq "$Wc_c" ||	echo 'libs/strings1.pl: original size 4687, current size' "$Wc_c"fi# ============= libs/timespec.pl ==============if test -f 'libs/timespec.pl' -a X"$1" != X"-c"; then	echo 'x - skipping libs/timespec.pl (File already exists)'elseecho 'x - extracting libs/timespec.pl (Text)'sed 's/^X//' << 'SHAR_EOF' > 'libs/timespec.pl' &&;# NAME;#    timespec.pl - convert a pre-defined time specifyer to seconds;#;# AUTHOR;#    Michael S. Muegel (mmuegel@mot.com);#;# RCS INFORMATION;#    mmuegel;#    /usr/local/ustart/src/mail-tools/dist/foo/libs/timespec.pl,v 1.1 1993/07/28 08:07:19 mmuegel ExpXpackage timespec;X%TIME_SPEC_TO_SECONDS 	= ("s", 1,X		    	   "m", 60,X		    	   "h", 60 * 60,X		    	   "d", 60 * 60 * 24X		    	   );X$VALID_TIME_SPEC_EXPR 	= "[" . join ("", keys (%TIME_SPEC_TO_SECONDS)) . "]";X;###############################################################################;# Time_Spec_To_Seconds;#;# Converts a string of the form:;#;#    (<number>(s|m|h|d))+;#;# to seconds. The second part of the time spec specifies seconds, minutes, ;# hours, or days, respectfully. The first part is the number of those untis. ;# There can be any number of such specifiers. As an example, 1h30m means 1 ;# hour and 30 minutes.;#;# If the parsing went OK then $Status is 1, $Msg is undefined, and $Seconds;# is $Time_Spec converted to seconds. If something went wrong then $Status;# is 0 and $Msg explains what went wrong.;#;# Arguments:;#    $Time_Spec;#;# Returns:;#    $Status, $Msg, $Seconds;###############################################################################sub main'Time_Spec_To_Seconds{X   $Time_Spec = $_[0];XX   $Seconds = 0;X   while ($Time_Spec =~ /^(\d+)($VALID_TIME_SPEC_EXPR)/)X   {X      $Seconds += $1 * $TIME_SPEC_TO_SECONDS {$2};X      $Time_Spec = $';X   };XX   return (0, "error parsing time spec: $Time_Spec") if ($Time_Spec ne "");X   return (1, "", $Seconds);X};XX1;SHAR_EOFchmod 0444 libs/timespec.pl ||echo 'restore of libs/timespec.pl failed'Wc_c="`wc -c < 'libs/timespec.pl'`"test 1609 -eq "$Wc_c" ||	echo 'libs/timespec.pl: original size 1609, current size' "$Wc_c"fi# ============= man/cqueue.1 ==============if test ! -d 'man'; then    echo 'x - creating directory man'    mkdir 'man'fiif test -f 'man/cqueue.1' -a X"$1" != X"-c"; then	echo 'x - skipping man/cqueue.1 (File already exists)'elseecho 'x - extracting man/cqueue.1 (Text)'sed 's/^X//' << 'SHAR_EOF' > 'man/cqueue.1' &&.TH CQUEUE 1L\"\" mmuegel\" /usr/local/ustart/src/mail-tools/dist/foo/man/cqueue.1,v 1.1 1993/07/28 08:08:25 mmuegel Exp\".ds mp \fBcqueue\fR.de IB.IP \(bu 2...SH NAME\*(mp - check sendmail queue for problems.SH SYNOPSIS.IP \*(mp 7 [ \fB-abdms\fR ] [ \fB-q\fR \fIqueue-dir\fI ] [ \fB-t\fR \fItime\fR ] [ \fB-u\fR \fIusers\fR ] [ \fB-w\fR \fIwidth\fR ].SH DESCRIPTIONReports on problems in the sendmail queue. With no options this simplymeans listing messages that have been in the queue longer than a defaultperiod along with a summary of queue mail by host and status message..SH OPTIONS.IP \fB-a\fR 14Report on all messages in the queue. This is equivalent to saying \fB-t\fR 0s.You may like this command so much that you use it as a replacement for\fBmqueue\fR. For example:.sp 1.RS.RS\fBalias mqueue cqueue -a\fR.RE.RE.IP \fB-b\fR 14Also report on bogus queue files. Those are files thathave data files and no control files or vice versa..IP \fB-d\fRPrint a detailed report of mail messages that have been queued longer thanthe specified or default time. Information that is presented includes:.RS.RS.IBSendmail queue identifier..IBDate the message was first queued..IBSender of the message..IBOne or more recipients of the message..IBAn optional status of the message. This usually indicates why the messagehas not been delivered..RE.RE.IP \fB-m\fR 14Mail off the results if any problems were found.Normaly results are printed to stdout. If this optionis specified they are mailed to one or more users. Resultsare not printed to stdout in this case. Results are \fBonly\fRmailed if \*(mp found something wrong..IP "\fB-q\fR \fIqueue-dir\fI"The sendmail mail queue directory. Default is \fB/usr/spool/mqueue\fR orsome other site configured value..IP "\fB-t\fR \fItime\fR"List messages that have been in the queue longer than\fItime\fR. Time should of the form:.sp 1.RS.RS(<number>(s|m|h|d))+.sp 1.RE.RE.RS 14The second portion of the above definitionspecifies seconds, minutes, hours, ordays, respectfully. The first portion is the number ofthose units. There can be any number of such specifiers.As an example, 1h30m means 1 hour and 30 minutes..sp 1The default is 2 hours..RE.IP \fB-s\fR 14Print a summary of messages that have been queued longer thanthe specified or default time. Two separate types of summaries are printed.The first summarizes the queue messages by destination host. The host nameis gleaned from the recipient addresses for each message.Thus the actual host names for this summary should be taken with a grainof salt since ruleset 0 has not been applied to the address the host wastaken from nor were MX records consulted. It would be possible to addthis; however, the execution time of the script would increase dramatically. The second summary is by status message..IP "\fB-u\fR \fIusers\fR"Specify list of users to send a mail report to other thanthe invoker. This option is only valid when \fB-m\fR has beenspecified. Multiple recipients may be separated by spaces..IP "\fB-w\fR \fIwidth\fR"Specify the page width to which the output should tailored. \fIwidth\fRshould be an integer representing some character position. The default is

⌨️ 快捷键说明

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