mystring.c (17987) | mystring.c (18018) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * $Id: mystring.c,v 1.2 1994/09/24 02:57:59 davidg Exp $ | 36 * $Id: mystring.c,v 1.3 1996/09/01 10:21:03 peter Exp $ |
37 */ 38 39#ifndef lint 40static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; 41#endif /* not lint */ 42 43/* 44 * String functions. --- 67 unchanged lines hidden (view full) --- 112 */ 113 114int 115number(s) 116 const char *s; 117 { 118 119 if (! is_number(s)) | 37 */ 38 39#ifndef lint 40static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; 41#endif /* not lint */ 42 43/* 44 * String functions. --- 67 unchanged lines hidden (view full) --- 112 */ 113 114int 115number(s) 116 const char *s; 117 { 118 119 if (! is_number(s)) |
120 error2("Illegal number", (char *)s); | 120 error("Illegal number: %s", (char *)s); |
121 return atoi(s); 122} 123 124 125 126/* 127 * Check for a valid number. This should be elsewhere. 128 */ 129 130int 131is_number(p) 132 register const char *p; 133 { 134 do { 135 if (! is_digit(*p)) 136 return 0; 137 } while (*++p != '\0'); 138 return 1; 139} | 121 return atoi(s); 122} 123 124 125 126/* 127 * Check for a valid number. This should be elsewhere. 128 */ 129 130int 131is_number(p) 132 register const char *p; 133 { 134 do { 135 if (! is_digit(*p)) 136 return 0; 137 } while (*++p != '\0'); 138 return 1; 139} |