Tail now works (costs 6k). Several other updates.
-Erik
This commit is contained in:
53
utility.c
53
utility.c
@ -289,7 +289,7 @@ const char *modeString(int mode)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BB_TAR
|
||||
#if defined BB_TAR
|
||||
/*
|
||||
* Return the standard ls-like time string from a time_t
|
||||
* This is static and so is overwritten on each call.
|
||||
@ -340,8 +340,10 @@ int fullWrite(int fd, const char *buf, int len)
|
||||
|
||||
return total;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined BB_TAR || defined BB_TAIL
|
||||
/*
|
||||
* Read all of the supplied buffer from a file.
|
||||
* This does multiple reads as necessary.
|
||||
@ -1018,6 +1020,55 @@ extern void whine_if_fstab_is_missing()
|
||||
#endif
|
||||
|
||||
|
||||
#if defined BB_DD || defined BB_TAIL
|
||||
/*
|
||||
* Read a number with a possible multiplier.
|
||||
* Returns -1 if the number format is illegal.
|
||||
*/
|
||||
extern long getNum (const char *cp)
|
||||
{
|
||||
long value;
|
||||
|
||||
if (!isDecimal (*cp))
|
||||
return -1;
|
||||
|
||||
value = 0;
|
||||
|
||||
while (isDecimal (*cp))
|
||||
value = value * 10 + *cp++ - '0';
|
||||
|
||||
switch (*cp++) {
|
||||
case 'm':
|
||||
value *= 1048576;
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
value *= 1024;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
value *= 512;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
value *= 2;
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
return value;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*cp)
|
||||
return -1;
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* END CODE */
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user