summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-05 10:47:07 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-05 10:47:07 +0000
commitaf232995df8ec1c789f1cd0a2bcf0d57ee1eeb38 (patch)
tree19df1147947c711e2a201d75e087860879c6b4ae /usr.sbin/pkg_add
parent4a31d0bfa582bbcb0f3481382d21455c264cb1a5 (diff)
reorg tests to simplify logic
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_create43
1 files changed, 19 insertions, 24 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index b819df11c13..52413df2b45 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.90 2007/05/05 10:40:44 espie Exp $
+# $OpenBSD: pkg_create,v 1.91 2007/05/05 10:47:06 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -431,33 +431,28 @@ sub add_description
{
my ($plist, $name, $infodir, $opt_c, $opt_d) = @_;
OpenBSD::PackingElement::File->add($plist, $name);
- if (defined $opt_c) {
- if (defined $infodir) {
- if ($opt_c =~ /^\-/) {
- open(my $fh, '>', $infodir.$name) or die "Can't write COMMENT to DESC file: $!";
- print $fh $';
- close($fh);
- } else {
- copy_subst($opt_c, '>', $infodir.$name);
- }
- }
- } else {
+ if (!defined $opt_c) {
Usage "Comment required";
}
-
- if (defined $opt_d) {
- if (defined $infodir) {
- if ($opt_d =~ /^\-/) {
- open(my $fh, '>>', $infodir.$name) or die "Can't write to DESC: $!";
- print $fh $';
- close($fh);
- } else {
- copy_subst($opt_d, '>>', $infodir.$name);
- }
- }
- } else {
+ if (!defined $opt_d) {
Usage "Description required";
}
+ if (defined $infodir) {
+ if ($opt_c =~ /^\-/) {
+ open(my $fh, '>', $infodir.$name) or die "Can't write COMMENT to DESC file: $!";
+ print $fh $';
+ close($fh);
+ } else {
+ copy_subst($opt_c, '>', $infodir.$name);
+ }
+ if ($opt_d =~ /^\-/) {
+ open(my $fh, '>>', $infodir.$name) or die "Can't write to DESC: $!";
+ print $fh $';
+ close($fh);
+ } else {
+ copy_subst($opt_d, '>>', $infodir.$name);
+ }
+ }
}
our $errors = 0;