diff options
author | ache <ache@FreeBSD.org> | 2006-03-27 23:11:32 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2006-03-27 23:11:32 +0000 |
commit | a258086b155a31bd51f007eedf6609f15ba108f9 (patch) | |
tree | dfd673c8ea1e7e53dced92331577c5b595c02543 /contrib/libreadline/shell.c | |
parent | 735555a46c8cb44ad1f62b338310622baec4ec1b (diff) | |
download | FreeBSD-src-a258086b155a31bd51f007eedf6609f15ba108f9.zip FreeBSD-src-a258086b155a31bd51f007eedf6609f15ba108f9.tar.gz |
Resolve conflicts
Diffstat (limited to 'contrib/libreadline/shell.c')
-rw-r--r-- | contrib/libreadline/shell.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/contrib/libreadline/shell.c b/contrib/libreadline/shell.c index e2a01a4..58ecd8e 100644 --- a/contrib/libreadline/shell.c +++ b/contrib/libreadline/shell.c @@ -1,5 +1,4 @@ /* $FreeBSD$ */ - /* shell.c -- readline utility functions that are normally provided by bash when readline is linked as part of the shell. */ @@ -50,8 +49,12 @@ # include <limits.h> #endif +#if defined (HAVE_FCNTL_H) #include <fcntl.h> +#endif +#if defined (HAVE_PWD_H) #include <pwd.h> +#endif #include <stdio.h> @@ -59,9 +62,9 @@ #include "rlshell.h" #include "xmalloc.h" -#if !defined (HAVE_GETPW_DECLS) +#if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS) extern struct passwd *getpwuid PARAMS((uid_t)); -#endif /* !HAVE_GETPW_DECLS */ +#endif /* HAVE_GETPWUID && !HAVE_GETPW_DECLS */ #ifndef NULL # define NULL 0 @@ -124,16 +127,7 @@ sh_set_lines_and_columns (lines, cols) { char *b; -#if defined (HAVE_PUTENV) - b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1); - sprintf (b, "LINES=%d", lines); - putenv (b); - - b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1); - sprintf (b, "COLUMNS=%d", cols); - putenv (b); -#else /* !HAVE_PUTENV */ -# if defined (HAVE_SETENV) +#if defined (HAVE_SETENV) b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1); sprintf (b, "%d", lines); setenv ("LINES", b, 1); @@ -143,8 +137,17 @@ sh_set_lines_and_columns (lines, cols) sprintf (b, "%d", cols); setenv ("COLUMNS", b, 1); free (b); -# endif /* HAVE_SETENV */ -#endif /* !HAVE_PUTENV */ +#else /* !HAVE_SETENV */ +# if defined (HAVE_PUTENV) + b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1); + sprintf (b, "LINES=%d", lines); + putenv (b); + + b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1); + sprintf (b, "COLUMNS=%d", cols); + putenv (b); +# endif /* HAVE_PUTENV */ +#endif /* !HAVE_SETENV */ } char * @@ -161,9 +164,11 @@ sh_get_home_dir () struct passwd *entry; home_dir = (char *)NULL; +#if defined (HAVE_GETPWUID) entry = getpwuid (getuid ()); if (entry) home_dir = entry->pw_dir; +#endif return (home_dir); } @@ -177,6 +182,7 @@ int sh_unset_nodelay_mode (fd) int fd; { +#if defined (HAVE_FCNTL) int flags, bflags; if ((flags = fcntl (fd, F_GETFL, 0)) < 0) @@ -197,6 +203,7 @@ sh_unset_nodelay_mode (fd) flags &= ~bflags; return (fcntl (fd, F_SETFL, flags)); } +#endif return 0; } |