head 1.3; access; symbols pkgsrc-2013Q2:1.3.0.20 pkgsrc-2013Q2-base:1.3 pkgsrc-2012Q4:1.3.0.18 pkgsrc-2012Q4-base:1.3 pkgsrc-2011Q4:1.3.0.16 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q2:1.3.0.14 pkgsrc-2011Q2-base:1.3 pkgsrc-2009Q4:1.3.0.12 pkgsrc-2009Q4-base:1.3 pkgsrc-2008Q4:1.3.0.10 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.8 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.6 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.4 pkgsrc-2008Q2-base:1.3 pkgsrc-2008Q1:1.3.0.2 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.2.0.10 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.8 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.6 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.4 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.2 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.1.0.2 pkgsrc-2006Q3-base:1.1; locks; strict; comment @# @; 1.3 date 2008.02.22.02.14.53; author tnn; state dead; branches; next 1.2; 1.2 date 2006.10.25.21.37.51; author rillig; state Exp; branches; next 1.1; 1.1 date 2006.07.11.16.35.24; author smb; state Exp; branches; next ; desc @@ 1.3 log @- merge patch-aa and patch-ab, they patched the same file. - Uses asprintf and getopt_long This closes PR pkg/38054. @ text @$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(); @ 1.2 log @Made the package work again on Solaris. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.1 2006/07/11 16:35:24 smb Exp $ @ 1.1 log @Change incorrect use of usleep() to use nanosleep() instead @ text @d1 1 a1 1 $NetBSD$ d3 3 a5 3 --- watch.c.orig 2006-07-09 20:58:47.000000000 -0400 +++ watch.c 2006-07-09 21:01:56.000000000 -0400 @@@@ -142,6 +142,7 @@@@ d13 1 a13 1 @@@@ -201,6 +202,9 @@@@ d23 18 a40 1 @@@@ -315,7 +319,7 @@@@ @