Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: tools/on_demand_service_tool.mm

Issue 627273004: Don’t use using directives (“using namespace”) in tools (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/exception_port_tool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 23
24 #include <string> 24 #include <string>
25 #include <vector> 25 #include <vector>
26 26
27 #include "base/mac/foundation_util.h" 27 #include "base/mac/foundation_util.h"
28 #include "base/strings/sys_string_conversions.h" 28 #include "base/strings/sys_string_conversions.h"
29 #include "tools/tool_support.h" 29 #include "tools/tool_support.h"
30 #include "util/mac/service_management.h" 30 #include "util/mac/service_management.h"
31 #include "util/stdlib/objc.h" 31 #include "util/stdlib/objc.h"
32 32
33 namespace crashpad {
33 namespace { 34 namespace {
34 35
35 using namespace crashpad;
36
37 void Usage(const std::string& me) { 36 void Usage(const std::string& me) {
38 fprintf(stderr, 37 fprintf(stderr,
39 "Usage: %s -L -l LABEL [OPTION]... COMMAND [ARG]...\n" 38 "Usage: %s -L -l LABEL [OPTION]... COMMAND [ARG]...\n"
40 " %s -U -l LABEL\n" 39 " %s -U -l LABEL\n"
41 "Load and unload on-demand Mach services from launchd.\n" 40 "Load and unload on-demand Mach services from launchd.\n"
42 "\n" 41 "\n"
43 " -L, --load load (submit) the job identified by --label;\n" 42 " -L, --load load (submit) the job identified by --label;\n"
44 " COMMAND must be specified\n" 43 " COMMAND must be specified\n"
45 " -U, --unload unload (remove) the job identified by --label\n" 44 " -U, --unload unload (remove) the job identified by --label\n"
46 " -l, --label=LABEL identify the job to launchd with LABEL\n" 45 " -l, --label=LABEL identify the job to launchd with LABEL\n"
47 " -m, --mach_service=SERVICE register SERVICE with the bootstrap server\n" 46 " -m, --mach_service=SERVICE register SERVICE with the bootstrap server\n"
48 " --help display this help and exit\n" 47 " --help display this help and exit\n"
49 " --version output version information and exit\n", 48 " --version output version information and exit\n",
50 me.c_str(), 49 me.c_str(),
51 me.c_str()); 50 me.c_str());
52 ToolSupport::UsageTail(me); 51 ToolSupport::UsageTail(me);
53 } 52 }
54 53
55 } // namespace 54 int OnDemandServiceToolMain(int argc, char* argv[]) {
56
57 int main(int argc, char* argv[]) {
58 const std::string me(basename(argv[0])); 55 const std::string me(basename(argv[0]));
59 56
60 enum Operation { 57 enum Operation {
61 kOperationUnknown = 0, 58 kOperationUnknown = 0,
62 kOperationLoadJob, 59 kOperationLoadJob,
63 kOperationUnloadJob, 60 kOperationUnloadJob,
64 }; 61 };
65 62
66 enum OptionFlags { 63 enum OptionFlags {
67 // “Short” (single-character) options. 64 // “Short” (single-character) options.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 180
184 return EXIT_SUCCESS; 181 return EXIT_SUCCESS;
185 } 182 }
186 183
187 default: { 184 default: {
188 ToolSupport::UsageHint(me, "must provide -L or -U"); 185 ToolSupport::UsageHint(me, "must provide -L or -U");
189 return EXIT_FAILURE; 186 return EXIT_FAILURE;
190 } 187 }
191 } 188 }
192 } 189 }
190
191 } // namespace
192 } // namespace crashpad
193
194 int main(int argc, char* argv[]) {
195 return crashpad::OnDemandServiceToolMain(argc, argv);
196 }
OLDNEW
« no previous file with comments | « tools/exception_port_tool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698