diff --git a/Makefile.am b/Makefile.am index 00e7d57e..389c1928 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,6 +58,7 @@ dist_man_MANS += \ slabtop.1 \ top.1 \ watch.1 +slabtop_SOURCES = slabtop.c $(top_srcdir)/lib/strutils.c slabtop_LDADD = @NCURSES_LIBS@ top_LDADD = @NCURSES_LIBS@ watch_LDADD = @WATCH_NCURSES_LIBS@ diff --git a/slabtop.c b/slabtop.c index 648357e0..f0f40a15 100644 --- a/slabtop.c +++ b/slabtop.c @@ -28,6 +28,7 @@ #include "c.h" #include "nls.h" +#include "strutils.h" #include "proc/slab.h" #include "proc/version.h" @@ -297,14 +298,10 @@ int main(int argc, char *argv[]) char *end; case 'd': errno = 0; - delay = strtol(optarg, &end, 10); - if (errno || optarg == end || (end && *end)) - errx(EXIT_FAILURE, _("illegal delay `%s'"), - optarg); - if (delay < 0) + delay = strtol_or_err(optarg, _("illegal delay")); + if (delay < 1) errx(EXIT_FAILURE, - _("delay can not have a " - "negative value")); + _("delay must be positive integer")); break; case 's': sort_func = (int (*)(const struct slab_info*,