--- /dev/null
+/* guestfish - the filesystem interactive shell
+ * Copyright (C) 2009 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "fish.h"
+
+int
+do_echo (const char *cmd, int argc, char *argv[])
+{
+ int i;
+
+ for (i = 0; i < argc; ++i) {
+ if (i > 0) printf (" ");
+ printf ("%s", argv[i]);
+ }
+ printf ("\n");
+
+ return 0;
+}
else if (strcasecmp (cmd, "alloc") == 0 ||
strcasecmp (cmd, "allocate") == 0)
return do_alloc (cmd, argc, argv);
+ else if (strcasecmp (cmd, "echo") == 0)
+ return do_echo (cmd, argc, argv);
else if (strcasecmp (cmd, "edit") == 0 ||
strcasecmp (cmd, "vi") == 0 ||
strcasecmp (cmd, "emacs") == 0)
printf ("%-20s %s\n",
"alloc", "allocate an image");
printf ("%-20s %s\n",
+ "echo", "display a line of text");
+ printf ("%-20s %s\n",
"edit", "edit a file in the image");
/* actions are printed after this (see list_commands) */
" <nn>M or <nn>MB number of megabytes\n"
" <nn>G or <nn>GB number of gigabytes\n"
" <nn>sects number of 512 byte sectors\n");
+ else if (strcasecmp (cmd, "echo") == 0)
+ printf ("echo - display a line of text\n"
+ " echo [<params> ...]\n"
+ "\n"
+ " This echos the parameters to the terminal.\n");
else if (strcasecmp (cmd, "edit") == 0 ||
strcasecmp (cmd, "vi") == 0 ||
strcasecmp (cmd, "emacs") == 0)
/* in alloc.c */
extern int do_alloc (const char *cmd, int argc, char *argv[]);
+/* in echo.c */
+extern int do_echo (const char *cmd, int argc, char *argv[]);
+
/* in edit.c */
extern int do_edit (const char *cmd, int argc, char *argv[]);