sbase/util/estrtol.c
Lorenzo Cogotti 75c97de593 Various fixes, add renice command.
This commit adds the renice command and its man page,
it also introduces some fixes:
* Makes nice command more solid, it also makes it respect POSIX return values.
* Fixes estrtol, which produced a misleading error on out of range errors.
* Fixes chgrp.1 NAME section.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2013-06-14 19:01:04 +02:00

28 lines
430 B
C

/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "../util.h"
long
estrtol(const char *s, int base)
{
char *end;
long n;
errno = 0;
n = strtol(s, &end, base);
if(*end != '\0') {
if(base == 0)
eprintf("%s: not an integer\n", s);
else
eprintf("%s: not a base %d integer\n", s, base);
}
if(errno != 0)
eprintf("%s:", s);
return n;
}