Paul Eggert
d2940e7cd4
(run_shell): Pass a new n_additional_args arg, so that
...
the callee doesn't have to count 'em. All callers changed.
Don't allocate more space for the arg vector than we'll need.
Use memcpy to copy the args rather than rolling our own loop.
Use size_t for sizes.
(fast_startup, simulate_login, change_environment, log_su,
correct_password, restricted_shell, main): Use bool for booleans.
(longopts): Don't assume change_environment is an int.
Use NULL, not 0, for pointers.
(xsetenv): New function, replacing xputenv and concat.
All callers changed.
(elements): Remove; no longer needed.
(log_su, correct_passwd, main): Prefer !x to x==NULL.
(log_su): 2 -> STDERR_FILENO.
(modify_environment, main): Don't assume that getenv's returned value
has an indefinite lifetime.
(modify_environment): Allocate a larger environ.
(main): Remove an impossible 'case 0'; if it happens now, it'll
get diagnosed. Don't assume getpwnam results outlive endpwent.
Check for null or empty pw_name, pw_dir and for null pw_passwd.
2004-08-03 22:23:25 +00:00
Jim Meyering
ae752755d2
(correct_password, restricted_shell, main):
...
Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.
2004-06-01 13:04:02 +00:00
Jim Meyering
bfa5295dc0
(usage): Use EXIT_SUCCESS, not 0, for clarity.
...
(main): Initialize exit_failure to EXIT_FAIL.
(main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
rather than roll-your-own symbols or integers.
2004-01-22 21:00:25 +00:00
Jim Meyering
cf4fdf373f
Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
...
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
Update the call to parse_long_options so that `AUTHORS, NULL' are the
last parameters.
* src/true.c (main): Append NULL to version_etc argument list.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-10-18 10:05:47 +00:00
Jim Meyering
bafd927f03
(WRITTEN_BY): Rename from AUTHORS.
...
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
2003-09-18 22:19:03 +00:00
Jim Meyering
4f4e9aa8e1
Don't include headers already included by system.h:
...
Don't include closeout.h.
2003-07-23 07:29:54 +00:00
Jim Meyering
ec5c04d7d8
(usage): Don't call close_stdout here.
...
(main): Use close_stdout via atexit.
Now `su --version > /dev/full' fails, as it should.
Somehow, the change of 2000-05-07 that purports to fix this
was not checked in.
2003-07-18 08:38:43 +00:00
Jim Meyering
6bcd4b08ba
(main): Call initialize_main.
2003-06-17 18:13:23 +00:00
Jim Meyering
6c93bdeeaa
Remove anachronistic casts of xmalloc,
...
xrealloc, and xcalloc return values and of xrealloc's first argument.
2003-04-11 10:51:56 +00:00
Jim Meyering
4006f4e672
Change exit (0)' to exit (EXIT_SUCCESS)',
...
`exit (1)' to `exit (EXIT_FAILURE)', and
`usage (1)' to `usage (EXIT_FAILURE)'.
2002-08-31 08:52:10 +00:00
Jim Meyering
7488703199
Change error (1, ...' to error (EXIT_FAILURE, ...'.
2002-08-30 23:04:53 +00:00
Jim Meyering
d2b62daff5
(run_shell): Exit with status 126 or 127 when execvp or
...
execv fails, for consistency with POSIX commands like env and nice.
2002-08-01 09:19:24 +00:00
Jim Meyering
2ee11887cd
(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.
2002-07-02 09:09:10 +00:00
Jim Meyering
2fae9e5d26
Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION
...
instead of hard-coding --help and --version descriptions.
Split --help output into smaller pieces.
Use fputs, not printf.
2001-12-15 20:46:30 +00:00
Jim Meyering
727433f0db
(xputenv): Remove parameter's const qualifier.
2001-08-14 07:18:34 +00:00
Jim Meyering
2227cb6a07
Include "dirname.h".
...
(base_name): Remove decl; now in dirname.h.
2001-05-12 16:05:51 +00:00
Jim Meyering
98d1d862d5
back out last, prematurely-committed, change
2001-01-07 16:07:33 +00:00
Jim Meyering
aaef348f3d
Correct the indentation of an `#endif'.
2001-01-07 16:06:27 +00:00
Jim Meyering
d8f02c5c3a
(xputenv): Invoke xalloc_die instead of printing our own message.
2000-08-07 16:50:11 +00:00
Jim Meyering
e67940b416
Include <sys/param.h> if HAVE_SYS_PARAM_H is defined,
...
rather than if _POSIX_VERSION is defined. Remove declarations of
getpwuid, getgrgid, and getuid, now that they're in sys2.h.
2000-07-23 16:27:13 +00:00
Jim Meyering
a3d40a9447
Include "closeout.h".
...
(main): Call atexit with close_stdout.
2000-05-07 14:48:25 +00:00
Jim Meyering
d6181296dd
(correct_password): Correct HAVE_STRUCT_* name in #if guard
...
to go along with corrected autoconf test: Reported by G Queri.
2000-02-09 11:57:01 +00:00
Jim Meyering
be1784cf31
(correct_password): Guard with `HAVE_GETSPNAM && HAVE_STRUCT_PASSWD_SP_PWDP',
...
rather than just `#ifdef HAVE_SHADOW_H'.
2000-01-30 22:23:58 +00:00
Jim Meyering
fc02691130
Remove declaration of xstrdup.
1999-09-08 08:39:49 +00:00
Jim Meyering
4b20f454fe
split a long line.
1999-08-30 14:39:05 +00:00
Jim Meyering
705cf20084
(run_shell): Declare with noreturn attribute.
...
Use an explicit exit(1) rather than doing that through error.
1999-08-22 10:53:13 +00:00
Jim Meyering
fdd07e3d2b
No longer include long-options.h.
...
[long_options]: Add entries for --help and --version.
Remove parse_long_options call.
(main) [getopt switch]: Add a case for each of --help and --version.
1999-03-31 05:52:46 +00:00
Jim Meyering
03c1b8518c
(PROGRAM_NAME, AUTHORS): Define and use.
1999-03-31 04:16:08 +00:00
Jim Meyering
5b2aa1846b
Include long-options.h.
...
[long_options]: Remove the "help" and "version" entries.
Remove declarations of show_help and show_version.
(main): Use parse_long_options, including author name(s).
Remove the show_version and show_help blocks.
1999-03-06 15:28:54 +00:00
Jim Meyering
df7b9c808b
update copyright dates
1999-02-16 04:17:15 +00:00
Jim Meyering
276d118b10
(usage): Remove static attribute.
1999-01-25 14:33:38 +00:00
Jim Meyering
24a8bf2d3e
update bug-reporting address
1998-09-19 17:32:35 +00:00
Jim Meyering
5c6991f93d
(longopts): Use corresponding short-option character
...
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-30 03:12:22 +00:00
Jim Meyering
2391251527
Don't include limits.h.
1997-12-21 22:22:04 +00:00
Jim Meyering
4f242b4d51
use NULL, '\0' instead of zeroes
1997-12-10 10:31:25 +00:00
Jim Meyering
3cd84da3a6
(main): Make sure pw->pw_shell is non-NULL before trying to strdup it.
...
Patch from Dick Streefland.
1997-12-10 10:25:46 +00:00
Jim Meyering
b3ab88e970
Remove old-style xmalloc and xrealloc decls.
1997-10-25 22:03:20 +00:00
Jim Meyering
5db3c9bdb4
update bug-reporting address
1997-10-07 23:51:39 +00:00
Jim Meyering
aeea923e99
indent
1997-07-13 03:10:15 +00:00
Jim Meyering
ac0ee614d6
Redefine/undef getusershell around inclusion of <unistd.h>
...
(via system.h) so Cray's int-returning prototype doesn't conflict
with our char*-returning one.
1997-07-05 08:25:58 +00:00
Jim Meyering
e4f25ca7b1
Use base_name, not basename.
1997-05-27 13:55:23 +00:00
Jim Meyering
66c246fc17
cpp-indent
...
Change a few #ifdef to #if.
Remove 3 spurious #ifdef that were guarding an #undef each.
1997-03-19 02:56:54 +00:00
Jim Meyering
bcdeccb6a3
(log_su): Resort to getpwuid if getlogin fails.
...
If no tty name is found, use `none' in the log message.
Based on a patch from Galen Hazelwood.
1997-03-18 12:49:20 +00:00
Jim Meyering
7eb03c4372
update copyrights for 1997
1997-02-09 04:54:16 +00:00
Jim Meyering
899a90bfd9
bracket bug address with <> and append a period
1997-02-01 04:23:31 +00:00
Jim Meyering
b8c82a8e39
Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call.
1997-02-01 03:05:36 +00:00
Jim Meyering
858afc04d2
[HAVE_PATHS_H]: Include <paths.h>.
...
[_PATH_DEFPATH]: Use this to define DEFAULT_LOGIN_PATH.
[_PATH_DEFPATH_ROOT]: Use this to define DEFAULT_ROOT_LOGIN_PATH.
From Rik Faith.
1996-12-19 04:20:53 +00:00
Jim Meyering
5582e6dad3
change bug-reporting address
1996-11-03 03:16:27 +00:00
Jim Meyering
b8e689dc67
change bug-reporting address
1996-11-02 20:44:15 +00:00
Jim Meyering
f04044ed86
(main): update --version output to conform to coding standard
1996-10-05 16:37:57 +00:00