comparison 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
comparison
equal deleted inserted replaced
9:31cc8a89cb74 10:26e34ae9a3e3
19 #include <ctype.h> 19 #include <ctype.h>
20 #include <glib.h> 20 #include <glib.h>
21 21
22 #include "masqmail.h" 22 #include "masqmail.h"
23 23
24 gint time_interval(gchar *str, gint *pos) 24 gint
25 time_interval(gchar * str, gint * pos)
25 { 26 {
26 gchar buf[16]; 27 gchar buf[16];
27 gchar *p = str, *q = buf; 28 gchar *p = str, *q = buf;
28 gint factor = 1, val; 29 gint factor = 1, val;
29 30
30 while(*p && isdigit(*p) && (q < buf+15)){ 31 while (*p && isdigit(*p) && (q < buf + 15)) {
31 *(q++) = *(p++); 32 *(q++) = *(p++);
32 (*pos)++; 33 (*pos)++;
33 } 34 }
34 (*pos)++; 35 (*pos)++;
35 *q = 0; 36 *q = 0;
36 val = atoi(buf); 37 val = atoi(buf);
37 38
38 /* fall through: */ 39 /* fall through: */
39 switch(*p){ 40 switch (*p) {
40 case 'w': 41 case 'w':
41 factor *= 7; 42 factor *= 7;
42 case 'd': 43 case 'd':
43 factor *= 24; 44 factor *= 24;
44 case 'h': 45 case 'h':
45 factor *= 60; 46 factor *= 60;
46 case 'm': 47 case 'm':
47 factor *= 60; 48 factor *= 60;
48 case 's': 49 case 's':
49 break; 50 break;
50 default: 51 default:
51 return -1; 52 return -1;
52 } 53 }
53 return val * factor; 54 return val * factor;
54 } 55 }