1/* $FreeBSD: head/contrib/libreadline/shell.c 136758 2004-10-21 20:02:02Z peter $ */
2
3/* shell.c -- readline utility functions that are normally provided by
4 bash when readline is linked as part of the shell. */
5
6/* Copyright (C) 1997 Free Software Foundation, Inc.
7
8 This file is part of the GNU Readline Library, a library for
9 reading lines of text with interactive input and history editing.
10
--- 112 unchanged lines hidden (view full) ---
123 int lines, cols;
124{
125 char *b;
126
127#if defined (HAVE_PUTENV)
128 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
129 sprintf (b, "LINES=%d", lines);
130 putenv (b);
131
132 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
133 sprintf (b, "COLUMNS=%d", cols);
134 putenv (b);
135#else /* !HAVE_PUTENV */
136# if defined (HAVE_SETENV)
137 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
138 sprintf (b, "%d", lines);
139 setenv ("LINES", b, 1);
140 free (b);
141
142 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
143 sprintf (b, "%d", cols);
144 setenv ("COLUMNS", b, 1);
145 free (b);
146# endif /* HAVE_SETENV */
147#endif /* !HAVE_PUTENV */
148}
149
150char *
151sh_get_env_value (varname)
152 const char *varname;
153{
--- 49 unchanged lines hidden ---
2
3/* shell.c -- readline utility functions that are normally provided by
4 bash when readline is linked as part of the shell. */
5
6/* Copyright (C) 1997 Free Software Foundation, Inc.
7
8 This file is part of the GNU Readline Library, a library for
9 reading lines of text with interactive input and history editing.
10
--- 112 unchanged lines hidden (view full) ---
123 int lines, cols;
124{
125 char *b;
126
127#if defined (HAVE_PUTENV)
128 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
129 sprintf (b, "LINES=%d", lines);
130 putenv (b);
131
132 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
133 sprintf (b, "COLUMNS=%d", cols);
134 putenv (b);
135#else /* !HAVE_PUTENV */
136# if defined (HAVE_SETENV)
137 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
138 sprintf (b, "%d", lines);
139 setenv ("LINES", b, 1);
140 free (b);
141
142 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
143 sprintf (b, "%d", cols);
144 setenv ("COLUMNS", b, 1);
145 free (b);
146# endif /* HAVE_SETENV */
147#endif /* !HAVE_PUTENV */
148}
149
150char *
151sh_get_env_value (varname)
152 const char *varname;
153{
--- 49 unchanged lines hidden ---