psdate.c (302408) | psdate.c (312931) |
---|---|
1/*- 2 * Copyright (C) 1996 3 * David L. Nugent. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#ifndef lint 28static const char rcsid[] = | 1/*- 2 * Copyright (C) 1996 3 * David L. Nugent. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#ifndef lint 28static const char rcsid[] = |
29 "$FreeBSD: stable/11/usr.sbin/pw/psdate.c 286201 2015-08-02 13:22:46Z bapt $"; | 29 "$FreeBSD: stable/11/usr.sbin/pw/psdate.c 312931 2017-01-28 17:40:37Z bapt $"; |
30#endif /* not lint */ 31 32#include <ctype.h> 33#include <err.h> 34#include <stdlib.h> 35#include <string.h> 36#include <xlocale.h> 37 38#include "psdate.h" 39 40 41static int 42numerics(char const * str) 43{ | 30#endif /* not lint */ 31 32#include <ctype.h> 33#include <err.h> 34#include <stdlib.h> 35#include <string.h> 36#include <xlocale.h> 37 38#include "psdate.h" 39 40 41static int 42numerics(char const * str) 43{ |
44 int rc = isdigit((unsigned char)*str); | |
45 | 44 |
46 if (rc) 47 while (isdigit((unsigned char)*str) || *str == 'x') 48 ++str; 49 return rc && !*str; | 45 return (str[strspn(str, "0123456789x")] == '\0'); |
50} 51 52static int 53aindex(char const * arr[], char const ** str, int len) 54{ 55 int l, i; 56 char mystr[32]; 57 --- 204 unchanged lines hidden --- | 46} 47 48static int 49aindex(char const * arr[], char const ** str, int len) 50{ 51 int l, i; 52 char mystr[32]; 53 --- 204 unchanged lines hidden --- |