1 /* MI Command Set - target commands.
2 Copyright (C) 2007 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 #include "mi-getopt.h"
24 /* Get a file from the target. */
27 mi_cmd_target_file_get (char *command, char **argv, int argc)
31 const char *remote_file, *local_file;
32 static struct mi_opt opts[] =
36 static const char *prefix = "mi_cmd_target_file_get";
38 if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) != -1
39 || optind != argc - 2)
40 error (_("mi_cmd_target_file_get: Usage: REMOTE_FILE LOCAL_FILE"));
42 remote_file = argv[optind];
43 local_file = argv[optind + 1];
45 remote_file_get (remote_file, local_file, 0);
50 /* Send a file to the target. */
53 mi_cmd_target_file_put (char *command, char **argv, int argc)
57 const char *remote_file, *local_file;
58 static struct mi_opt opts[] =
62 static const char *prefix = "mi_cmd_target_file_put";
64 if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) != -1
65 || optind != argc - 2)
66 error (_("mi_cmd_target_file_put: Usage: LOCAL_FILE REMOTE_FILE"));
68 local_file = argv[optind];
69 remote_file = argv[optind + 1];
71 remote_file_put (local_file, remote_file, 0);
76 /* Delete a file on the target. */
79 mi_cmd_target_file_delete (char *command, char **argv, int argc)
83 const char *remote_file, *local_file;
84 static struct mi_opt opts[] =
88 static const char *prefix = "mi_cmd_target_file_delete";
90 if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) != -1
91 || optind != argc - 1)
92 error (_("mi_cmd_target_file_delete: Usage: REMOTE_FILE"));
94 remote_file = argv[optind];
96 remote_file_delete (remote_file, 0);