--- shiela.pl 2002/12/23 11:32:05 1.42
+++ shiela.pl 2002/12/23 11:50:09 1.43
@@ -1014,6 +1014,23 @@
## _________________________________________________________________
##
+## Fit text into particular columns.
+##
+## This makes sure a text fits into a particular columns by
+## truncating (and extending with "$") if necessary.
+## _________________________________________________________________
+##
+
+sub fit_columns {
+ my ($col, $txt) = @_;
+ if (length($txt) > $col) {
+ $txt = substr($txt, 0, $col-1) . '$';
+ }
+ return $txt;
+}
+
+## _________________________________________________________________
+##
## TAGINFO HOOK
##
## We hook into CVS via `taginfo' to check whether user is allowed to
@@ -2074,8 +2091,8 @@
$cvsbranches{$e->{branch}} = 0 if (not defined($cvsbranches{$e->{branch}}));
$cvsbranches{$e->{branch}}++;
}
- $IN->{cvsbranch} = join(', ', keys(%cvsbranches));
- $IN->{cvsmodule} = join(', ', keys(%cvsmodules));
+ $IN->{cvsbranch} = join(' ', keys(%cvsbranches));
+ $IN->{cvsmodule} = join(' ', keys(%cvsmodules));
#
# Finally generate the logging message.
@@ -2104,13 +2121,20 @@
my @moy = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time());
- my $date = sprintf("%02d-%s-%04d %02d:%02d:%02d",
- $mday, $moy[$mon], 1900+$year, $hour, $min, $sec);
+ my $txt_date = sprintf("%02d-%s-%04d %02d:%02d:%02d",
+ $mday, $moy[$mon], 1900+$year, $hour, $min, $sec);
+ my $txt_server = &fit_columns(32, $CF->{Repository}->{Host});
+ my $txt_root = &fit_columns(32, $CF->{Repository}->{Path});
+ my $txt_module = &fit_columns(32, $IN->{cvsmodule});
+ my $txt_branch = &fit_columns(32, $IN->{cvsbranch});
+ my $txt_name = &fit_columns(32, $RT->{username});
+ my $txt_email = &fit_columns(32, $RT->{usermail});
+ my $txt_handle = &fit_columns(32, $IN->{handle});
$O .= "\n" .
- $prefix . sprintf("%-40s %s\n", "Server: ".$CF->{Repository}->{Host}, "Name: ".$RT->{username}) .
- $prefix . sprintf("%-40s %s\n", "Root: ".$CF->{Repository}->{Path}, "Email: ".$RT->{usermail}) .
- $prefix . sprintf("%-40s %s\n", "Module: ".$IN->{cvsmodule}, "Date: ".$date) .
- $prefix . sprintf("%-40s %s\n", "Branch: ".$IN->{cvsbranch}, "Handle: ".$IN->{handle});
+ $prefix . sprintf("%-40s %s\n", "Server: ".$txt_server, "Name: ".$txt_name) .
+ $prefix . sprintf("%-40s %s\n", "Root: ".$txt_root, "Email: ".$txt_email) .
+ $prefix . sprintf("%-40s %s\n", "Module: ".$txt_module, "Date: ".$txt_date) .
+ $prefix . sprintf("%-40s %s\n", "Branch: ".$txt_branch, "Handle: ".$txt_handle);
}
# the file list
|