=================================================================== RCS file: /cvs/mandoc/out.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -p -r1.63 -r1.64 --- mandoc/out.c 2017/05/01 20:54:59 1.63 +++ mandoc/out.c 2017/06/08 12:54:58 1.64 @@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.63 2017/05/01 20:54:59 schwarze Exp $ */ +/* $Id: out.c,v 1.64 2017/06/08 12:54:58 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011, 2014, 2015, 2017 Ingo Schwarze @@ -40,10 +40,10 @@ static void tblcalc_number(struct rofftbl *, struct ro * Parse the *src string and store a scaling unit into *dst. * If the string doesn't specify the unit, use the default. * If no default is specified, fail. - * Return 2 on complete success, 1 when a conversion was done, - * but there was trailing garbage, and 0 on total failure. + * Return a pointer to the byte after the last byte used, + * or NULL on total failure. */ -int +const char * a2roffsu(const char *src, struct roffsu *dst, enum roffscale def) { char *endptr; @@ -51,7 +51,7 @@ a2roffsu(const char *src, struct roffsu *dst, enum rof dst->unit = def == SCALE_MAX ? SCALE_BU : def; dst->scale = strtod(src, &endptr); if (endptr == src) - return 0; + return NULL; switch (*endptr++) { case 'c': @@ -89,12 +89,11 @@ a2roffsu(const char *src, struct roffsu *dst, enum rof /* FALLTHROUGH */ default: if (SCALE_MAX == def) - return 0; + return NULL; dst->unit = def; break; } - - return *endptr == '\0' ? 2 : 1; + return endptr; } /*