=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/os.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/less/os.c 1996/09/21 05:39:43 1.1 +++ src/usr.bin/less/os.c 1999/02/20 19:00:39 1.2 @@ -38,6 +38,7 @@ */ #include "less.h" +#include #include #include #if HAVE_TIME_H @@ -188,27 +189,27 @@ } /* - * Return the largest possible number that can fit in a long. + * Return the largest possible number that can fit in a POSITION. */ -#ifdef MAXLONG - static long -get_maxlong() +#ifdef QUAD_MAX + static POSITION +get_maxpos() { - return (MAXLONG); + return (QUAD_MAX); } #else - static long -get_maxlong() + static POSITION +get_maxpos() { - long n, n2; + POSITION n, n2; /* * Keep doubling n until we overflow. * {{ This actually only returns the largest power of two that - * can fit in a long, but percentage() doesn't really need + * can fit in a POSITION, but percentage() doesn't really need * it any more accurate than that. }} */ - n2 = 128; /* Hopefully no maxlong is less than 128! */ + n2 = 128; /* Hopefully no maxpos is less than 128! */ do { n = n2; n2 *= 2; @@ -218,17 +219,17 @@ #endif /* - * Return the ratio of two longs, as a percentage. + * Return the ratio of two POSITIONs, as a percentage. */ public int percentage(num, den) - long num, den; + POSITION num, den; { - static long maxlong100 = 0; + static POSITION maxpos100 = 0; - if (maxlong100 == 0) - maxlong100 = get_maxlong() / 100; - if (num > maxlong100) + if (maxpos100 == 0) + maxpos100 = get_maxpos() / 100; + if (num > maxpos100) return (num / (den/100)); else return (100*num / den);