Re: [hackers] [slstatus] [PATCH] Remove o-flag as it is redundant
On Tue, May 22, 2018 at 12:35:21AM +0200, Laslo Hunhold wrote: > On Tue, 22 May 2018 00:22:18 +0200 > "Ivan J."wrote: > > Hey Ivan, > > > I'd love if you can show me how `slstatus -s | head -n 10` can work. > > doesn't it work for you? Or are you asking about how it works? Eh, apologies. I haven't tried it with the latest git HEAD. And no, I couldn't get it to work with an earlier version, where I would just get the first line and then it would block/hang. With sed instead of head too. -- ~ parazyd GnuPG: 03337671FDE75BB6A85EC91FB876CB44FA1B0274 GnuPG: https://parazyd.org/fa1b0274.asc
Re: [hackers] [slstatus] [PATCH] Remove o-flag as it is redundant
I'd love if you can show me how `slstatus -s | head -n 10` can work. $ slstatus -s | head -n 10 ∿ n/a n/a% | B ?80 | V 62% | C n/a% 52°C | M 6% | 2018-05-22 00:31:38 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:39 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:40 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:41 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:42 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:43 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:44 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:45 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:46 ∿ n/a n/a% | B ?80 | V 62% | C 0% 52°C | M 6% | 2018-05-22 00:31:47 [1]30928 broken pipe slstatus -s | 30929 done head -n 10 $ What's the problem? Aaron -- Web: https://drkhsh.at/ or http://drkhsh5rv6pnahas.onion/ Gopher: gopher://drkhsh.at or gopher://drkhsh5rv6pnahas.onion GPG: 0x7A65E38D55BE96FE Fingerprint: 4688 907C 8720 3318 0D9F AFDE 7A65 E38D 55BE 96FE
Re: [hackers] [slstatus] [PATCH] Remove o-flag as it is redundant
On Tue, 22 May 2018 00:22:18 +0200 "Ivan J."wrote: Hey Ivan, > I'd love if you can show me how `slstatus -s | head -n 10` can work. doesn't it work for you? Or are you asking about how it works? With best regards Laslo -- Laslo Hunhold
Re: [hackers] [slstatus] [PATCH] Remove o-flag as it is redundant
On Mon, May 21, 2018 at 09:50:57PM +0200, Laslo Hunhold wrote: > Good evening fellow hackers, > > see attached patch and give feedback, if you like. To keep it short: > Just by the Unix-principle, the o-flag for slstatus is not necessary. > It looks like yet another case of "cat -v". > > For more arguments, see the commit description. I'd love if you can show me how `slstatus -s | head -n 10` can work. -- ~ parazyd GnuPG: 03337671FDE75BB6A85EC91FB876CB44FA1B0274 GnuPG: https://parazyd.org/fa1b0274.asc
Re: [hackers] [slstatus] [PATCH] Remove o-flag as it is redundant
Laslo, Just by the Unix-principle, the o-flag for slstatus is not necessary. It looks like yet another case of "cat -v". For more arguments, see the commit description. I agree, imho we can remove the -o flag as we should adhere to the UNIX philosophy. But I am open for discussion and I will wait for other opinions before merging. Cheers! Aaron -- Web: https://drkhsh.at/ or http://drkhsh5rv6pnahas.onion/ Gopher: gopher://drkhsh.at or gopher://drkhsh5rv6pnahas.onion GPG: 0x7A65E38D55BE96FE Fingerprint: 4688 907C 8720 3318 0D9F AFDE 7A65 E38D 55BE 96FE
[hackers] [slstatus] [PATCH] Remove o-flag as it is redundant
Good evening fellow hackers, see attached patch and give feedback, if you like. To keep it short: Just by the Unix-principle, the o-flag for slstatus is not necessary. It looks like yet another case of "cat -v". For more arguments, see the commit description. With best regards Laslo Hunhold -- Laslo Hunhold>From 678d3961d37e9297de64eb93ff85d7283edc6eb8 Mon Sep 17 00:00:00 2001 From: Laslo Hunhold Date: Mon, 21 May 2018 21:31:53 +0200 Subject: [PATCH] Remove o-flag as it is redundant Even if we extend the flag to be an n-flag with a numerical input, we already have other Unix-tools to take care of us much more flexibly, e.g. with head(1) you can easily get the first 10 outputs with slstatus -s | head -n 10, but also e.g. discard the first one and then get the consecutive 10 outputs. For the X11-root-window-name, you can limit the runtime with timeout(1) or a comparable solution. This reverts commit fa8b939990ed0648f99b0cbeba4efed807160db3. --- slstatus.1 | 4 +--- slstatus.c | 13 +++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/slstatus.1 b/slstatus.1 index 9517fab..da1a99a 100644 --- a/slstatus.1 +++ b/slstatus.1 @@ -6,7 +6,7 @@ .Nd suckless status monitor .Sh SYNOPSIS .Nm -.Op Fl so +.Op Fl s .Sh DESCRIPTION .Nm is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or @@ -18,8 +18,6 @@ outputs to WM_NAME. .Bl -tag -width Ds .It Fl s Write to stdout instead of WM_NAME. -.It Fl o -Write only once and exit. .El .Sh CUSTOMIZATION .Nm diff --git a/slstatus.c b/slstatus.c index b3abafb..3222b02 100644 --- a/slstatus.c +++ b/slstatus.c @@ -42,7 +42,7 @@ difftimespec(struct timespec *res, struct timespec *a, struct timespec *b) static void usage(void) { - die("usage: %s [-so]", argv0); + die("usage: %s [-s]", argv0); } int @@ -51,18 +51,15 @@ main(int argc, char *argv[]) struct sigaction act; struct timespec start, current, diff, intspec, wait; size_t i, len; - int sflag, oflag, ret; + int sflag, ret; char status[MAXLEN]; const char *res; - sflag = oflag = 0; + sflag = 0; ARGBEGIN { case 's': sflag = 1; break; - case 'o': - oflag = 1; - break; default: usage(); } ARGEND @@ -110,10 +107,6 @@ main(int argc, char *argv[]) XFlush(dpy); } - if (oflag) { - done = 1; - } - if (!done) { if (clock_gettime(CLOCK_MONOTONIC, ) < 0) { die("clock_gettime:"); -- 2.17.0