summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhuk <zhuk@openbsd.org>2014-07-08 16:45:44 +0000
committerzhuk <zhuk@openbsd.org>2014-07-08 16:45:44 +0000
commitcc8c7a8b811478e5f75e76904de36bed1ec04247 (patch)
tree8c0641bb300e84388425894a2cbf0dc8a70ca73a
parentreplace malloc(strlen())/strlcpy with strdup (diff)
downloadwireguard-openbsd-cc8c7a8b811478e5f75e76904de36bed1ec04247.tar.xz
wireguard-openbsd-cc8c7a8b811478e5f75e76904de36bed1ec04247.zip
Prettify the list of "required by" package names by sorting it.
okay espie@
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgInfo.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
index 6f9eb670b3c..3a8d84aa662 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgInfo.pm,v 1.31 2014/03/18 18:53:29 espie Exp $
+# $OpenBSD: PkgInfo.pm,v 1.32 2014/07/08 16:45:44 zhuk Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -116,6 +116,20 @@ sub printfile
$state->say;
}
+sub printfile_sorted
+{
+ my ($state, $filename) = @_;
+
+ open my $fh, '<', $filename or return;
+ my @lines = (<$fh>);
+ close $fh;
+ foreach my $line (sort @lines) {
+ chomp;
+ $state->say("#1", $_);
+ }
+ $state->say;
+}
+
sub print_description
{
my ($state, $dir) = @_;
@@ -383,7 +397,7 @@ sub print_info
if ($state->opt('R') && -f $handle->info.REQUIRED_BY) {
$state->header($handle);
$state->banner("Required by:");
- $state->printfile($handle->info.REQUIRED_BY);
+ $state->printfile_sorted($handle->info.REQUIRED_BY);
}
if ($state->opt('d')) {
$state->header($handle);