1 /* MI Command Set - target commands.
2 Copyright (C) 2007-2012 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 const struct mi_opt opts[] =
36 static const char prefix[] = "-target-file-get";
38 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
40 error (_("-target-file-get: Usage: REMOTE_FILE LOCAL_FILE"));
42 remote_file = argv[oind];
43 local_file = argv[oind + 1];
45 remote_file_get (remote_file, local_file, 0);
48 /* Send a file to the target. */
51 mi_cmd_target_file_put (char *command, char **argv, int argc)
55 const char *remote_file, *local_file;
56 static const struct mi_opt opts[] =
60 static const char prefix[] = "-target-file-put";
62 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
64 error (_("-target-file-put: Usage: LOCAL_FILE REMOTE_FILE"));
66 local_file = argv[oind];
67 remote_file = argv[oind + 1];
69 remote_file_put (local_file, remote_file, 0);
72 /* Delete a file on the target. */
75 mi_cmd_target_file_delete (char *command, char **argv, int argc)
79 const char *remote_file;
80 static const struct mi_opt opts[] =
84 static const char prefix[] = "-target-file-delete";
86 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
88 error (_("-target-file-delete: Usage: REMOTE_FILE"));
90 remote_file = argv[oind];
92 remote_file_delete (remote_file, 0);