OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |