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