Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/physlock/, app-misc/physlock/files/
Date: Mon, 22 Nov 2021 14:03:50
Message-Id: 1637589817.c2ad6666f04d4e5ff6cd4fd08d36711f5b83bb08.juippis@gentoo
1 commit: c2ad6666f04d4e5ff6cd4fd08d36711f5b83bb08
2 Author: Oskari Pirhonen <xxc3ncoredxx <AT> gmail <DOT> com>
3 AuthorDate: Tue Nov 9 01:31:01 2021 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 22 14:03:37 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2ad6666
7
8 app-misc/physlock: Add patch to improve -h output
9
10 Previously -h only listed the options. Now -h prints a description taken
11 from the man page.
12
13 Package-Manager: Portage-3.0.28, Repoman-3.0.3
14 Signed-off-by: Oskari Pirhonen <xxc3ncoredxx <AT> gmail.com>
15 Closes: https://github.com/gentoo/gentoo/pull/22870
16 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
17
18 .../physlock-13-Improved-commandline-help.patch | 89 ++++++++++++++++++++++
19 ...physlock-13-r2.ebuild => physlock-13-r3.ebuild} | 1 +
20 2 files changed, 90 insertions(+)
21
22 diff --git a/app-misc/physlock/files/physlock-13-Improved-commandline-help.patch b/app-misc/physlock/files/physlock-13-Improved-commandline-help.patch
23 new file mode 100644
24 index 000000000000..680575410e4e
25 --- /dev/null
26 +++ b/app-misc/physlock/files/physlock-13-Improved-commandline-help.patch
27 @@ -0,0 +1,89 @@
28 +From e6c69762f5f555fa17659e3440d8392b6a47bbc6 Mon Sep 17 00:00:00 2001
29 +From: Oskari Pirhonen <xxc3ncoredxx@×××××.com>
30 +Date: Mon, 8 Nov 2021 18:44:25 -0600
31 +Subject: [PATCH] Improved commandline help
32 +
33 +Output the descriptions of the commandline options in -h.
34 +
35 +Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@×××××.com>
36 +---
37 + options.c | 25 +++++++++++++++++--------
38 + physlock.1 | 2 +-
39 + 2 files changed, 18 insertions(+), 9 deletions(-)
40 +
41 +diff --git a/options.c b/options.c
42 +index 6ec3634..ed21262 100644
43 +--- a/options.c
44 ++++ b/options.c
45 +@@ -28,7 +28,16 @@ static options_t _options;
46 + const options_t *options = (const options_t*) &_options;
47 +
48 + void print_usage() {
49 +- printf("usage: physlock [-dhLlmsv] [-p MSG]\n");
50 ++ printf("Usage: physlock [-dhlLmsv] [-p MSG]\n");
51 ++ printf("Lock all consoles / virtual terminals.\n\n");
52 ++ printf(" -d Fork and detach physlock before prompting for authentication.\n");
53 ++ printf(" -h Print brief usage information to standard output and exit.\n");
54 ++ printf(" -l Only lock console switching and exit.\n");
55 ++ printf(" -L Only enable (unlock) console switching and exit.\n");
56 ++ printf(" -m Mute kernel messages on console while physlock is running.\n");
57 ++ printf(" -p MSG Display MSG before the password prompt.\n");
58 ++ printf(" -s Disable SysRq mechanism while physlock is running.\n");
59 ++ printf(" -v Print version information to standard output and exit.\n");
60 + }
61 +
62 + void print_version() {
63 +@@ -46,23 +55,20 @@ void parse_options(int argc, char **argv) {
64 + _options.lock_switch = -1;
65 + _options.mute_kernel_messages = 0;
66 +
67 +- while ((opt = getopt(argc, argv, "dhLlmp:sv")) != -1) {
68 ++ while ((opt = getopt(argc, argv, "dhlLmp:sv")) != -1) {
69 + switch (opt) {
70 +- case '?':
71 +- print_usage();
72 +- exit(1);
73 + case 'd':
74 + _options.detach = 1;
75 + break;
76 + case 'h':
77 + print_usage();
78 + exit(0);
79 +- case 'L':
80 +- _options.lock_switch = 0;
81 +- break;
82 + case 'l':
83 + _options.lock_switch = 1;
84 + break;
85 ++ case 'L':
86 ++ _options.lock_switch = 0;
87 ++ break;
88 + case 'm':
89 + _options.mute_kernel_messages = 1;
90 + break;
91 +@@ -75,6 +81,9 @@ void parse_options(int argc, char **argv) {
92 + case 'v':
93 + print_version();
94 + exit(0);
95 ++ case '?':
96 ++ print_usage();
97 ++ exit(1);
98 + }
99 + }
100 + }
101 +diff --git a/physlock.1 b/physlock.1
102 +index 32e8547..6243214 100644
103 +--- a/physlock.1
104 ++++ b/physlock.1
105 +@@ -3,7 +3,7 @@
106 + physlock \- lock all consoles / virtual terminals
107 + .SH SYNOPSIS
108 + .B physlock
109 +-.RB [ \-dhLlmsv ]
110 ++.RB [ \-dhlLmsv ]
111 + .RB [ \-p
112 + .IR MSG ]
113 + .SH DESCRIPTION
114 +--
115 +2.32.0
116 +
117
118 diff --git a/app-misc/physlock/physlock-13-r2.ebuild b/app-misc/physlock/physlock-13-r3.ebuild
119 similarity index 93%
120 rename from app-misc/physlock/physlock-13-r2.ebuild
121 rename to app-misc/physlock/physlock-13-r3.ebuild
122 index 0ae63dfa9ec5..907a87cae44a 100644
123 --- a/app-misc/physlock/physlock-13-r2.ebuild
124 +++ b/app-misc/physlock/physlock-13-r3.ebuild
125 @@ -24,6 +24,7 @@ DEPEND="${RDEPEND}
126
127 PATCHES=(
128 "${FILESDIR}/${PN}-13-Set-PAM_TTY.patch"
129 + "${FILESDIR}/${PN}-13-Improved-commandline-help.patch"
130 )
131
132 pkg_setup() {