Mercurial > masqmail
diff src/timeival.c @ 10:26e34ae9a3e3
changed indention and line wrapping to a more consistent style
author | meillo@marmaro.de |
---|---|
date | Mon, 27 Oct 2008 16:23:10 +0100 |
parents | 08114f7dcc23 |
children | f671821d8222 |
line wrap: on
line diff
--- a/src/timeival.c Mon Oct 27 16:21:27 2008 +0100 +++ b/src/timeival.c Mon Oct 27 16:23:10 2008 +0100 @@ -21,34 +21,35 @@ #include "masqmail.h" -gint time_interval(gchar *str, gint *pos) +gint +time_interval(gchar * str, gint * pos) { - gchar buf[16]; - gchar *p = str, *q = buf; - gint factor = 1, val; + gchar buf[16]; + gchar *p = str, *q = buf; + gint factor = 1, val; + + while (*p && isdigit(*p) && (q < buf + 15)) { + *(q++) = *(p++); + (*pos)++; + } + (*pos)++; + *q = 0; + val = atoi(buf); - while(*p && isdigit(*p) && (q < buf+15)){ - *(q++) = *(p++); - (*pos)++; - } - (*pos)++; - *q = 0; - val = atoi(buf); - - /* fall through: */ - switch(*p){ - case 'w': - factor *= 7; - case 'd': - factor *= 24; - case 'h': - factor *= 60; - case 'm': - factor *= 60; - case 's': - break; - default: - return -1; - } - return val * factor; + /* fall through: */ + switch (*p) { + case 'w': + factor *= 7; + case 'd': + factor *= 24; + case 'h': + factor *= 60; + case 'm': + factor *= 60; + case 's': + break; + default: + return -1; + } + return val * factor; }