10Sstevel@tonic-gate/* gmp_sscanf -- formatted input from a string. 20Sstevel@tonic-gate 30Sstevel@tonic-gateCopyright 2001 Free Software Foundation, Inc. 40Sstevel@tonic-gate 50Sstevel@tonic-gateThis file is part of the GNU MP Library. 60Sstevel@tonic-gate 70Sstevel@tonic-gateThe GNU MP Library is free software; you can redistribute it and/or modify 80Sstevel@tonic-gateit under the terms of the GNU Lesser General Public License as published by 90Sstevel@tonic-gatethe Free Software Foundation; either version 3 of the License, or (at your 100Sstevel@tonic-gateoption) any later version. 110Sstevel@tonic-gate 120Sstevel@tonic-gateThe GNU MP Library is distributed in the hope that it will be useful, but 130Sstevel@tonic-gateWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 140Sstevel@tonic-gateor FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 150Sstevel@tonic-gateLicense for more details. 160Sstevel@tonic-gate 170Sstevel@tonic-gateYou should have received a copy of the GNU Lesser General Public License 180Sstevel@tonic-gatealong with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ 190Sstevel@tonic-gate 200Sstevel@tonic-gate#include "config.h" 210Sstevel@tonic-gate 220Sstevel@tonic-gate#if HAVE_STDARG 230Sstevel@tonic-gate#include <stdarg.h> 240Sstevel@tonic-gate#else 250Sstevel@tonic-gate#include <varargs.h> 260Sstevel@tonic-gate#endif 270Sstevel@tonic-gate 280Sstevel@tonic-gate#include <stdio.h> 290Sstevel@tonic-gate 300Sstevel@tonic-gate#include "gmp.h" 310Sstevel@tonic-gate#include "gmp-impl.h" 320Sstevel@tonic-gate 330Sstevel@tonic-gate 340Sstevel@tonic-gateint 350Sstevel@tonic-gate#if HAVE_STDARG 360Sstevel@tonic-gategmp_sscanf (const char *s, const char *fmt, ...) 37#else 38gmp_sscanf (va_alist) 39 va_dcl 40#endif 41{ 42 va_list ap; 43 int ret; 44#if HAVE_STDARG 45 va_start (ap, fmt); 46#else 47 const char *s; 48 const char *fmt; 49 va_start (ap); 50 s = va_arg (ap, const char *); 51 fmt = va_arg (ap, const char *); 52#endif 53 54#if SSCANF_WRITABLE_INPUT 55 /* let gmp_vsscanf handle the copying */ 56 ret = gmp_vsscanf (s, fmt, ap); 57#else 58 ret = __gmp_doscan (&__gmp_sscanf_funs, (void *) &s, fmt, ap); 59#endif 60 va_end (ap); 61 return ret; 62} 63