From c2c34e0f850cce805ce73ef6dcde28929cefe58e Mon Sep 17 00:00:00 2001 From: dtb Date: Sun, 23 Oct 2022 02:20:19 -0400 Subject: [PATCH] some clarification --- battery/battery | 2 +- battery/batterymonitor | 2 +- pscat/pscat.1 | 2 ++ pscat/pscat.c | 10 +++++----- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/battery/battery b/battery/battery index 17eb0bc..547e4ce 100755 --- a/battery/battery +++ b/battery/battery @@ -1,7 +1,7 @@ #!/bin/sh subprogram="$(command -v "$0")" -if ! nonzero "$subprogram" && ! test -e "$0"; then +if ! str isvalue "$subprogram" && ! test -e "$0"; then printf "%s: can't find myself!\n" "$0" exit 70 # sysexits(3) EX_SOFTWARE else diff --git a/battery/batterymonitor b/battery/batterymonitor index a77dd99..e621e19 100755 --- a/battery/batterymonitor +++ b/battery/batterymonitor @@ -22,7 +22,7 @@ emit "$(printf "Current level: %d%%" "$current_level")" while true; do current_level=$(battery) - if ! [ $current_level -eq $previous_level ]; then + if ! streq $current_level $previous_level; then [ $current_level -lt $previous_level ] \ && emit "$(printf "Discharged: %d%% -> %d%%\n" $previous_level $current_level )" \ || emit "$(printf " Charged: %d%% -> %d%%\n" $previous_level $current_level )" diff --git a/pscat/pscat.1 b/pscat/pscat.1 index 4163333..6eafe53 100644 --- a/pscat/pscat.1 +++ b/pscat/pscat.1 @@ -31,6 +31,8 @@ If either could be ignored the individual exit statuses could simply be printed. Pscat's function is redundant to the sh(1) construct .RB { utility ; utility ;} - this is a feature, not a bug. +.PP +pscat [ cat | cat ] will pipe "pscat [ cat" into "cat ]", which is a potentially unexpected result of a command. .SH COPYRIGHT diff --git a/pscat/pscat.c b/pscat/pscat.c index e1c22c5..c8be6a0 100644 --- a/pscat/pscat.c +++ b/pscat/pscat.c @@ -44,11 +44,11 @@ check_arg(char **argv){ return 0; /* syntax error */ break; default: /* >= INLPAREN */ - if(SCMPFLAT(*argv, R_PAREN)){ - --s; - terms += s == NORMAL; - }else if(SCMPFLAT(*argv, L_PAREN)) /* ineligant */ - ++s; + if(argv[0][1] == '\0'){ + s -= (argv[0][0] == R_PAREN); + terms += (argv[0][0] == R_PAREN && s == NORMAL); + s += (argv[0][0] == L_PAREN); + } break; }