some fixes

This commit is contained in:
ceriel 1987-07-10 09:06:19 +00:00
parent f12358bfb0
commit fbf67d7a29
3 changed files with 14 additions and 10 deletions

View file

@ -28,20 +28,20 @@ asctime(tm)
pb = two_digits( pb = two_digits(
two_digits( two_digits(
two_digits( two_digits(
two_digits(pb, tm->tm_mday), two_digits(pb, tm->tm_mday, 0),
tm->tm_hour), tm->tm_hour, 1),
tm->tm_min), tm->tm_min, 1),
tm->tm_sec); tm->tm_sec, 1);
four_digits(pb, tm->tm_year+1900); four_digits(pb, tm->tm_year+1900);
return(buf); return(buf);
} }
static char * static char *
two_digits(pb, i) two_digits(pb, i, nospace)
register char *pb; register char *pb;
{ {
*pb = (i / 10) % 10 + '0'; *pb = (i / 10) % 10 + '0';
if (*pb == '0') *pb = ' '; if (!nospace && *pb == '0') *pb = ' ';
pb++; pb++;
*pb++ = (i % 10) + '0'; *pb++ = (i % 10) + '0';
return ++pb; return ++pb;

View file

@ -52,9 +52,9 @@ cvt(value, ndigit, decpt, sign, ecvtflag)
the conversion to "int" truncates the conversion to "int" truncates
*/ */
if (pe >= &buf1[NDIGITS]) { if (pe >= &buf1[NDIGITS]) {
pb = &buf1[NDIGITS-10]; pb = &buf1[10];
while (pb > buf1) *--pb = *--pe; pe = &buf1[0];
pe = &buf[NDIGITS-10]; while (pb < &buf1[NDIGITS]) *pe++ = *pb++;
} }
*pe++ = (int)((value+.05) * 10) + '0'; *pe++ = (int)((value+.05) * 10) + '0';
pointpos++; pointpos++;

View file

@ -4,7 +4,11 @@ static long seed = 1L;
int rand() int rand()
{ {
seed = (1103515245L * seed + 12345) & 0x7FFFFFFF; seed = (1103515245L * seed + 12345) & 0x7FFFFFFF;
return((int) ((seed >> 8) & 077777)); #if EM_WSIZE == 4
return (int) seed;
#else
return ((int)(seed >> 8) & 0x7FFF);
#endif
} }
srand(n) srand(n)