X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/beb54af10082dc588132b2c0d32e050028b72c78..78ed81a334dab56aa7a876792a473d67d4359c25:/usr.sbin/sendmail/src/convtime.c diff --git a/usr.sbin/sendmail/src/convtime.c b/usr.sbin/sendmail/src/convtime.c index 499421ba73..5cb5e49cd3 100644 --- a/usr.sbin/sendmail/src/convtime.c +++ b/usr.sbin/sendmail/src/convtime.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1983 Eric P. Allman - * Copyright (c) 1988 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)convtime.c 5.4 (Berkeley) 6/1/90"; +static char sccsid[] = "@(#)convtime.c 8.1 (Berkeley) 6/7/93"; #endif /* not lint */ # include @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)convtime.c 5.4 (Berkeley) 6/1/90"; ** ** Parameters: ** p -- pointer to ascii time. +** units -- default units if none specified. ** ** Returns: ** time in seconds. @@ -62,8 +63,9 @@ static char sccsid[] = "@(#)convtime.c 5.4 (Berkeley) 6/1/90"; */ time_t -convtime(p) +convtime(p, units) char *p; + char units; { register time_t t, r; register char c; @@ -72,10 +74,13 @@ convtime(p) while (*p != '\0') { t = 0; - while (isdigit(c = *p++)) + while ((c = *p++) != '\0' && isascii(c) && isdigit(c)) t = t * 10 + (c - '0'); if (c == '\0') + { + c = units; p--; + } switch (c) { case 'w': /* weeks */