* mkgroup.c (main): Change call to exit() to a return statement.
* mkpasswd.c (main): Ditto. * mkpasswd.c (usage): Simplify usage output. Generalize to allow use for help. Correct '?' typo to 'h'. (longopts): Add version option. (opts): Add 'v' version option. (print_version): New function. (main): Accommodate new version option. Accommodate usage parameter changes.
This commit is contained in:
parent
557856bdd9
commit
eccebec08d
|
@ -1,3 +1,18 @@
|
||||||
|
2002-03-29 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* mkgroup.c (main): Change call to exit() to a return statement.
|
||||||
|
* mkpasswd.c (main): Ditto.
|
||||||
|
|
||||||
|
2002-03-27 Joshua Daniel Franklin joshuadfranklin@yahoo.com
|
||||||
|
|
||||||
|
* mkpasswd.c (usage): Simplify usage output. Generalize to allow use
|
||||||
|
for help. Correct '?' typo to 'h'.
|
||||||
|
(longopts): Add version option.
|
||||||
|
(opts): Add 'v' version option.
|
||||||
|
(print_version): New function.
|
||||||
|
(main): Accommodate new version option. Accommodate usage parameter
|
||||||
|
changes.
|
||||||
|
|
||||||
2002-03-19 Christopher Faylor <cgf@redhat.com>
|
2002-03-19 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* mkgroup.c (usage): Use one just fprintf + string concatenation for
|
* mkgroup.c (usage): Use one just fprintf + string concatenation for
|
||||||
|
|
|
@ -512,7 +512,7 @@ main (int argc, char **argv)
|
||||||
return usage (stdout, 0);
|
return usage (stdout, 0);
|
||||||
case 'v':
|
case 'v':
|
||||||
print_version ();
|
print_version ();
|
||||||
exit (0);
|
return 0;
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
|
fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -617,7 +617,7 @@ main (int argc, char **argv)
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Cannot get PDC, code = %ld\n", rc);
|
fprintf (stderr, "Cannot get PDC, code = %ld\n", rc);
|
||||||
exit (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum_groups (servername, print_sids, print_users, id_offset);
|
enum_groups (servername, print_sids, print_users, id_offset);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* mkpasswd.c:
|
/* mkpasswd.c:
|
||||||
|
|
||||||
Copyright 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#include <lmerr.h>
|
#include <lmerr.h>
|
||||||
|
|
||||||
|
static const char version[] = "$Revision$";
|
||||||
|
|
||||||
SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
|
SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
|
||||||
SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
|
SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
|
||||||
|
|
||||||
|
@ -393,26 +395,27 @@ print_special (int print_sids,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
usage ()
|
usage (FILE * stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: mkpasswd [OPTION]... [domain]\n\n");
|
fprintf (stream, "Usage: mkpasswd [OPTION]... [domain]\n\n"
|
||||||
fprintf (stderr, "This program prints a /etc/passwd file to stdout\n\n");
|
"This program prints a /etc/passwd file to stdout\n\n"
|
||||||
fprintf (stderr, "Options:\n");
|
"Options:\n"
|
||||||
fprintf (stderr, " -l,--local print local user accounts\n");
|
" -l,--local print local user accounts\n"
|
||||||
fprintf (stderr, " -d,--domain print domain accounts (from current domain\n");
|
" -d,--domain print domain accounts (from current domain\n"
|
||||||
fprintf (stderr, " if no domain specified)\n");
|
" if no domain specified)\n"
|
||||||
fprintf (stderr, " -o,--id-offset offset change the default offset (10000) added to uids\n");
|
" -o,--id-offset offset change the default offset (10000) added to uids\n"
|
||||||
fprintf (stderr, " in domain accounts.\n");
|
" in domain accounts.\n"
|
||||||
fprintf (stderr, " -g,--local-groups print local group information too\n");
|
" -g,--local-groups print local group information too\n"
|
||||||
fprintf (stderr, " if no domain specified\n");
|
" if no domain specified\n"
|
||||||
fprintf (stderr, " -m,--no-mount don't use mount points for home dir\n");
|
" -m,--no-mount don't use mount points for home dir\n"
|
||||||
fprintf (stderr, " -s,--no-sids don't print SIDs in GCOS field\n");
|
" -s,--no-sids don't print SIDs in GCOS field\n"
|
||||||
fprintf (stderr, " (this affects ntsec)\n");
|
" (this affects ntsec)\n"
|
||||||
fprintf (stderr, " -p,--path-to-home path use specified path instead of user account home dir\n");
|
" -p,--path-to-home path use specified path instead of user account home dir\n"
|
||||||
fprintf (stderr, " -u,--username username only return information for the specified user\n");
|
" -u,--username username only return information for the specified user\n"
|
||||||
fprintf (stderr, " -?,--help displays this message\n\n");
|
" -h,--help displays this message\n"
|
||||||
fprintf (stderr, "One of `-l', `-d' or `-g' must be given on NT/W2K.\n");
|
" -v,--version version information and exit\n\n"
|
||||||
return 1;
|
"One of `-l', `-d' or `-g' must be given on NT/W2K.\n");
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
|
@ -425,10 +428,33 @@ struct option longopts[] = {
|
||||||
{"path-to-home", required_argument, NULL, 'p'},
|
{"path-to-home", required_argument, NULL, 'p'},
|
||||||
{"username", required_argument, NULL, 'u'},
|
{"username", required_argument, NULL, 'u'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{"version", no_argument, NULL, 'v'},
|
||||||
{0, no_argument, NULL, 0}
|
{0, no_argument, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
char opts[] = "ldo:gsmhp:u:";
|
char opts[] = "ldo:gsmhp:u:v";
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_version ()
|
||||||
|
{
|
||||||
|
const char *v = strchr (version, ':');
|
||||||
|
int len;
|
||||||
|
if (!v)
|
||||||
|
{
|
||||||
|
v = "?";
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v += 2;
|
||||||
|
len = strchr (v, ' ') - v;
|
||||||
|
}
|
||||||
|
printf ("\
|
||||||
|
mkpasswd (cygwin) %.*s\n\
|
||||||
|
passwd File Generator\n\
|
||||||
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
|
||||||
|
Compiled on %s", len, v, __DATE__);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
|
@ -455,7 +481,7 @@ main (int argc, char **argv)
|
||||||
if (GetVersion () < 0x80000000)
|
if (GetVersion () < 0x80000000)
|
||||||
{
|
{
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
return usage ();
|
return usage (stderr, 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
|
while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
|
||||||
|
@ -494,7 +520,10 @@ main (int argc, char **argv)
|
||||||
disp_username = optarg;
|
disp_username = optarg;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
return usage ();
|
return usage (stdout, 0);
|
||||||
|
case 'v':
|
||||||
|
print_version ();
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
|
fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -577,7 +606,7 @@ main (int argc, char **argv)
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
print_win_error(rc);
|
print_win_error(rc);
|
||||||
exit (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum_users (servername, print_sids, print_cygpath, passed_home_path,
|
enum_users (servername, print_sids, print_cygpath, passed_home_path,
|
||||||
|
|
Loading…
Reference in New Issue