| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 kOptionVersion = -3, | 75 kOptionVersion = -3, |
| 76 }; | 76 }; |
| 77 | 77 |
| 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, NULL, kOptionLoadJob}, | 85 {"load", no_argument, nullptr, kOptionLoadJob}, |
| 86 {"unload", no_argument, NULL, kOptionUnloadJob}, | 86 {"unload", no_argument, nullptr, kOptionUnloadJob}, |
| 87 {"label", required_argument, NULL, kOptionJobLabel}, | 87 {"label", required_argument, nullptr, kOptionJobLabel}, |
| 88 {"mach_service", required_argument, NULL, kOptionMachService}, | 88 {"mach_service", required_argument, nullptr, kOptionMachService}, |
| 89 {"help", no_argument, NULL, kOptionHelp}, | 89 {"help", no_argument, nullptr, kOptionHelp}, |
| 90 {"version", no_argument, NULL, kOptionVersion}, | 90 {"version", no_argument, nullptr, kOptionVersion}, |
| 91 {NULL, 0, NULL, 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, NULL)) != -1) { | 95 while ((opt = getopt_long(argc, argv, "+LUl:m:", long_options, nullptr)) != |
| 96 -1) { |
| 96 switch (opt) { | 97 switch (opt) { |
| 97 case kOptionLoadJob: | 98 case kOptionLoadJob: |
| 98 options.operation = kOperationLoadJob; | 99 options.operation = kOperationLoadJob; |
| 99 break; | 100 break; |
| 100 case kOptionUnloadJob: | 101 case kOptionUnloadJob: |
| 101 options.operation = kOperationUnloadJob; | 102 options.operation = kOperationUnloadJob; |
| 102 break; | 103 break; |
| 103 case kOptionJobLabel: | 104 case kOptionJobLabel: |
| 104 options.job_label = optarg; | 105 options.job_label = optarg; |
| 105 break; | 106 break; |
| 106 case kOptionMachService: | 107 case kOptionMachService: |
| 107 options.mach_services.push_back(optarg); | 108 options.mach_services.push_back(optarg); |
| 108 break; | 109 break; |
| 109 case kOptionHelp: | 110 case kOptionHelp: |
| 110 Usage(me); | 111 Usage(me); |
| 111 return EXIT_SUCCESS; | 112 return EXIT_SUCCESS; |
| 112 case kOptionVersion: | 113 case kOptionVersion: |
| 113 ToolSupport::Version(me); | 114 ToolSupport::Version(me); |
| 114 return EXIT_SUCCESS; | 115 return EXIT_SUCCESS; |
| 115 default: | 116 default: |
| 116 ToolSupport::UsageHint(me, NULL); | 117 ToolSupport::UsageHint(me, nullptr); |
| 117 return EXIT_FAILURE; | 118 return EXIT_FAILURE; |
| 118 } | 119 } |
| 119 } | 120 } |
| 120 argc -= optind; | 121 argc -= optind; |
| 121 argv += optind; | 122 argv += optind; |
| 122 | 123 |
| 123 if (options.job_label.empty()) { | 124 if (options.job_label.empty()) { |
| 124 ToolSupport::UsageHint(me, "must provide -l"); | 125 ToolSupport::UsageHint(me, "must provide -l"); |
| 125 return EXIT_FAILURE; | 126 return EXIT_FAILURE; |
| 126 } | 127 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 } // namespace | 192 } // namespace |
| 192 } // namespace crashpad | 193 } // namespace crashpad |
| 193 | 194 |
| 194 int main(int argc, char* argv[]) { | 195 int main(int argc, char* argv[]) { |
| 195 return crashpad::OnDemandServiceToolMain(argc, argv); | 196 return crashpad::OnDemandServiceToolMain(argc, argv); |
| 196 } | 197 } |
| OLD | NEW |