aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-10-31 12:15:25 -0700
committerRob Landley <rob@landley.net>2015-11-02 01:34:11 -0600
commit11d6079ed3cb067dc66a795a1c7565c13afd5a00 (patch)
tree82a93c8cdc80f69c86cb43e904b683121690166c /lib
parent71617b9ea00ed774c202346c9bf8ac2bf80dfc2e (diff)
downloadtoybox-11d6079ed3cb067dc66a795a1c7565c13afd5a00.tar.gz
Add ps -Z.
As with ls, it doesn't seem like -Z should be guarded behind LSM availability. On a non-SELinux system, the label is always "unconfined".
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c8
-rw-r--r--lib/lib.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index d9bea891..aa7b1c30 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -342,6 +342,14 @@ char *strlower(char *s)
return try;
}
+char *chomp(char *s)
+{
+ char *p = strrchr(s, '\n');
+
+ if (p) *p = 0;
+ return s;
+}
+
int unescape(char c)
{
char *from = "\\abefnrtv", *to = "\\\a\b\033\f\n\r\t\v";
diff --git a/lib/lib.h b/lib/lib.h
index dbb39f5b..ad59989a 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -168,6 +168,7 @@ long atolx(char *c);
long atolx_range(char *numstr, long low, long high);
int stridx(char *haystack, char needle);
char *strlower(char *s);
+char *chomp(char *s);
int unescape(char c);
int strstart(char **a, char *b);
off_t fdlength(int fd);