OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 25 matching lines...) Expand all Loading... |
36 void Usage(const std::string& me) { | 36 void Usage(const std::string& me) { |
37 fprintf(stderr, | 37 fprintf(stderr, |
38 "Usage: %s -L -l LABEL [OPTION]... COMMAND [ARG]...\n" | 38 "Usage: %s -L -l LABEL [OPTION]... COMMAND [ARG]...\n" |
39 " %s -U -l LABEL\n" | 39 " %s -U -l LABEL\n" |
40 "Load and unload on-demand Mach services from launchd.\n" | 40 "Load and unload on-demand Mach services from launchd.\n" |
41 "\n" | 41 "\n" |
42 " -L, --load load (submit) the job identified by --label;\n" | 42 " -L, --load load (submit) the job identified by --label;\n" |
43 " COMMAND must be specified\n" | 43 " COMMAND must be specified\n" |
44 " -U, --unload unload (remove) the job identified by --label\n" | 44 " -U, --unload unload (remove) the job identified by --label\n" |
45 " -l, --label=LABEL identify the job to launchd with LABEL\n" | 45 " -l, --label=LABEL identify the job to launchd with LABEL\n" |
46 " -m, --mach_service=SERVICE register SERVICE with the bootstrap server\n" | 46 " -m, --mach-service=SERVICE register SERVICE with the bootstrap server\n" |
47 " --help display this help and exit\n" | 47 " --help display this help and exit\n" |
48 " --version output version information and exit\n", | 48 " --version output version information and exit\n", |
49 me.c_str(), | 49 me.c_str(), |
50 me.c_str()); | 50 me.c_str()); |
51 ToolSupport::UsageTail(me); | 51 ToolSupport::UsageTail(me); |
52 } | 52 } |
53 | 53 |
54 int OnDemandServiceToolMain(int argc, char* argv[]) { | 54 int OnDemandServiceToolMain(int argc, char* argv[]) { |
55 const std::string me(basename(argv[0])); | 55 const std::string me(basename(argv[0])); |
56 | 56 |
(...skipping 21 matching lines...) Expand all Loading... |
78 struct { | 78 struct { |
79 Operation operation; | 79 Operation operation; |
80 std::string job_label; | 80 std::string job_label; |
81 std::vector<std::string> mach_services; | 81 std::vector<std::string> mach_services; |
82 } options = {}; | 82 } options = {}; |
83 | 83 |
84 const struct option long_options[] = { | 84 const struct option long_options[] = { |
85 {"load", no_argument, nullptr, kOptionLoadJob}, | 85 {"load", no_argument, nullptr, kOptionLoadJob}, |
86 {"unload", no_argument, nullptr, kOptionUnloadJob}, | 86 {"unload", no_argument, nullptr, kOptionUnloadJob}, |
87 {"label", required_argument, nullptr, kOptionJobLabel}, | 87 {"label", required_argument, nullptr, kOptionJobLabel}, |
88 {"mach_service", required_argument, nullptr, kOptionMachService}, | 88 {"mach-service", required_argument, nullptr, kOptionMachService}, |
89 {"help", no_argument, nullptr, kOptionHelp}, | 89 {"help", no_argument, nullptr, kOptionHelp}, |
90 {"version", no_argument, nullptr, kOptionVersion}, | 90 {"version", no_argument, nullptr, kOptionVersion}, |
91 {nullptr, 0, nullptr, 0}, | 91 {nullptr, 0, nullptr, 0}, |
92 }; | 92 }; |
93 | 93 |
94 int opt; | 94 int opt; |
95 while ((opt = getopt_long(argc, argv, "+LUl:m:", long_options, nullptr)) != | 95 while ((opt = getopt_long(argc, argv, "+LUl:m:", long_options, nullptr)) != |
96 -1) { | 96 -1) { |
97 switch (opt) { | 97 switch (opt) { |
98 case kOptionLoadJob: | 98 case kOptionLoadJob: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 } // namespace | 192 } // namespace |
193 } // namespace crashpad | 193 } // namespace crashpad |
194 | 194 |
195 int main(int argc, char* argv[]) { | 195 int main(int argc, char* argv[]) { |
196 return crashpad::OnDemandServiceToolMain(argc, argv); | 196 return crashpad::OnDemandServiceToolMain(argc, argv); |
197 } | 197 } |
OLD | NEW |