summaryrefslogtreecommitdiff
path: root/misc/watch
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2008-02-22 02:14:53 +0000
committertnn <tnn@pkgsrc.org>2008-02-22 02:14:53 +0000
commit3c70c68c9d94382dbbaba21a11e5c3826565e029 (patch)
tree0580a1eeadf2c5d164c84ef0ae62a84deef6bdc4 /misc/watch
parent9f7614b77affe67bcb353941df12556413f4171c (diff)
downloadpkgsrc-3c70c68c9d94382dbbaba21a11e5c3826565e029.tar.gz
- merge patch-aa and patch-ab, they patched the same file.
- Uses asprintf and getopt_long This closes PR pkg/38054.
Diffstat (limited to 'misc/watch')
-rw-r--r--misc/watch/Makefile5
-rw-r--r--misc/watch/distinfo5
-rw-r--r--misc/watch/patches/patch-aa75
-rw-r--r--misc/watch/patches/patch-ab48
4 files changed, 66 insertions, 67 deletions
diff --git a/misc/watch/Makefile b/misc/watch/Makefile
index fb3e6c3ce49..4249e52eef2 100644
--- a/misc/watch/Makefile
+++ b/misc/watch/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2006/10/25 21:37:51 rillig Exp $
+# $NetBSD: Makefile,v 1.10 2008/02/22 02:14:53 tnn Exp $
DISTNAME= procps-3.2.6
PKGNAME= watch-3.2.6
@@ -11,9 +11,10 @@ COMMENT= Watch a program with update intervals
MAKE_FILE= ${FILESDIR}/Makefile
MAKE_ENV+= ${BSD_MAKE_ENV}
-MAKE_ENV+= LIBS=${LIBS}
+MAKE_ENV+= LIBS=${LIBS:Q}
LIBS.SunOS+= -lrt
+USE_FEATURES+= asprintf getopt_long
.include "../../devel/ncurses/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/misc/watch/distinfo b/misc/watch/distinfo
index b016907cac1..ece8aa3126d 100644
--- a/misc/watch/distinfo
+++ b/misc/watch/distinfo
@@ -1,7 +1,6 @@
-$NetBSD: distinfo,v 1.6 2006/11/09 08:55:54 rillig Exp $
+$NetBSD: distinfo,v 1.7 2008/02/22 02:14:53 tnn Exp $
SHA1 (procps-3.2.6.tar.gz) = 91f44180eb50a94eb945c2598c0e849879e65893
RMD160 (procps-3.2.6.tar.gz) = f0b09701ce48d9f6db1cbb209b02ba026ee58d09
Size (procps-3.2.6.tar.gz) = 279084 bytes
-SHA1 (patch-aa) = 953dcd9c3287fec91ac7c585ad9dff4b7ec50cf7
-SHA1 (patch-ab) = e8ffa2a42ba13442d01511525bb526f7702494d0
+SHA1 (patch-aa) = 597d173b7ba9862b617494da534d630f0b754bbf
diff --git a/misc/watch/patches/patch-aa b/misc/watch/patches/patch-aa
index a901827105c..b55a147027c 100644
--- a/misc/watch/patches/patch-aa
+++ b/misc/watch/patches/patch-aa
@@ -1,15 +1,62 @@
-$NetBSD: patch-aa,v 1.3 2006/05/15 16:01:03 tron Exp $
+$NetBSD: patch-aa,v 1.4 2008/02/22 02:14:53 tnn Exp $
---- watch.c.orig 2005-10-30 00:44:53.000000000 +0100
-+++ watch.c 2006-05-15 16:49:04.000000000 +0100
-@@ -164,9 +164,7 @@
- break;
- case 'n':
- {
-- char *str;
-- interval = strtof(optarg, &str);
-- if (!*optarg || *str)
-+ if (sscanf(optarg, "%f", &interval) != 1)
- do_usage();
- if(interval < 0.1)
- interval = 0.1;
+--- watch.c.orig 2008-02-22 03:05:28.000000000 +0100
++++ watch.c
+@@ -13,7 +13,13 @@
+ #define VERSION "0.2.0"
+
+ #include <ctype.h>
++#if defined(HAVE_NBCOMPAT_H)
++#include <nbcompat/config.h>
++#include <nbcompat/cdefs.h>
++#include <nbcompat/getopt.h>
++#else
+ #include <getopt.h>
++#endif
+ #include <signal.h>
+ #include <ncurses.h>
+ #include <stdio.h>
+@@ -142,6 +148,7 @@ main(int argc, char *argv[])
+ option_differences_cumulative = 0,
+ option_help = 0, option_version = 0;
+ float interval = 2;
++ struct timespec tsinterval;
+ char *command;
+ int command_length = 0; /* not including final \0 */
+
+@@ -199,6 +206,9 @@ main(int argc, char *argv[])
+ if (optind >= argc)
+ do_usage();
+
++ tsinterval.tv_sec = interval;
++ tsinterval.tv_nsec = (interval - tsinterval.tv_sec) * 1000000000L;
++
+ command = strdup(argv[optind++]);
+ command_length = strlen(command);
+ for (; optind < argc; optind++) {
+@@ -246,10 +256,16 @@ main(int argc, char *argv[])
+ }
+
+ if (show_title) {
++#if defined(__sun)
++ header = malloc(width + 1);
++ if (!header) { perror("malloc"); do_exit(2); }
++ snprintf(header, width + 1, "Every %.1fs: %s", interval, command);
++#else
+ // left justify interval and command,
+ // right justify time, clipping all to fit window width
+ asprintf(&header, "Every %.1fs: %.*s",
+ interval, min(width - 1, command_length), command);
++#endif
+ mvaddstr(0, 0, header);
+ if (strlen(header) > (size_t) (width - tsl - 1))
+ mvaddstr(0, width - tsl - 4, "... ");
+@@ -313,7 +329,7 @@ main(int argc, char *argv[])
+
+ first_screen = 0;
+ refresh();
+- usleep(interval * 1000000);
++ nanosleep(&tsinterval, NULL);
+ }
+
+ endwin();
diff --git a/misc/watch/patches/patch-ab b/misc/watch/patches/patch-ab
deleted file mode 100644
index 4e1a228ffda..00000000000
--- a/misc/watch/patches/patch-ab
+++ /dev/null
@@ -1,48 +0,0 @@
-$NetBSD: patch-ab,v 1.2 2006/10/25 21:37:51 rillig Exp $
-
---- watch.c.orig 2006-10-25 23:13:48.793523972 +0200
-+++ watch.c 2006-10-25 23:25:56.542821832 +0200
-@@ -142,6 +142,7 @@ main(int argc, char *argv[])
- option_differences_cumulative = 0,
- option_help = 0, option_version = 0;
- float interval = 2;
-+ struct timespec tsinterval;
- char *command;
- int command_length = 0; /* not including final \0 */
-
-@@ -199,6 +200,9 @@ main(int argc, char *argv[])
- if (optind >= argc)
- do_usage();
-
-+ tsinterval.tv_sec = interval;
-+ tsinterval.tv_nsec = (interval - tsinterval.tv_sec) * 1000000000L;
-+
- command = strdup(argv[optind++]);
- command_length = strlen(command);
- for (; optind < argc; optind++) {
-@@ -246,10 +250,16 @@ main(int argc, char *argv[])
- }
-
- if (show_title) {
-+#if defined(__sun)
-+ header = malloc(width + 1);
-+ if (!header) { perror("malloc"); do_exit(2); }
-+ snprintf(header, width + 1, "Every %.1fs: %s", interval, command);
-+#else
- // left justify interval and command,
- // right justify time, clipping all to fit window width
- asprintf(&header, "Every %.1fs: %.*s",
- interval, min(width - 1, command_length), command);
-+#endif
- mvaddstr(0, 0, header);
- if (strlen(header) > (size_t) (width - tsl - 1))
- mvaddstr(0, width - tsl - 4, "... ");
-@@ -313,7 +323,7 @@ main(int argc, char *argv[])
-
- first_screen = 0;
- refresh();
-- usleep(interval * 1000000);
-+ nanosleep(&tsinterval, NULL);
- }
-
- endwin();