diff --git a/srcpkgs/mon/patches/fix-long_long.patch b/srcpkgs/mon/patches/fix-long_long.patch new file mode 100644 index 00000000000..78b541f23b8 --- /dev/null +++ b/srcpkgs/mon/patches/fix-long_long.patch @@ -0,0 +1,22 @@ +Size of long may be 32-bit and thus can't hold MS_YEAR. + +--- deps/ms.c 2013-12-01 18:34:08.000000000 +0100 ++++ deps/ms.c 2015-09-09 22:47:16.476393763 +0200 +@@ -91,7 +91,7 @@ + milliseconds_to_string(long long ms) { + char *str = malloc(MS_MAX); + if (!str) return NULL; +- long div = 1; ++ long long div = 1; + char *fmt; + + if (ms < MS_SEC) fmt = "%lldms"; +@@ -113,7 +113,7 @@ + + char * + milliseconds_to_long_string(long long ms) { +- long div; ++ long long div; + char *name; + + char *str = malloc(MS_MAX); diff --git a/srcpkgs/mon/patches/fix-unused_result.patch b/srcpkgs/mon/patches/fix-unused_result.patch new file mode 100644 index 00000000000..043ada8e5be --- /dev/null +++ b/srcpkgs/mon/patches/fix-unused_result.patch @@ -0,0 +1,14 @@ +Fix a minor warning about ignoring the result of write(2). + +--- src/mon.c 2013-12-01 18:34:08.000000000 +0100 ++++ src/mon.c 2015-09-09 22:42:21.241394637 +0200 +@@ -112,7 +112,8 @@ + snprintf(buf, 32, "%d", pid); + int fd = open(file, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + if (fd < 0) perror("open()"); +- write(fd, buf, 32); ++ ssize_t wrote = write(fd, buf, 32); ++ if (wrote != 32) perror("write()"); + close(fd); + } + diff --git a/srcpkgs/mon/template b/srcpkgs/mon/template new file mode 100644 index 00000000000..45183c7ed96 --- /dev/null +++ b/srcpkgs/mon/template @@ -0,0 +1,20 @@ +# Template file for 'mon' +pkgname=mon +version=1.2.3 +revision=1 +build_style=gnu-makefile +short_desc="Simple single-process process monitoring program written in C" +maintainer="Diogo Leal " +license="MIT" +homepage="https://github.com/tj/mon" +distfiles="https://github.com/tj/mon/archive/${version}.tar.gz" +checksum=978711a1d37ede3fc5a05c778a2365ee234b196a44b6c0c69078a6c459e686ac + +CFLAGS="-Ideps -std=c99 -D_GNU_SOURCE" + +do_install() { + vbin mon + vsconf example/on_error.sh + vsconf example/program.sh + vdoc Readme.md +}