From 11d6079ed3cb067dc66a795a1c7565c13afd5a00 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sat, 31 Oct 2015 12:15:25 -0700 Subject: 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". --- lib/lib.c | 8 ++++++++ lib/lib.h | 1 + 2 files changed, 9 insertions(+) (limited to 'lib') 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); -- cgit v1.2.3