summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2016-06-22 14:33:33 -0500
committerElliott Hughes2016-06-22 14:33:33 -0500
commitcf75c1bf14e669edc69120246894afcf723b2e3a (patch)
tree24d87ecb2043d6d96ed721d1801dbf0ed32d1bcc /toolbox
parent57bbedc036e298878f7a3af57492123393879e0e (diff)
downloadplatform-system-core-cf75c1bf14e669edc69120246894afcf723b2e3a.tar.gz
platform-system-core-cf75c1bf14e669edc69120246894afcf723b2e3a.tar.xz
platform-system-core-cf75c1bf14e669edc69120246894afcf723b2e3a.zip
Lose log to toybox.
Change-Id: I42d792e79ed51fcc3c89f77d039d39417ead03c3
Diffstat (limited to 'toolbox')
-rw-r--r--toolbox/Android.mk3
-rw-r--r--toolbox/log.c145
2 files changed, 0 insertions, 148 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index 413d61f2c..73e19de73 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -32,7 +32,6 @@ BSD_TOOLS := \
32 32
33OUR_TOOLS := \ 33OUR_TOOLS := \
34 getevent \ 34 getevent \
35 log \
36 nandread \ 35 nandread \
37 newfs_msdos \ 36 newfs_msdos \
38 sendevent \ 37 sendevent \
@@ -51,9 +50,7 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
51LOCAL_CONLYFLAGS += -std=gnu99 50LOCAL_CONLYFLAGS += -std=gnu99
52 51
53LOCAL_SHARED_LIBRARIES := \ 52LOCAL_SHARED_LIBRARIES := \
54 liblog \
55 libcutils \ 53 libcutils \
56 libselinux \
57 54
58LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS)) 55LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
59 56
diff --git a/toolbox/log.c b/toolbox/log.c
deleted file mode 100644
index 2f020a8a4..000000000
--- a/toolbox/log.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * Copyright (c) 2008, The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google, Inc. nor the names of its contributors
15 * may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include <stdio.h>
33#include <log/logd.h>
34#include <ctype.h>
35#include <sys/socket.h>
36#include <sys/types.h>
37#include <stdlib.h>
38#include <cutils/sockets.h>
39#include <unistd.h>
40
41/*
42 * Note: also accepts 0-9 priorities
43 * returns ANDROID_LOG_UNKNOWN if the character is unrecognized
44 */
45static android_LogPriority filterCharToPri (char c)
46{
47 android_LogPriority pri;
48
49 c = tolower(c);
50
51 if (c >= '0' && c <= '9') {
52 if (c >= ('0'+ANDROID_LOG_SILENT)) {
53 pri = ANDROID_LOG_VERBOSE;
54 } else {
55 pri = (android_LogPriority)(c - '0');
56 }
57 } else if (c == 'v') {
58 pri = ANDROID_LOG_VERBOSE;
59 } else if (c == 'd') {
60 pri = ANDROID_LOG_DEBUG;
61 } else if (c == 'i') {
62 pri = ANDROID_LOG_INFO;
63 } else if (c == 'w') {
64 pri = ANDROID_LOG_WARN;
65 } else if (c == 'e') {
66 pri = ANDROID_LOG_ERROR;
67 } else if (c == 'f') {
68 pri = ANDROID_LOG_FATAL;
69 } else if (c == 's') {
70 pri = ANDROID_LOG_SILENT;
71 } else if (c == '*') {
72 pri = ANDROID_LOG_DEFAULT;
73 } else {
74 pri = ANDROID_LOG_UNKNOWN;
75 }
76
77 return pri;
78}
79
80static int usage(const char *s)
81{
82 fprintf(stderr, "USAGE: %s [-p priorityChar] [-t tag] message\n", s);
83
84 fprintf(stderr, "\tpriorityChar should be one of:\n"
85 "\t\tv,d,i,w,e\n");
86 exit(-1);
87}
88
89
90int log_main(int argc, char *argv[])
91{
92 android_LogPriority priority;
93 const char *tag = "log";
94 char buffer[4096];
95 int i;
96
97 priority = ANDROID_LOG_INFO;
98
99 for (;;) {
100 int ret;
101
102 ret = getopt(argc, argv, "t:p:h");
103
104 if (ret < 0) {
105 break;
106 }
107
108 switch(ret) {
109 case 't':
110 tag = optarg;
111 break;
112
113 case 'p':
114 priority = filterCharToPri(optarg[0]);
115 if (priority == ANDROID_LOG_UNKNOWN) {
116 usage(argv[0]);
117 }
118 break;
119
120 case 'h':
121 usage(argv[0]);
122 break;
123 }
124 }
125
126 if (optind == argc) {
127 usage(argv[0]);
128 }
129
130 buffer[0] = '\0';
131
132 for (i = optind ; i < argc ; i++) {
133 strlcat(buffer, argv[i], sizeof(buffer)-1);
134 strlcat(buffer, " ", sizeof(buffer)-1);
135 }
136
137 if(buffer[0] == 0) {
138 usage(argv[0]);
139 }
140
141 __android_log_print(priority, tag, "%s", buffer);
142
143 return 0;
144}
145