strtoq.c revision 73155
150565Sphk/*- 250565Sphk * Copyright (c) 1992, 1993 350565Sphk * The Regents of the University of California. All rights reserved. 450565Sphk * 550565Sphk * Redistribution and use in source and binary forms, with or without 650565Sphk * modification, are permitted provided that the following conditions 750565Sphk * are met: 850565Sphk * 1. Redistributions of source code must retain the above copyright 950565Sphk * notice, this list of conditions and the following disclaimer. 1050565Sphk * 2. Redistributions in binary form must reproduce the above copyright 1150565Sphk * notice, this list of conditions and the following disclaimer in the 1250565Sphk * documentation and/or other materials provided with the distribution. 1350565Sphk * 3. All advertising materials mentioning features or use of this software 1450565Sphk * must display the following acknowledgement: 1550565Sphk * This product includes software developed by the University of 1651111Sjulian * California, Berkeley and its contributors. 1760041Sphk * 4. Neither the name of the University nor the names of its contributors 1850565Sphk * may be used to endorse or promote products derived from this software 1950565Sphk * without specific prior written permission. 2050565Sphk * 2161953Snbm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2250728Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2364880Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2464880Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2569774Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2650565Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2750565Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2850565Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2950565Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3050565Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3150565Sphk * SUCH DAMAGE. 3261717Sphk */ 3361717Sphk 3464880Sphk#if defined(LIBC_SCCS) && !defined(lint) 3562617Simpstatic char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93"; 3664880Sphk#endif /* LIBC_SCCS and not lint */ 3764880Sphk 3864880Sphk#ifndef lint 3964880Sphkstatic const char rcsid[] = 4064880Sphk "$FreeBSD: head/lib/libc/stdlib/strtoq.c 73155 2001-02-27 14:30:42Z obrien $"; 4164880Sphk#endif 4264880Sphk 4364880Sphk#include <sys/types.h> 4464880Sphk 4564880Sphk#include <stdlib.h> 4664880Sphk 4764880Sphk/* 4864880Sphk * Convert a string to a quad integer. 4964880Sphk * 5064880Sphk * Ignores `locale' stuff. Assumes that the upper and lower case 5164880Sphk * alphabets and digits are each contiguous. 5264880Sphk */ 5364880Sphkquad_t 5464880Sphkstrtoq(nptr, endptr, base) 5564880Sphk const char *nptr; 5664880Sphk char **endptr; 5764880Sphk int base; 5870058Sphk{ 5970058Sphk 6064880Sphk return strtoll(nptr, endptr, base); 6164880Sphk} 6264880Sphk