#include <stdlib.h>
#include <glib/gstrfuncs.h>
#include <glib/gmem.h>
+#include <string.h>
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
*/
void cmd_shell(const char **cmd_argv,GError **errp)
{
-#ifdef HAVE_LIBREADLINE
char *line;
-#else /* HAVE_LIBREADLINE */
-char line[1024],*s;
+#ifndef HAVE_LIBREADLINE
+char linebuf[1024],*s;
#endif /* HAVE_LIBREADLINE */
int errint,line_argc;
const char **line_argv=NULL;
#endif /* HAVE_ADD_HISTORY */
#else /* HAVE_LIBREADLINE */
fputs(prompt,stdout); fflush(stdout);
- line=fgets(line,sizeof(line),stdin);
+ line=fgets(linebuf,sizeof(linebuf),stdin);
#endif /* HAVE_LIBREADLINE */
g_free(prompt);
if (!line) {
line_argv=NULL;
errint=poptParseArgvString(line,&line_argc,&line_argv);
-#ifndef HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
free(line);
#endif /* HAVE_LIBREADLINE */
if (errint!=0) {