From: Tobias Stoeckmann Date: Sun, 28 Dec 2025 15:36:19 +0000 (+0100) Subject: sg: Properly document synopsis and options X-Git-Tag: 4.19.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47be361b863f550bda561abcac51fb125218b19f;p=thirdparty%2Fshadow.git sg: Properly document synopsis and options The usage message of sg and synopsis of its manual page diverged. The difference was even noted in a comment, instead of fixing it. Synchronize both, add information about hidden options and document what they do. Signed-off-by: Tobias Stoeckmann --- diff --git a/man/sg.1.xml b/man/sg.1.xml index 2423f1097..54d9023b7 100644 --- a/man/sg.1.xml +++ b/man/sg.1.xml @@ -45,13 +45,15 @@ sg - - + + - + group - -c - command + -c + command @@ -73,6 +75,37 @@ + + OPTIONS + + The options which apply to the sg command are: + + + + , + + + Start the shell as a login shell. + + + + + + + + + + Specify a command that will be invoked by the shell using its + . + + + This is the default; for backward compatibility. + + + + + + CONFIGURATION diff --git a/src/newgrp.c b/src/newgrp.c index e48b4d366..5c4cc07b1 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -72,7 +72,7 @@ static void usage (void) if (is_newgrp) { (void) fputs (_("Usage: newgrp [-] [group]\n"), stderr); } else { - (void) fputs (_("Usage: sg group [[-c] command]\n"), stderr); + (void) fputs (_("Usage: sg [-] group [[-c] command]\n"), stderr); } } @@ -465,8 +465,8 @@ int main (int argc, char **argv) * The valid syntax are * newgrp [-] [groupid] * newgrp [-l] [groupid] - * sg [-] - * sg [-] groupid [[-c command] + * sg [-] groupid [[-c] command] + * sg [-l] groupid [[-c] command] */ if ( (argc > 0) && ( streq(argv[0], "-") @@ -499,8 +499,7 @@ int main (int argc, char **argv) /* * Skip -c if specified so both forms work: - * "sg group -c command" (as in the man page) or - * "sg group command" (as in the usage message). + * "sg group -c command" or "sg group command". */ if ((argc > 1) && streq(argv[0], "-c")) { command = argv[1];