scanf.c

00001 /*
00002  * Copyright (c) 1990 The Regents of the University of California.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms are permitted
00006  * provided that the above copyright notice and this paragraph are
00007  * duplicated in all such forms and that any documentation,
00008  * advertising materials, and other materials related to such
00009  * distribution and use acknowledge that the software was developed
00010  * by the University of California, Berkeley.  The name of the
00011  * University may not be used to endorse or promote products derived
00012  * from this software without specific prior written permission.
00013  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00014  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00015  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00016  */
00017 
00018 #include <_ansi.h>
00019 #include <stdio.h>
00020 #include "local.h"
00021 
00022 #ifdef _HAVE_STDC
00023 #include <stdarg.h>
00024 #else
00025 #include <varargs.h>
00026 #endif
00027 
00028 #ifndef _REENT_ONLY
00029 
00030 int
00031 #ifdef _HAVE_STDC
00032 scanf (const char *fmt, ...)
00033 #else
00034 scanf (fmt, va_alist)
00035      char *fmt;
00036      va_dcl
00037 #endif
00038 {
00039   int ret;
00040   va_list ap;
00041 
00042   //_REENT_SMALL_CHECK_INIT(_stdin_r (_REENT));
00043 #ifdef _HAVE_STDC
00044   va_start (ap, fmt);
00045 #else
00046   va_start (ap);
00047 #endif
00048   ret = __svfscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
00049   va_end (ap);
00050   return ret;
00051 }
00052 
00053 #endif /* !_REENT_ONLY */
00054 
00055 int
00056 #ifdef _HAVE_STDC
00057 _scanf_r (struct _reent *ptr, const char *fmt, ...)
00058 #else
00059 _scanf_r (ptr, fmt, va_alist)
00060      struct _reent *ptr;
00061      char *fmt;
00062      va_dcl
00063 #endif
00064 {
00065   int ret;
00066   va_list ap;
00067 
00068   //_REENT_SMALL_CHECK_INIT(_stdin_r (ptr));
00069 #ifdef _HAVE_STDC
00070   va_start (ap, fmt);
00071 #else
00072   va_start (ap);
00073 #endif
00074   ret = __svfscanf_r (ptr, _stdin_r (ptr), fmt, ap);
00075   va_end (ap);
00076   return (ret);
00077 }
00078 
00079 

Generated on Mon Apr 11 14:23:40 2011 for Contiki 2.5 by  doxygen 1.6.1