diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-06-09 10:58:02 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-06-09 10:58:02 +0000 |
commit | 1e22d602c003dcb959f34d28c48064692e5da1c4 (patch) | |
tree | 82b5f7d1ab28bb8d5a089d0797383d017c740ab3 /usr.sbin | |
parent | cc1920f432df2166638f2af88f888bb5e29e519d (diff) |
use State usage, so that I can get rid of duplicate code...
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/pkg_merge | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_mklocatedb | 8 |
2 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/pkg_merge b/usr.sbin/pkg_add/pkg_merge index 280df066fdf..bb4c70f2c82 100644 --- a/usr.sbin/pkg_add/pkg_merge +++ b/usr.sbin/pkg_add/pkg_merge @@ -1,6 +1,6 @@ #! /usr/bin/perl # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> -# $OpenBSD: pkg_merge,v 1.14 2010/05/10 09:17:55 espie Exp $ +# $OpenBSD: pkg_merge,v 1.15 2010/06/09 10:58:01 espie Exp $ # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -25,6 +25,7 @@ use OpenBSD::Error; use OpenBSD::Ustar; use OpenBSD::ArcCheck; use OpenBSD::Paths; +use OpenBSD::State; use File::Copy; use File::Path; @@ -127,22 +128,23 @@ sub occurs_first } -set_usage('pkg_merge [-v] -o result pkg pkg2 ...'); +my $ui = OpenBSD::State->new("pkg_merge"); +$ui->usage_is('[-v] -o result pkg pkg2 ...'); our ($opt_o, $opt_v); try { getopts('o:v'); } catchall { - Usage($_); + $ui->usage($_); }; if (!defined $opt_o) { - Usage "Missing -o result"; + $ui->usage("Missing -o result"); } if (@ARGV<2) { - Usage "Can't merge less than two packages"; + $ui->usage("Can't merge less than two packages"); } my @tomerge; diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index 769c9217a1b..39d2b7c0ee1 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -1,6 +1,6 @@ #! /usr/bin/perl # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> -# $OpenBSD: pkg_mklocatedb,v 1.24 2010/05/10 09:17:55 espie Exp $ +# $OpenBSD: pkg_mklocatedb,v 1.25 2010/06/09 10:58:01 espie Exp $ # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -23,6 +23,7 @@ use OpenBSD::PackingList; use OpenBSD::Getopt; use OpenBSD::Error; use OpenBSD::Paths; +use OpenBSD::State; use File::Path; package OpenBSD::PackingElement; @@ -37,7 +38,8 @@ sub print_name package main; -set_usage('pkg_mklocatedb [-anPq] [-d repository] [-p portsdir] [-r release] [-s src] [-x X11src] [pkg-name [...]]'); +my $ui = OpenBSD::State->new("pkg_mklocatedb"); +$ui->usage_is('[-anPq] [-d repository] [-p portsdir] [-r release] [-s src] [-x X11src] [pkg-name [...]]'); our ($opt_a, $opt_n, $opt_q, $opt_s, $opt_x, $opt_r, $opt_p, $opt_P, $opt_d); @@ -74,7 +76,7 @@ sub tag try { getopts('ad:nqs:x:r:p:P'); } catchall { - Usage($_); + $ui->usage($_); }; my $fh; |