uint dividend;
/* Compute the remainder of each possible dividend */
- for (dividend = 0; dividend < CRC8_TABLE_LEN; ++dividend)
- {
+ for (dividend = 0; dividend < CRC8_TABLE_LEN; ++dividend) {
/* Start with the dividend followed by zeros */
remainder = dividend << (WIDTH - 8);
/* Perform modulo-2 division, a bit at a time */
- for (bit = 8; bit > 0; --bit)
- {
+ for (bit = 8; bit > 0; --bit) {
/* Try to divide the current data bit */
if (remainder & TOPBIT)
remainder = (remainder << 1) ^ POLYNOMIAL;
/* Divide the message by the polynomial, a byte at a time */
- for (byte = 0; byte < n; ++byte)
- {
+ for (byte = 0; byte < n; ++byte) {
data = message[byte] ^ (remainder >> (WIDTH - 8));
remainder = crc8table[data] ^ (remainder << 8);
}
for (i = 0; i < len; ++i) {
if (regcomp(®ex, assocs[i].regex, REG_NOSUB | REG_EXTENDED | REG_ICASE) != 0)
continue;
+
if (regexec(®ex, file, 0, NULL, 0) == 0) {
regfree(®ex);
return assocs[i].mime;
regerror(r, regex, g_buf, len);
printmsg(g_buf);
}
+
return r;
}
* Updates out with "dir/name or "/name"
* Returns the number of bytes copied including the terminating NULL byte
*/
-size_t
+static size_t
mkpath(char *dir, char *name, char *out, size_t n)
{
static size_t len;