Update iwatch to 1.0.4.
* Support decimal franction for the interval prefix * Suport highlighting by changing color and attributes * Fix English from Preben Guldberg * Improve manage from Preben Guldberg
This commit is contained in:
parent
ab1cda3db3
commit
6865b52e1f
4 changed files with 157 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.1 2016/05/06 09:02:36 nonaka Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2017/05/31 03:59:45 nonaka Exp $
|
||||
|
||||
DISTNAME= iwatch-1.0.3
|
||||
DISTNAME= iwatch-1.0.4
|
||||
CATEGORIES= misc
|
||||
MASTER_SITES= ${MASTER_SITE_GITHUB:=iij/}
|
||||
GITHUB_TAG= v${PKGVERSION_NOREV}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
$NetBSD: distinfo,v 1.1 2016/05/06 09:02:36 nonaka Exp $
|
||||
$NetBSD: distinfo,v 1.2 2017/05/31 03:59:45 nonaka Exp $
|
||||
|
||||
SHA1 (iwatch-1.0.3.tar.gz) = d6147d3a0743113ddca775a58343cc22259b65c6
|
||||
RMD160 (iwatch-1.0.3.tar.gz) = cff380aacd2e1813d76aaeddd2bb3afa0999d709
|
||||
SHA512 (iwatch-1.0.3.tar.gz) = 58f4816648803a7c090a9a07e8396241ca3f5f53e1d0b80fd25c25cf2186f49a0d53eaffa4e66277e2c3527b892bd52f438a18172b73751533de2413a380cbb9
|
||||
Size (iwatch-1.0.3.tar.gz) = 105536 bytes
|
||||
SHA1 (iwatch-1.0.4.tar.gz) = 39855c216a213b7146cb9155ea4aad987aa9d0ba
|
||||
RMD160 (iwatch-1.0.4.tar.gz) = d0d5e0c71cc0bebc7f07cab1b1c2d280f2212eac
|
||||
SHA512 (iwatch-1.0.4.tar.gz) = 8b9dc63dd0fa2195c2866ba4d8fd069e3edb3db3f020e44d3b3c2b867f5f368b5e0b42203ea42c4b10a28e95dd7aec4edab70f00ae210e45f412788f1fc9ca09
|
||||
Size (iwatch-1.0.4.tar.gz) = 107169 bytes
|
||||
SHA1 (patch-iwatch.1) = efa8e21dc00c7eed532a848495fae641531c25aa
|
||||
SHA1 (patch-iwatch.c) = acc9380759ce659c04b61683738cf2284d5f581f
|
||||
|
|
23
misc/iwatch/patches/patch-iwatch.1
Normal file
23
misc/iwatch/patches/patch-iwatch.1
Normal file
|
@ -0,0 +1,23 @@
|
|||
$NetBSD: patch-iwatch.1,v 1.1 2017/05/31 03:59:45 nonaka Exp $
|
||||
|
||||
Fix warnings by groff.
|
||||
|
||||
--- iwatch.1.orig 2016-09-01 16:18:25.000000000 +0000
|
||||
+++ iwatch.1 2017-05-31 03:25:24.000000000 +0000
|
||||
@@ -96,7 +96,7 @@ These are:
|
||||
.Bl -tag -width Fl
|
||||
.It Ic k \*(Ba Ic -
|
||||
Scroll up 1 line.
|
||||
-.It Ic j \*(Ba Ic Aq Ic RETURN
|
||||
+.It Ic j \*(Ba Aq Ic RETURN
|
||||
Scroll down 1 line.
|
||||
.It Ic l
|
||||
Scroll right 1 column.
|
||||
@@ -191,6 +191,7 @@ The color is one of:
|
||||
Set attributes and color to the updated output (See
|
||||
.Sx STYLE
|
||||
Section).
|
||||
+.El
|
||||
.Sh SEE ALSO
|
||||
.Xr sh 1
|
||||
.Xr exec 2
|
125
misc/iwatch/patches/patch-iwatch.c
Normal file
125
misc/iwatch/patches/patch-iwatch.c
Normal file
|
@ -0,0 +1,125 @@
|
|||
$NetBSD: patch-iwatch.c,v 1.1 2017/05/31 03:59:45 nonaka Exp $
|
||||
|
||||
* Don't use NCURSES_BITS() since it doesn't seem to be portable.
|
||||
* () must be (void) for function prototype.
|
||||
* Remove an unused variable.
|
||||
* Fix warnings from gcc. %*0d must be %0*d.
|
||||
|
||||
--- iwatch.c.orig 2016-09-01 16:18:25.000000000 +0000
|
||||
+++ iwatch.c 2017-05-31 03:25:24.000000000 +0000
|
||||
@@ -91,6 +91,9 @@ typedef wchar_t BUFFER[MAXLINE][MAXCOLUM
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#endif
|
||||
+#ifndef nitems
|
||||
+#define nitems(_x) (sizeof((_x)) / sizeof((_x)[0]))
|
||||
+#endif
|
||||
|
||||
#define ctrl(c) ((c) & 037)
|
||||
int main(int, char *[]);
|
||||
@@ -101,7 +104,7 @@ kbd_result_t kbd_command(int);
|
||||
void showhelp(void);
|
||||
void untabify(wchar_t *, int);
|
||||
void on_signal(int);
|
||||
-void quit();
|
||||
+void quit(void);
|
||||
void usage(void);
|
||||
void set_attr(void);
|
||||
void parse_style(void);
|
||||
@@ -285,7 +288,7 @@ input:
|
||||
int
|
||||
display(BUFFER * cur, BUFFER * prev, reverse_mode_t reverse)
|
||||
{
|
||||
- int i, num, val, screen_x, screen_y, cw, line, rl;
|
||||
+ int i, val, screen_x, screen_y, cw, line, rl;
|
||||
char *ct;
|
||||
|
||||
erase();
|
||||
@@ -305,7 +308,8 @@ display(BUFFER * cur, BUFFER * prev, rev
|
||||
for (i = NUM_FRAQ_DIGITS_USEC, val = opt_interval.tv_usec;
|
||||
val % 10 == 0; val /= 10)
|
||||
i--;
|
||||
- printw("on every %d.%*0d seconds", opt_interval.tv_sec, i, val);
|
||||
+ printw("on every %d.%0*d seconds",
|
||||
+ (int)opt_interval.tv_sec, i, val);
|
||||
}
|
||||
|
||||
ct = ctime(&lastupdate);
|
||||
@@ -336,7 +340,7 @@ display(BUFFER * cur, BUFFER * prev, rev
|
||||
for (i = 0, power10 = 1; i < decimal_point; i++)
|
||||
power10 *= 10;
|
||||
|
||||
- printw("%d.%*0d", prefix / power10, decimal_point,
|
||||
+ printw("%d.%0*d", prefix / power10, decimal_point,
|
||||
prefix % power10);
|
||||
} else if (decimal_point == 0)
|
||||
printw("%d. ", prefix);
|
||||
@@ -831,13 +835,13 @@ usage(void)
|
||||
void
|
||||
parse_style(void)
|
||||
{
|
||||
- int i, code;
|
||||
+ int i;
|
||||
char *p, *st, *st0, *token;
|
||||
struct _codestrings {
|
||||
int code;
|
||||
int no;
|
||||
const char *string;
|
||||
- } codestrings[] = {
|
||||
+ } colors[] = {
|
||||
{ COLOR_BLACK, 0, "black"},
|
||||
{ COLOR_RED, 0, "red" },
|
||||
{ COLOR_GREEN, 0, "green" },
|
||||
@@ -846,6 +850,7 @@ parse_style(void)
|
||||
{ COLOR_MAGENTA, 0, "magenta" },
|
||||
{ COLOR_CYAN, 0, "cyan" },
|
||||
{ COLOR_WHITE, 0, "white" },
|
||||
+ }, attrs[] = {
|
||||
{ A_UNDERLINE, 0, "underline" },
|
||||
{ A_REVERSE, 0, "reverse" },
|
||||
{ A_DIM, 0, "dim" },
|
||||
@@ -854,7 +859,6 @@ parse_style(void)
|
||||
{ A_REVERSE, 1, "noreverse" },
|
||||
{ A_DIM, 1, "nodim" },
|
||||
{ A_BOLD, 1, "nobold" },
|
||||
- { -1, 0, NULL }
|
||||
};
|
||||
|
||||
if ((p = getenv("IWATCH_STYLE")) != NULL) {
|
||||
@@ -863,22 +867,25 @@ parse_style(void)
|
||||
while ((token = strsep(&st, " ,")) != NULL) {
|
||||
if (*token == '\0')
|
||||
continue;
|
||||
- for (i = 0; codestrings[i].code != -1; i++) {
|
||||
- if (strcasecmp(token, codestrings[i].string)
|
||||
- != 0)
|
||||
- continue;
|
||||
- code = codestrings[i].code;
|
||||
- if ((NCURSES_BITS(code, 0) & A_COLOR) != 0) {
|
||||
- init_pair(1, code, -1);
|
||||
+ for (i = 0; i < nitems(colors); i++) {
|
||||
+ if (strcasecmp(token, colors[i].string) == 0) {
|
||||
+ init_pair(1, colors[i].code, -1);
|
||||
style &= ~A_COLOR;
|
||||
style |= COLOR_PAIR(1);
|
||||
- } else if (code != -1) {
|
||||
- if (!codestrings[i].no)
|
||||
- style |= code;
|
||||
+ goto next_token;
|
||||
+ }
|
||||
+ }
|
||||
+ for (i = 0; i < nitems(attrs); i++) {
|
||||
+ if (strcasecmp(token, attrs[i].string) == 0) {
|
||||
+ if (attrs[i].no)
|
||||
+ style &= ~attrs[i].code;
|
||||
else
|
||||
- style &= ~code;
|
||||
+ style |= attrs[i].code;
|
||||
+ goto next_token;
|
||||
}
|
||||
}
|
||||
+ next_token:
|
||||
+ /* empty */;
|
||||
}
|
||||
free(st0);
|
||||
}
|
Loading…
Reference in a new issue