Updated copyright notices for most files.
[deliverable/binutils-gdb.git] / gdb / mi / mi-cmd-target.c
1 /* MI Command Set - target commands.
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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/>. */
18
19 #include "defs.h"
20 #include "mi-cmds.h"
21 #include "mi-getopt.h"
22 #include "remote.h"
23
24 /* Get a file from the target. */
25
26 enum mi_cmd_result
27 mi_cmd_target_file_get (char *command, char **argv, int argc)
28 {
29 int optind = 0;
30 char *optarg;
31 const char *remote_file, *local_file;
32 static struct mi_opt opts[] =
33 {
34 { 0, 0, 0 }
35 };
36 static const char *prefix = "mi_cmd_target_file_get";
37
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"));
41
42 remote_file = argv[optind];
43 local_file = argv[optind + 1];
44
45 remote_file_get (remote_file, local_file, 0);
46
47 return MI_CMD_DONE;
48 }
49
50 /* Send a file to the target. */
51
52 enum mi_cmd_result
53 mi_cmd_target_file_put (char *command, char **argv, int argc)
54 {
55 int optind = 0;
56 char *optarg;
57 const char *remote_file, *local_file;
58 static struct mi_opt opts[] =
59 {
60 { 0, 0, 0 }
61 };
62 static const char *prefix = "mi_cmd_target_file_put";
63
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"));
67
68 local_file = argv[optind];
69 remote_file = argv[optind + 1];
70
71 remote_file_put (local_file, remote_file, 0);
72
73 return MI_CMD_DONE;
74 }
75
76 /* Delete a file on the target. */
77
78 enum mi_cmd_result
79 mi_cmd_target_file_delete (char *command, char **argv, int argc)
80 {
81 int optind = 0;
82 char *optarg;
83 const char *remote_file, *local_file;
84 static struct mi_opt opts[] =
85 {
86 { 0, 0, 0 }
87 };
88 static const char *prefix = "mi_cmd_target_file_delete";
89
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"));
93
94 remote_file = argv[optind];
95
96 remote_file_delete (remote_file, 0);
97
98 return MI_CMD_DONE;
99 }
100
This page took 0.037188 seconds and 5 git commands to generate.