masqmail-0.2

annotate src/timeival.c @ 91:3e7136221104

correct masqmail path in rmail script; remove docs on uninstall on install the correct path to the masqmail executable gets inserted into the rmail script now. now documentation, examples, and the templates are removed on uninstall. Empty directories are the only thing that may remain if one installs masqmail into an unusual path.
author meillo@marmaro.de
date Mon, 21 Jun 2010 09:40:16 +0200
parents 26e34ae9a3e3
children
rev   line source
meillo@0 1 /* MasqMail
meillo@0 2 Copyright (C) 1999-2002 Oliver Kurth
meillo@0 3
meillo@0 4 This program is free software; you can redistribute it and/or modify
meillo@0 5 it under the terms of the GNU General Public License as published by
meillo@0 6 the Free Software Foundation; either version 2 of the License, or
meillo@0 7 (at your option) any later version.
meillo@0 8
meillo@0 9 This program is distributed in the hope that it will be useful,
meillo@0 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
meillo@0 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
meillo@0 12 GNU General Public License for more details.
meillo@0 13
meillo@0 14 You should have received a copy of the GNU General Public License
meillo@0 15 along with this program; if not, write to the Free Software
meillo@0 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
meillo@0 17 */
meillo@0 18
meillo@0 19 #include <ctype.h>
meillo@0 20 #include <glib.h>
meillo@0 21
meillo@0 22 #include "masqmail.h"
meillo@0 23
meillo@10 24 gint
meillo@10 25 time_interval(gchar * str, gint * pos)
meillo@0 26 {
meillo@10 27 gchar buf[16];
meillo@10 28 gchar *p = str, *q = buf;
meillo@10 29 gint factor = 1, val;
meillo@0 30
meillo@10 31 while (*p && isdigit(*p) && (q < buf + 15)) {
meillo@10 32 *(q++) = *(p++);
meillo@10 33 (*pos)++;
meillo@10 34 }
meillo@10 35 (*pos)++;
meillo@15 36 *q = '\0';
meillo@10 37 val = atoi(buf);
meillo@10 38
meillo@10 39 /* fall through: */
meillo@10 40 switch (*p) {
meillo@10 41 case 'w':
meillo@10 42 factor *= 7;
meillo@10 43 case 'd':
meillo@10 44 factor *= 24;
meillo@10 45 case 'h':
meillo@10 46 factor *= 60;
meillo@10 47 case 'm':
meillo@10 48 factor *= 60;
meillo@10 49 case 's':
meillo@10 50 break;
meillo@10 51 default:
meillo@10 52 return -1;
meillo@10 53 }
meillo@10 54 return val * factor;
meillo@0 55 }