1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* test-shell.c - A small program to allow testing of a wide variety of
3 gnome-vfs functionality
5 Copyright (C) 2000 Free Software Foundation
7 The Gnome Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The Gnome Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the Gnome Library; see the file COPYING.LIB. If not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Author: Michael Meeks <mmeeks@gnu.org>
24 NB. This code leaks everywhere, don't loose hair.
30 #include <glib/ghash.h>
31 #include <glib/gstrfuncs.h>
32 #include <glib/gstring.h>
33 #include <glib/gmessages.h>
34 #include <glib/gutils.h>
35 #include <libgnomevfs/gnome-vfs-init.h>
36 #include <libgnomevfs/gnome-vfs-directory.h>
37 #include <libgnomevfs/gnome-vfs-find-directory.h>
38 #include <libgnomevfs/gnome-vfs-ops.h>
39 #include <libgnomevfs/gnome-vfs-ssl.h>
40 #include <libgnomevfs/gnome-vfs-module-callback.h>
41 #include <libgnomevfs/gnome-vfs-standard-callbacks.h>
51 static char delim[]=" ";
52 static char **arg_data = NULL;
53 static int arg_cur = 0;
55 static char *cur_dir = NULL;
57 static GHashTable *files = NULL;
63 show_if_error (GnomeVFSResult result, const char *what, const char *what2)
65 if (result != GNOME_VFS_OK) {
66 fprintf (vfserr, "%s%s `%s'\n",
67 what, what2, gnome_vfs_result_to_string (result));
74 register_file (const char *str, GnomeVFSHandle *handle)
77 fprintf (vfserr, "Need a valid name");
79 g_hash_table_insert (files, g_strdup (str), handle);
82 static GnomeVFSHandle *
83 lookup_file (const char *str)
85 GnomeVFSHandle *handle;
88 fprintf (vfserr, "Invalid handle '%s'\n", str);
92 handle = g_hash_table_lookup (files, str);
94 fprintf (vfserr, "Can't find handle '%s'\n", str);
100 close_file (const char *str)
102 GnomeVFSResult result;
103 gpointer hash_key, value;
106 fprintf (vfserr, "Can't close NULL handles\n");
108 else if (g_hash_table_lookup_extended (files, str, &hash_key, &value)) {
109 g_hash_table_remove (files, str);
111 result = gnome_vfs_close ((GnomeVFSHandle *)value);
112 show_if_error (result, "closing ", (char *)hash_key);
117 fprintf (vfserr, "Unknown file handle '%s'\n", str);
121 kill_file_cb (gpointer key,
125 GnomeVFSResult result;
127 result = gnome_vfs_close (value);
128 show_if_error (result, "closing ", key);
137 g_hash_table_foreach_remove (files, kill_file_cb, NULL);
138 g_hash_table_destroy (files);
144 GnomeVFSResult result;
146 GnomeVFSFileInfo *info;
149 if (!arg_data [arg_cur])
152 path = arg_data [arg_cur++];
154 result = gnome_vfs_directory_list_load
156 GNOME_VFS_FILE_INFO_DEFAULT |
157 GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
158 if (show_if_error (result, "open directory ", cur_dir))
161 for (node = list; node != NULL; node = node->next) {
162 char prechar = '\0', postchar = '\0';
165 if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) {
166 switch (info->type) {
167 case GNOME_VFS_FILE_TYPE_DIRECTORY:
171 case GNOME_VFS_FILE_TYPE_UNKNOWN:
174 case GNOME_VFS_FILE_TYPE_FIFO:
177 case GNOME_VFS_FILE_TYPE_SOCKET:
180 case GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE:
181 case GNOME_VFS_FILE_TYPE_BLOCK_DEVICE:
184 case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK:
194 printf ("%c%s%c", prechar, info->name, postchar);
196 if (strlen (info->name) < 40) {
199 pad = 40 - strlen (info->name) -
200 (prechar?1:0) - (postchar?1:0);
202 for (i = 0; i < pad; i++)
205 if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
207 printf (" : %ld bytes", i);
210 if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) {
211 printf (", type '%s'", info->mime_type);
217 gnome_vfs_file_info_list_free (list);
223 printf ("command can be one or all of:\n");
224 printf ("Main operations:\n");
225 printf (" * ls [opt_dir] list files\n");
226 printf (" * cd [dir] enter storage\n");
227 printf (" * mv <a> <b> move object\n");
228 printf (" * rm <file> remove stream\n");
229 printf (" * mkdir <dir> make storage\n");
230 printf (" * rmdir <dir> remove storage\n");
231 printf (" * info,stat <a> get information on object\n");
232 printf (" * cat,type <a> dump text file to console\n");
233 printf (" * dump <a> dump binary file to console\n");
234 printf (" * sync: for sinkers\n");
235 printf (" * ssl: displays ssl enabled state\n");
236 printf (" * findtrash: locates a trash directory for a URI\n");
237 printf (" * quit,exit,bye: exit\n");
238 printf ("File operations:\n");
239 printf (" * open <handle> <name>: open a file\n");
240 printf (" * create <handle> <name>: create a file\n");
241 printf (" * handleinfo <handle>: information from handle\n");
242 printf (" * close <handle>: close a file\n");
243 printf (" * read <handle> <bytes>: read bytes from stream\n");
244 printf (" * seek <handle> <pos>: seek set position\n");
248 simple_regexp (const char *regexp, const char *fname)
253 g_return_val_if_fail (fname != NULL, FALSE);
254 g_return_val_if_fail (regexp != NULL, FALSE);
256 for (i = j = 0; regexp [i] && fname [j]; j++, i++) {
257 if (regexp [i] == '\\' &&
258 !(i > 0 && regexp [i - 1] == '\\')) {
263 if (regexp [i] == '.' &&
264 !(i > 0 && regexp [i - 1] == '\\'))
267 if (g_ascii_tolower (regexp [i]) != g_ascii_tolower (fname [j])) {
273 if (regexp [i] && regexp [i] == '*')
276 else if (!regexp [i] && fname [j])
279 else if (!fname [j] && regexp [i])
283 printf ("'%s' matched '%s'\n", regexp, fname);*/
289 validate_path (const char *path)
291 GnomeVFSResult result;
294 result = gnome_vfs_directory_list_load (
295 &list, path, GNOME_VFS_FILE_INFO_DEFAULT);
297 if (show_if_error (result, "open directory ", path)) {
301 gnome_vfs_file_info_list_free (list);
307 get_regexp_name (const char *regexp, const char *path, gboolean dir)
309 GnomeVFSResult result;
311 GnomeVFSFileInfo *info;
314 result = gnome_vfs_directory_list_load (
315 &list, path, GNOME_VFS_FILE_INFO_DEFAULT);
317 if (show_if_error (result, "open directory ", path))
320 for (node = list; node != NULL; node = node->next) {
323 if (simple_regexp (regexp, info->name)) {
324 if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) {
325 if ((dir && info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) ||
326 (!dir && info->type != GNOME_VFS_FILE_TYPE_DIRECTORY)) {
327 res = g_strdup (info->name);
331 fprintf (vfserr, "Can't cope with no type data");
332 res = g_strdup (info->name);
337 gnome_vfs_file_info_list_free (list);
347 p = arg_data [arg_cur++];
350 fprintf (vfserr, "Takes a directory argument\n");
354 if (!g_ascii_strcasecmp (p, "..")) {
357 GString *newp = g_string_new ("");
359 tmp = g_strsplit (cur_dir, "/", -1);
364 while (tmp [lp + 1]) {
365 g_string_append_printf (newp, "%s/", tmp [lp]);
370 g_string_free (newp, FALSE);
371 } else if (!g_ascii_strcasecmp (p, ".")) {
375 if (strchr (p, ':') ||
377 if (p [strlen (p) - 1] != '/')
378 newpath = g_strconcat (p, "/", NULL);
380 newpath = g_strdup (p);
384 ptr = get_regexp_name (p, cur_dir, TRUE);
386 fprintf (vfserr, "Can't find '%s'\n", p);
390 newpath = g_strconcat (cur_dir, ptr, "/", NULL);
393 if (validate_path (newpath)) {
397 fprintf (vfserr, "Invalid path %s\n", newpath);
404 char *fname, *reg_name, *f;
406 if (!arg_data [arg_cur])
409 reg_name = arg_data [arg_cur++];
410 fname = get_regexp_name (reg_name, cur_dir, FALSE);
415 if (strchr (fname, ':') ||
417 f = g_strdup (fname);
419 f = g_strconcat (cur_dir, fname, NULL);
421 f = g_strdup (fname);
430 GnomeVFSHandle *from_handle;
431 GnomeVFSResult result;
435 result = gnome_vfs_open (&from_handle, from, GNOME_VFS_OPEN_READ);
436 if (show_if_error (result, "open ", from))
440 GnomeVFSFileSize bytes_read;
443 result = gnome_vfs_read (from_handle, data, 1024, &bytes_read);
444 if (show_if_error (result, "read ", from))
450 if (bytes_read > 0 &&
452 data [bytes_read] = '\0';
455 g_warning ("Wierd error from vfs_read");
457 fprintf (stdout, "%s", data);
460 result = gnome_vfs_close (from_handle);
461 if (show_if_error (result, "close ", from))
463 fprintf (stdout, "\n");
470 GnomeVFSResult result;
472 fname = get_fname ();
474 result = gnome_vfs_unlink (fname);
475 if (show_if_error (result, "unlink ", fname))
483 GnomeVFSResult result;
485 fname = get_fname ();
487 result = gnome_vfs_make_directory (fname, GNOME_VFS_PERM_USER_ALL);
488 if (show_if_error (result, "mkdir ", fname))
496 GnomeVFSResult result;
498 fname = get_fname ();
500 result = gnome_vfs_remove_directory (fname);
501 if (show_if_error (result, "rmdir ", fname))
510 GnomeVFSResult result;
515 fprintf (vfserr, "mv <from> <to>\n");
519 result = gnome_vfs_move (from, to, FALSE);
521 msg = g_strdup_printf ("%s to %s", from, to);
522 show_if_error (result, "move ", msg);
531 GnomeVFSResult result;
532 GnomeVFSURI *from_uri;
533 GnomeVFSURI *result_vfs_uri;
537 from_uri = gnome_vfs_uri_new (from);
538 result = gnome_vfs_find_directory (from_uri,
539 GNOME_VFS_DIRECTORY_KIND_TRASH,
543 if (result != GNOME_VFS_OK) {
544 fprintf (stdout, "couldn't find or create trash there, error code %d", result);
546 uri_as_string = gnome_vfs_uri_to_string (result_vfs_uri, GNOME_VFS_URI_HIDE_NONE);
547 fprintf (stdout, "trash found or created here: %s", uri_as_string);
548 g_free (uri_as_string);
551 gnome_vfs_uri_unref (from_uri);
552 gnome_vfs_uri_unref (result_vfs_uri);
558 if (gnome_vfs_ssl_enabled ())
559 fprintf (stdout, "SSL enabled\n");
561 fprintf (stdout, "SSL disabled\n");
565 print_info (GnomeVFSFileInfo *info)
567 const char *mime_type;
570 fprintf (stdout, "Name: '%s'\n", info->name);
571 if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) {
572 fprintf (stdout, "Type: ");
573 switch (info->type) {
574 case GNOME_VFS_FILE_TYPE_UNKNOWN:
575 fprintf (stdout, "unknown");
577 case GNOME_VFS_FILE_TYPE_REGULAR:
578 fprintf (stdout, "regular");
580 case GNOME_VFS_FILE_TYPE_DIRECTORY:
581 fprintf (stdout, "directory");
583 case GNOME_VFS_FILE_TYPE_FIFO:
584 fprintf (stdout, "fifo");
586 case GNOME_VFS_FILE_TYPE_SOCKET:
587 fprintf (stdout, "socket");
589 case GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE:
590 fprintf (stdout, "char");
592 case GNOME_VFS_FILE_TYPE_BLOCK_DEVICE:
593 fprintf (stdout, "block");
595 case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK:
596 fprintf (stdout, "symlink\n");
597 fprintf (stdout, "symlink points to: %s",
601 fprintf (stdout, "Error; invalid value");
605 fprintf (stdout, "Type invalid");
606 fprintf (stdout, "\n");
608 if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
610 fprintf (stdout, "Size: %ld bytes", i);
612 fprintf (stdout, "Size invalid");
614 fprintf (stdout, "\n");
616 mime_type = gnome_vfs_file_info_get_mime_type (info);
618 fprintf (stdout, "Mime Type: %s \n", mime_type);
620 loctime = localtime(&info->atime);
621 fprintf (stdout, "Last Accessed: %s", asctime(loctime));
622 loctime = localtime(&info->mtime);
623 fprintf (stdout, "Last Modified: %s", asctime(loctime));
624 loctime = localtime(&info->ctime);
625 fprintf (stdout, "Last Changed: %s", asctime(loctime));
627 fprintf (stdout, "uid: %d\n", info->uid);
629 fprintf (stdout, "gid: %d\n", info->gid);
630 fprintf (stdout, "\n");
631 /* FIXME bugzilla.eazel.com 2800: hack here; should dump them all */
638 GnomeVFSResult result;
639 GnomeVFSFileInfo *info;
644 info = gnome_vfs_file_info_new ();
645 result = gnome_vfs_get_file_info (
646 from, info, GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
648 if (show_if_error (result, "getting info on: ", from))
652 gnome_vfs_file_info_unref (info);
660 GnomeVFSHandle *from_handle = NULL;
661 GnomeVFSHandle *to_handle = NULL;
662 GnomeVFSResult result;
669 fprintf (vfserr, "cp <from> <to>\n");
673 result = gnome_vfs_open (&from_handle, from, GNOME_VFS_OPEN_READ);
674 if (show_if_error (result, "open ", from))
677 result = gnome_vfs_open (&to_handle, to, GNOME_VFS_OPEN_WRITE);
678 if (result == GNOME_VFS_ERROR_NOT_FOUND)
679 result = gnome_vfs_create (&to_handle, to, GNOME_VFS_OPEN_WRITE, FALSE,
680 GNOME_VFS_PERM_USER_ALL);
681 if (show_if_error (result, "open ", to))
685 GnomeVFSFileSize bytes_read;
686 GnomeVFSFileSize bytes_written;
689 result = gnome_vfs_read (from_handle, data, 1024, &bytes_read);
690 if (show_if_error (result, "read ", from))
696 result = gnome_vfs_write (to_handle, data, bytes_read, &bytes_written);
697 if (show_if_error (result, "write ", to))
700 if (bytes_read != bytes_written)
701 fprintf (vfserr, "Didn't write it all");
709 result = gnome_vfs_close (to_handle);
710 if (show_if_error (result, "close ", to))
715 result = gnome_vfs_close (from_handle);
716 if (show_if_error (result, "close ", from))
722 ms_ole_dump (guint8 const *ptr, guint32 len, guint32 offset)
727 for (lp = 0;lp<(len+15)/16;lp++) {
728 printf ("%8x | ", lp*16 + offset);
729 for (lp2=0;lp2<16;lp2++) {
731 off<len?printf("%2x ", ptr[off]):printf("XX ");
734 for (lp2=0;lp2<16;lp2++) {
736 printf ("%c", off<len?(ptr[off]>'!'&&ptr[off]<127?ptr[off]:'.'):'*');
746 GnomeVFSHandle *from_handle;
747 GnomeVFSResult result;
752 result = gnome_vfs_open (&from_handle, from, GNOME_VFS_OPEN_READ);
753 if (show_if_error (result, "open ", from))
756 for (offset = 0; 1; ) {
757 GnomeVFSFileSize bytes_read;
760 result = gnome_vfs_read (from_handle, data, 1024, &bytes_read);
761 if (show_if_error (result, "read ", from))
767 ms_ole_dump (data, bytes_read, offset);
769 offset += bytes_read;
772 result = gnome_vfs_close (from_handle);
773 if (show_if_error (result, "close ", from))
779 * ---------------------------------------------------------------------
785 if (!arg_data [arg_cur])
788 return arg_data [arg_cur++];
794 if (!arg_data [arg_cur])
797 return atoi (arg_data [arg_cur++]);
804 GnomeVFSHandle *from_handle;
805 GnomeVFSResult result;
807 handle = get_handle ();
810 if (!handle || !from) {
811 fprintf (vfserr, "open <handle> <filename>\n");
815 result = gnome_vfs_open (&from_handle, from, GNOME_VFS_OPEN_READ);
816 if (show_if_error (result, "open ", from))
819 register_file (handle, from_handle);
826 GnomeVFSHandle *from_handle;
827 GnomeVFSResult result;
829 handle = get_handle ();
832 if (!handle || !from) {
833 fprintf (vfserr, "create <handle> <filename>\n");
837 result = gnome_vfs_create (&from_handle, from, GNOME_VFS_OPEN_READ,
838 FALSE, GNOME_VFS_PERM_USER_READ |
839 GNOME_VFS_PERM_USER_WRITE);
840 if (show_if_error (result, "create ", from))
843 register_file (handle, from_handle);
851 GnomeVFSHandle *from_handle;
852 GnomeVFSResult result;
853 GnomeVFSFileSize bytes_read;
856 handle = get_handle ();
860 fprintf (vfserr, "Can't read %d bytes\n", length);
864 from_handle = lookup_file (handle);
868 data = g_malloc (length);
869 result = gnome_vfs_read (from_handle, data, length, &bytes_read);
870 if (show_if_error (result, "read ", handle))
873 ms_ole_dump (data, bytes_read, 0);
881 GnomeVFSHandle *from_handle;
882 GnomeVFSResult result;
884 handle = get_handle ();
888 fprintf (vfserr, "Can't seek to %d bytes offset\n", offset);
892 from_handle = lookup_file (handle);
896 result = gnome_vfs_seek (from_handle, GNOME_VFS_SEEK_START, offset);
897 if (show_if_error (result, "seek ", handle))
904 close_file (get_handle ());
910 const char *handlename = get_handle ();
911 GnomeVFSResult result;
912 GnomeVFSHandle *handle = lookup_file (handlename);
913 GnomeVFSFileInfo *info;
918 info = gnome_vfs_file_info_new ();
919 result = gnome_vfs_get_file_info_from_handle (handle, info,
920 GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
922 if (show_if_error (result, "getting info from handle: ", handlename))
926 gnome_vfs_file_info_unref (info);
930 * ---------------------------------------------------------------------
933 GMainLoop *main_loop = NULL;
936 const struct poptOption options [] = {
937 { "interactive", 'i', POPT_ARG_NONE, &interactive, 0,
938 "Allow interactive input", NULL },
939 { NULL, '\0', 0, NULL, 0 }
943 callback (GIOChannel *source,
944 GIOCondition condition,
951 len = read (0, buf, sizeof (buf) - 1);
953 if (len + strlen (buffer) + 1 > 1024)
954 len = 1024 - strlen (buffer) - 1;
957 strcat (buffer, buf);
959 if (strchr (buf, '\n') != NULL &&
961 g_main_loop_quit (main_loop);
968 get_input_string (const char *prompt)
973 fgets (buffer, 511, stdin);
974 if (strchr (buffer, '\n'))
975 *strchr (buffer, '\n') = '\0';
977 return g_strndup (buffer, 512);
981 authentication_callback (gconstpointer in, size_t in_size,
982 gpointer out, size_t out_size,
985 GnomeVFSModuleCallbackAuthenticationIn *in_real;
986 GnomeVFSModuleCallbackAuthenticationOut *out_real;
988 g_return_if_fail (sizeof (GnomeVFSModuleCallbackAuthenticationIn) == in_size
989 && sizeof (GnomeVFSModuleCallbackAuthenticationOut) == out_size);
991 g_return_if_fail (in != NULL);
992 g_return_if_fail (out != NULL);
994 in_real = (GnomeVFSModuleCallbackAuthenticationIn *)in;
995 out_real = (GnomeVFSModuleCallbackAuthenticationOut *)out;
997 printf ("Authenticate for uri: %s realm: %s\n", in_real->uri, in_real->realm);
999 out_real->username = get_input_string ("Username:\n");
1000 out_real->password = get_input_string ("Password:\n");
1004 main (int argc, const char **argv)
1006 poptContext popt_context;
1008 char *buffer = g_new (char, 1024) ;
1012 /* default to interactive on a terminal */
1013 interactive = isatty (0);
1015 files = g_hash_table_new (g_str_hash, g_str_equal);
1017 popt_context = poptGetContext ("test-vfs", argc, argv,
1025 if (!gnome_vfs_init ()) {
1026 fprintf (vfserr, "Cannot initialize gnome-vfs.\n");
1029 gnome_vfs_module_callback_push
1030 (GNOME_VFS_MODULE_CALLBACK_AUTHENTICATION,
1031 authentication_callback, NULL, NULL);
1034 args = poptGetArgs (popt_context);
1036 cur_dir = g_get_current_dir ();
1038 cur_dir = g_strdup (args [0]);
1040 if (cur_dir && cur_dir [strlen (cur_dir)] != '/') {
1041 char *new_dir = g_strconcat (cur_dir, "/", NULL);
1046 poptFreeContext (popt_context);
1054 strcpy (buffer, "");
1056 main_loop = g_main_loop_new (NULL, TRUE);
1058 ioc = g_io_channel_unix_new (0 /* stdin */);
1059 watch_id = g_io_add_watch (ioc,
1060 G_IO_IN | G_IO_HUP | G_IO_ERR,
1062 g_io_channel_unref (ioc);
1065 fprintf (stdout,"\n%s > ", cur_dir);
1069 g_main_loop_run (main_loop);
1071 g_source_remove (watch_id);
1073 g_main_loop_unref (main_loop);
1076 /* In non-interactive mode we just do this evil
1079 fgets (buffer, 1023, instream);
1086 if (!buffer || buffer [0] == '#')
1089 arg_data = g_strsplit (g_strchomp (buffer), delim, -1);
1091 if ((!arg_data || !arg_data[0]) && interactive) continue;
1093 printf ("Command : '%s'\n", arg_data [0]);
1094 ptr = arg_data[arg_cur++];
1098 if (g_ascii_strcasecmp (ptr, "ls") == 0)
1100 else if (g_ascii_strcasecmp (ptr, "cd") == 0)
1102 else if (g_ascii_strcasecmp (ptr, "dump") == 0)
1104 else if (g_ascii_strcasecmp (ptr, "type") == 0 ||
1105 g_ascii_strcasecmp (ptr, "cat") == 0)
1107 else if (g_ascii_strcasecmp (ptr, "cp") == 0)
1109 else if (g_ascii_strcasecmp (ptr, "rm") == 0)
1111 else if (g_ascii_strcasecmp (ptr, "mkdir") == 0)
1113 else if (g_ascii_strcasecmp (ptr, "rmdir") == 0)
1115 else if (g_ascii_strcasecmp (ptr, "mv") == 0)
1117 else if (g_ascii_strcasecmp (ptr, "info") == 0 ||
1118 g_ascii_strcasecmp (ptr, "stat") == 0)
1120 else if (g_ascii_strcasecmp (ptr, "findtrash") == 0)
1122 else if (g_ascii_strcasecmp (ptr, "ssl") == 0)
1124 else if (g_ascii_strcasecmp (ptr, "sync") == 0)
1125 fprintf (vfserr, "a shell is like a boat, it lists or syncs (RMS)\n");
1126 else if (g_ascii_strcasecmp (ptr,"help") == 0 ||
1127 g_ascii_strcasecmp (ptr,"?") == 0 ||
1128 g_ascii_strcasecmp (ptr,"info") == 0 ||
1129 g_ascii_strcasecmp (ptr,"man") == 0)
1131 else if (g_ascii_strcasecmp (ptr,"exit") == 0 ||
1132 g_ascii_strcasecmp (ptr,"quit") == 0 ||
1133 g_ascii_strcasecmp (ptr,"q") == 0 ||
1134 g_ascii_strcasecmp (ptr,"bye") == 0)
1138 else if (g_ascii_strcasecmp (ptr, "open") == 0)
1140 else if (g_ascii_strcasecmp (ptr, "create") == 0)
1142 else if (g_ascii_strcasecmp (ptr, "close") == 0)
1144 else if (g_ascii_strcasecmp (ptr, "handleinfo") == 0)
1146 else if (g_ascii_strcasecmp (ptr, "read") == 0)
1148 else if (g_ascii_strcasecmp (ptr, "seek") == 0)
1152 fprintf (vfserr, "Unknown command '%s'", ptr);
1154 g_strfreev (arg_data);