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

Side by Side Diff: tools/android/common/daemon.cc

Issue 819223002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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 | « testing/android/native_test_launcher.cc ('k') | tools/android/forwarder/forwarder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/android/common/daemon.h" 5 #include "tools/android/common/daemon.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 15 matching lines...) Expand all
26 void CloseFileDescriptor(int fd) { 26 void CloseFileDescriptor(int fd) {
27 int old_errno = errno; 27 int old_errno = errno;
28 close(fd); 28 close(fd);
29 errno = old_errno; 29 errno = old_errno;
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 namespace tools { 34 namespace tools {
35 35
36 bool HasHelpSwitch(const CommandLine& command_line) { 36 bool HasHelpSwitch(const base::CommandLine& command_line) {
37 return command_line.HasSwitch("h") || command_line.HasSwitch("help"); 37 return command_line.HasSwitch("h") || command_line.HasSwitch("help");
38 } 38 }
39 39
40 bool HasNoSpawnDaemonSwitch(const CommandLine& command_line) { 40 bool HasNoSpawnDaemonSwitch(const base::CommandLine& command_line) {
41 return command_line.HasSwitch(kNoSpawnDaemon); 41 return command_line.HasSwitch(kNoSpawnDaemon);
42 } 42 }
43 43
44 void ShowHelp(const char* program, 44 void ShowHelp(const char* program,
45 const char* extra_title, 45 const char* extra_title,
46 const char* extra_descriptions) { 46 const char* extra_descriptions) {
47 printf("Usage: %s [-%s] %s\n" 47 printf("Usage: %s [-%s] %s\n"
48 " -%s stops from spawning a daemon process\n%s", 48 " -%s stops from spawning a daemon process\n%s",
49 program, kNoSpawnDaemon, extra_title, kNoSpawnDaemon, 49 program, kNoSpawnDaemon, extra_title, kNoSpawnDaemon,
50 extra_descriptions); 50 extra_descriptions);
(...skipping 15 matching lines...) Expand all
66 66
67 // Close the standard input and outputs, otherwise the process may block 67 // Close the standard input and outputs, otherwise the process may block
68 // adbd when the shell exits. 68 // adbd when the shell exits.
69 // Comment out these lines if you want to see outputs for debugging. 69 // Comment out these lines if you want to see outputs for debugging.
70 CloseFileDescriptor(0); 70 CloseFileDescriptor(0);
71 CloseFileDescriptor(1); 71 CloseFileDescriptor(1);
72 CloseFileDescriptor(2); 72 CloseFileDescriptor(2);
73 } 73 }
74 74
75 } // namespace tools 75 } // namespace tools
OLDNEW
« no previous file with comments | « testing/android/native_test_launcher.cc ('k') | tools/android/forwarder/forwarder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698