gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r423 - in GNUnet/src: applications/fs/ecrs applications/fs/


From: durner
Subject: [GNUnet-SVN] r423 - in GNUnet/src: applications/fs/ecrs applications/fs/module applications/sqstore_mysql applications/tbench include server util/win
Date: Thu, 10 Mar 2005 12:17:38 -0800 (PST)

Author: durner
Date: 2005-03-10 12:17:35 -0800 (Thu, 10 Mar 2005)
New Revision: 423

Modified:
   GNUnet/src/applications/fs/ecrs/uri.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/sqstore_mysql/mysql.c
   GNUnet/src/applications/tbench/gnunet-tbench.c
   GNUnet/src/include/platform.h
   GNUnet/src/include/winproc.h
   GNUnet/src/server/gnunet-transport-check.c
   GNUnet/src/util/win/win_printf.c
Log:
scanf() format specifier "%ll" for Windows

Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c       2005-03-09 22:22:12 UTC (rev 
422)
+++ GNUnet/src/applications/fs/ecrs/uri.c       2005-03-10 20:17:35 UTC (rev 
423)
@@ -336,7 +336,7 @@
                       &fi->chk.key)) ||
        (OK != enc2hash(&dup[pos+sizeof(EncName)],
                       &fi->chk.query)) ||
-       (1 != sscanf(&dup[pos+sizeof(EncName)*2],
+       (1 != SSCANF(&dup[pos+sizeof(EncName)*2],
                    "%llu",
                    &fi->file_length)) ) {
     FREE(dup);

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2005-03-09 22:22:12 UTC (rev 
422)
+++ GNUnet/src/applications/fs/module/fs.c      2005-03-10 20:17:35 UTC (rev 
423)
@@ -370,14 +370,28 @@
 static int csHandleRequestInitIndex(ClientHandle sock,
         const CS_HEADER * req) {
   int ret;
+  char *fn;
+  RequestInitIndex *ri;
+  int fnLen;
   
   if (ntohs(req->size) < sizeof(RequestInitIndex)) {
     BREAK();
     return SYSERR;
   }
   
-  ret = ONDEMAND_initIndex(&((RequestInitIndex *)req)->fileId,
-          (const char *) &((RequestInitIndex *)req)[1]);
+  ri = (RequestInitIndex *) req;
+  
+  fnLen = ntohs(ri->header.size) - sizeof(RequestInitIndex);
+  if (fnLen > _MAX_PATH)
+    return SYSERR;
+  fn = (char *) MALLOC(fnLen + 1);
+  strncpy(fn, &ri[1], _MAX_PATH);
+  fn[_MAX_PATH] = 0;
+  
+  ret = ONDEMAND_initIndex(&ri->fileId,
+          fn);
+          
+  FREE(fn);
 
   LOG(LOG_DEBUG,
       "Sending confirmation (%s) of index initialization request to client\n",

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2005-03-09 22:22:12 UTC 
(rev 422)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2005-03-10 20:17:35 UTC 
(rev 423)
@@ -216,7 +216,7 @@
        (sscanf(sql_row[1], "%u", &type) != 1) ||
        (sscanf(sql_row[2], "%u", &prio) != 1) ||
        (sscanf(sql_row[3], "%u", &level) != 1) ||
-       (sscanf(sql_row[4], "%llu", &exp) != 1) ) {
+       (SSCANF(sql_row[4], "%llu", &exp) != 1) ) {
     LOG(LOG_WARNING,
        "SQL Database corrupt, ignoring result.\n");
     return NULL;

Modified: GNUnet/src/applications/tbench/gnunet-tbench.c
===================================================================
--- GNUnet/src/applications/tbench/gnunet-tbench.c      2005-03-09 22:22:12 UTC 
(rev 422)
+++ GNUnet/src/applications/tbench/gnunet-tbench.c      2005-03-10 20:17:35 UTC 
(rev 423)
@@ -160,7 +160,7 @@
       }
       break;
     case 't':
-      if(1 != sscanf(GNoptarg, 
+      if(1 != SSCANF(GNoptarg, 
                     "%llud", 
                     &messageTimeOut)){
        LOG(LOG_FAILURE, 
@@ -175,7 +175,7 @@
             TBENCH_VERSION);
       return SYSERR;
     case 'X':
-      if(1 != sscanf(GNoptarg, 
+      if(1 != SSCANF(GNoptarg, 
                     "%llud",
                     &messageSpacing)){
        LOG(LOG_FAILURE, 
@@ -247,9 +247,9 @@
     switch (outputFormat) {
     case OF_HUMAN_READABLE:
       printf(_("Time:\n"));
-      printf(_("\tmax      %llums\n"),
+      PRINTF(_("\tmax      %llums\n"),
             ntohll(buffer->max_time));
-      printf(_("\tmin      %llums\n"),
+      PRINTF(_("\tmin      %llums\n"),
             ntohll(buffer->min_time));
       printf(_("\tmean     %8.4fms\n"),
             buffer->mean_time);

Modified: GNUnet/src/include/platform.h
===================================================================
--- GNUnet/src/include/platform.h       2005-03-09 22:22:12 UTC (rev 422)
+++ GNUnet/src/include/platform.h       2005-03-10 20:17:35 UTC (rev 423)
@@ -199,6 +199,12 @@
  #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
  #define _REAL_SNPRINTF(str, size, fmt, ...) snprintf(str, size, fmt, 
__VA_ARGS__)
  #define SPRINTF(d, f, ...) sprintf(d, f, __VA_ARGS__)
+ #define VSSCANF(s, f, a) vsscanf(s, f, a)
+ #define SSCANF(s, f, ...) sscanf(s, f, __VA_ARGS__)
+ #define VFSCANF(s, f, a) vfscanf(s, f, a)
+ #define VSCANF(f, a) vscanf(f, a)
+ #define SCANF(f, ...) scanf(f, __VA_ARGS__)
+ #define FSCANF(s, f, ...) fscanf(s, f, __VA_ARGS__)
  #define ACCEPT(s, a, l) accept(s, a, l)
  #define BIND(s, n, l) bind(s, n, l)
  #define CONNECT(s, n, l) connect(s, n, l)
@@ -239,7 +245,7 @@
  #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
  #define SYMLINK(a, b) _win_symlink(a, b)
  #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
- #define MUNMAP(s, l) _win_munmap(s, l);
+ #define MUNMAP(s, l) _win_munmap(s, l)
  #define STRERROR(i) _win_strerror(i)
  #define READLINK(p, b, s) _win_readlink(p, b, s)
  #define LSTAT(p, b) _win_lstat(p, b)
@@ -251,6 +257,12 @@
  #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
  #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, 
__VA_ARGS__)
  #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
+ #define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
+ #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
+ #define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
+ #define VSCANF(f, a) _win_vscanf(f, a)
+ #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
+ #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
  #define ACCEPT(s, a, l) _win_accept(s, a, l)
  #define BIND(s, n, l) _win_bind(s, n, l)
  #define CONNECT(s, n, l) _win_connect(s, n, l)

Modified: GNUnet/src/include/winproc.h
===================================================================
--- GNUnet/src/include/winproc.h        2005-03-09 22:22:12 UTC (rev 422)
+++ GNUnet/src/include/winproc.h        2005-03-10 20:17:35 UTC (rev 423)
@@ -423,6 +423,12 @@
 int _win_vsnprintf(char* str, size_t size, const char *format, va_list 
arg_ptr);
 int _win_snprintf(char *str,size_t size,const char *format,...);
 int _win_sprintf(char *dest,const char *format,...);
+int _win_vsscanf(const char* str, const char* format, va_list arg_ptr);
+int _win_sscanf(const char *str, const char *format, ...);
+int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vscanf(const char *format, va_list arg_ptr);
+int _win_scanf(const char *format, ...);
+int _win_fscanf(FILE *stream, const char *format, ...);
 int _win_bind(SOCKET s, const struct sockaddr *name, int namelen);
 int _win_connect(SOCKET s,const struct sockaddr *name, int namelen);
 int _win_getpeername(SOCKET s, struct sockaddr *name,

Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c  2005-03-09 22:22:12 UTC (rev 
422)
+++ GNUnet/src/server/gnunet-transport-check.c  2005-03-10 20:17:35 UTC (rev 
423)
@@ -423,7 +423,7 @@
       break;
     }
     case 'T':{
-      if (1 != sscanf(GNoptarg, "%llu", &timeout)) {
+      if (1 != SSCANF(GNoptarg, "%llu", &timeout)) {
        LOG(LOG_FAILURE, 
            _("You must pass a number to the '%s' option.\n"),
            "-T");

Modified: GNUnet/src/util/win/win_printf.c
===================================================================
--- GNUnet/src/util/win/win_printf.c    2005-03-09 22:22:12 UTC (rev 422)
+++ GNUnet/src/util/win/win_printf.c    2005-03-10 20:17:35 UTC (rev 423)
@@ -34,12 +34,19 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h>
+#include <ctype.h>
+#include <io.h>
 
 #define WANT_ERROR_PRINTF 1
 #define WANT_LONGLONG_PRINTF 1
 #define WANT_NULL_PRINTF 1
 #define WANT_FLOATING_POINT_IN_PRINTF 1
 
+#define WANT_FLOATING_POINT_IN_SCANF
+#define WANT_LONGLONG_SCANF
+#define WANT_CHARACTER_CLASSES_IN_SCANF
+
 struct str_data {
   unsigned char* str;
   size_t len;
@@ -139,6 +146,24 @@
   return i;
 }
 
+int isinf(double d) {
+  union {
+    unsigned long long l;
+    double d;
+  } u;
+  u.d=d;
+  return (u.l==0x7FF0000000000000ll?1:u.l==0xFFF0000000000000ll?-1:0);
+}
+
+int isnan(double d) {
+  union {
+    unsigned long long l;
+    double d;
+  } u;
+  u.d=d;
+  return (u.l==0x7FF8000000000000ll || u.l==0x7FF0000000000000ll || 
u.l==0xfff8000000000000ll);
+}
+
 int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned 
int prec2) {
 #if 1
   union {
@@ -272,15 +297,6 @@
   return buf-oldbuf;
 }
 
-int isinf(double d) {
-  union {
-    unsigned long long l;
-    double d;
-  } u;
-  u.d=d;
-  return (u.l==0x7FF0000000000000ll?1:u.l==0xFFF0000000000000ll?-1:0);
-}
-
 int __v_printf(struct arg_printf* fn, const unsigned char *format, va_list 
arg_ptr)
 {
   int len=0;
@@ -713,4 +729,473 @@
   return n;
 }
 
+#define A_GETC(fn)  (++consumed,(fn)->getch((fn)->data))
+#define A_PUTC(c,fn)  (--consumed,(fn)->putch((c),(fn)->data))
+
+struct arg_scanf {
+  void *data;
+  int (*getch)(void*);
+  int (*putch)(int,void*);
+};
+
+int __v_scanf(struct arg_scanf* fn, const unsigned char *format, va_list 
arg_ptr)
+{
+  unsigned int ch;  /* format act. char */
+  int n=0;
+
+  /* arg_ptr tmps */
+#ifdef WANT_FLOATING_POINT_IN_SCANF
+  double *pd;
+  float  *pf;
+#endif
+#ifdef WANT_LONGLONG_SCANF
+  long long *pll;
+#endif
+  long   *pl;
+  short  *ph;
+  int    *pi;
+  char    *s;
+
+  unsigned int consumed=0;
+
+  /* get one char */
+  int tpch= A_GETC(fn);
+
+  //while ((tpch!=-1)&&(*format))
+  while (*format)
+  {
+    ch=*format++;
+    switch (ch) {
+    /* end of format string ?!? */
+    case 0: return 0;
+
+    /* skip spaces ... */
+    case ' ':
+    case '\f':
+    case '\t':
+    case '\v':
+    case '\n':
+    case '\r':
+      while((*format)&&(isspace(*format))) ++format;
+      while(isspace(tpch)) tpch=A_GETC(fn);
+      break;
+
+    /* format string ... */
+    case '%':
+      {
+  unsigned int _div=0;
+  int width=-1;
+  char flag_width=0;
+  char flag_discard=0;
+  char flag_half=0;
+  char flag_long=0;
+  char flag_longlong=0;
+
+in_scan:
+  ch=*format++;
+  if(ch!='n' && tpch==-1) goto err_out;
+  switch (ch) {
+  /* end of format string ?!? */
+  case 0: return 0;
+
+  /* check for % */
+  case '%':
+    if ((unsigned char)tpch != ch) goto err_out;
+    tpch=A_GETC(fn);
+    break;
+
+  /* FLAGS */
+  case '*':
+    flag_discard=1;
+    goto in_scan;
+  case 'h':
+    flag_half=1;
+    goto in_scan;
+  case 'l':
+    if (flag_long) flag_longlong=1;
+    flag_long=1;
+    goto in_scan;
+  case 'q':
+  case 'L':
+    flag_longlong=1;
+    goto in_scan;
+
+  /* WIDTH */
+  case '0':
+  case '1':
+  case '2':
+  case '3':
+  case '4':
+  case '5':
+  case '6':
+  case '7':
+  case '8':
+  case '9':
+    width=strtol(format-1,&s,10);
+    format=s;
+    flag_width=1;
+    goto in_scan;
+
+  /* scan for integer / strtol reimplementation ... */
+  case 'p':
+  case 'X':
+  case 'x':
+    _div+=6;
+  case 'd':
+    _div+=2;
+  case 'o':
+    _div+=8;
+  case 'u':
+  case 'i':
+    {
+#ifdef WANT_LONGLONG_SCANF
+      unsigned long long v=0;
+#else
+      unsigned long v=0;
+#endif
+      unsigned int consumedsofar;
+      int neg=0;
+      while(isspace(tpch)) tpch=A_GETC(fn);
+      if (tpch=='-') {
+        tpch=A_GETC(fn);
+        neg=1;
+      }
+
+      if (tpch=='+') tpch=A_GETC(fn);
+
+      if (tpch==-1) return n;
+      consumedsofar=consumed;
+
+      if (!flag_width) {
+        if ((_div==16) && (tpch=='0')) goto scan_hex;
+        if (!_div) {
+    _div=10;
+    if (tpch=='0') {
+      _div=8;
+scan_hex:
+      tpch=A_GETC(fn);
+      if ((tpch|32)=='x') {
+        tpch=A_GETC(fn);
+        _div=16;
+      }
+    }
+        }
+      }
+      while ((width)&&(tpch!=-1)) {
+        register unsigned long c=tpch&0xff;
+#ifdef WANT_LONGLONG_SCANF
+        register unsigned long long d=c|0x20;
+#else
+        register unsigned long d=c|0x20;
+#endif
+        c=(d>='a'?d-'a'+10:c<='9'?c-'0':0xff);
+        if (c>=_div) break;
+        d=v*_div;
+#ifdef WANT_LONGLONG_SCANF
+        v=(d<v)?ULLONG_MAX:d+c;
+#else
+        v=(d<v)?ULONG_MAX:d+c;
+#endif
+        --width;
+        tpch=A_GETC(fn);
+      }
+
+      if (consumedsofar==consumed) return n;
+
+      if ((ch|0x20)<'p') {
+#ifdef WANT_LONGLONG_SCANF
+        register long long l=v;
+        if (v>=-((unsigned long long)LLONG_MIN)) {
+    l=(neg)?LLONG_MIN:LLONG_MAX;
+        }
+        else {
+    if (neg) v*=-1;
+        }
+#else
+        register long l=v;
+        if (v>=-((unsigned long)LONG_MIN)) {
+    l=(neg)?LONG_MIN:LONG_MAX;
+        }
+        else {
+    if (neg) v*=-1;
+        }
+#endif
+      }
+      if (!flag_discard) {
+#ifdef WANT_LONGLONG_SCANF
+        if (flag_longlong) {
+    pll=(long long *)va_arg(arg_ptr,long long*);
+    *pll=v;
+        } else
+#endif
+        if (flag_long) {
+    pl=(long *)va_arg(arg_ptr,long*);
+    *pl=v;
+        } else if (flag_half) {
+    ph=(short*)va_arg(arg_ptr,short*);
+    *ph=v;
+        } else {
+    pi=(int *)va_arg(arg_ptr,int*);
+    *pi=v;
+        }
+        if(consumedsofar<consumed) ++n;
+      }
+    }
+    break;
+
+  /* FIXME: return value of *scanf with ONE float maybe -1 instead of 0 */
+#ifdef WANT_FLOATING_POINT_IN_SCANF
+  /* floating point numbers */
+  case 'e':
+  case 'E':
+  case 'f':
+  case 'g':
+    {
+      double d=0.0;
+      int neg=0;
+      unsigned int consumedsofar;
+
+      while(isspace(tpch)) tpch=A_GETC(fn);
+
+      if (tpch=='-') {
+        tpch=A_GETC(fn);
+        neg=1;
+      }
+      if (tpch=='+') tpch=A_GETC(fn);
+
+      consumedsofar=consumed;
+
+      while (isdigit(tpch)) {
+        d=d*10+(tpch-'0');
+        tpch=A_GETC(fn);
+      }
+      if (tpch=='.') {
+        double factor=.1;
+        consumedsofar++;
+        tpch=A_GETC(fn);
+        while (isdigit(tpch)) {
+    d=d+(factor*(tpch-'0'));
+    factor/=10;
+    tpch=A_GETC(fn);
+        }
+      }
+      if (consumedsofar==consumed) return n;  /* error */
+      if ((tpch|0x20)=='e') {
+        int exp=0, prec=tpch;
+        double factor=10;
+        tpch=A_GETC(fn);
+        if (tpch=='-') {
+    factor=0.1;
+    tpch=A_GETC(fn);
+        } else if (tpch=='+') {
+    tpch=A_GETC(fn);
+        } else {
+    d=0;
+    if (tpch!=-1) A_PUTC(tpch,fn);
+    tpch=prec;
+    goto exp_out;
+        }
+        consumedsofar=consumed;
+        while (isdigit(tpch)) {
+    exp=exp*10+(tpch-'0');
+    tpch=A_GETC(fn);
+        }
+        if (consumedsofar==consumed) return n;  /* error */
+        while (exp) { /* as in strtod: XXX: this introduces rounding errors */
+    d*=factor; --exp;
+        }
+      }
+exp_out:
+      if (!flag_discard) {
+        if (flag_long) {
+    pd=(double *)va_arg(arg_ptr,double*);
+    *pd=d;
+        } else {
+    pf=(float *)va_arg(arg_ptr,float*);
+    *pf=d;
+        }
+        ++n;
+      }
+    }
+    break;
+#endif
+
+  /* char-sequences */
+  case 'c':
+    if (!flag_discard) {
+      s=(char *)va_arg(arg_ptr,char*);
+      ++n;
+    }
+    if (!flag_width) width=1;
+    while (width && (tpch!=-1)) {
+      if (!flag_discard) *(s++)=tpch;
+      --width;
+      tpch=A_GETC(fn);
+    }
+    break;
+
+  /* string */
+  case 's':
+    if (!flag_discard) s=(char *)va_arg(arg_ptr,char*);
+    while(isspace(tpch)) tpch=A_GETC(fn);
+    if (tpch==-1) break;    /* end of scan -> error */
+    while (width && (tpch!=-1) && (!isspace(tpch))) {
+      if (!flag_discard) *s=tpch;
+      if (tpch) ++s; else break;
+      --width;
+      tpch=A_GETC(fn);
+    }
+    if (!flag_discard) { *s=0; ++n; }
+    break;
+
+  /* consumed-count */
+  case 'n':
+    if (!flag_discard) {
+      pi=(int *)va_arg(arg_ptr,int *);
+//      ++n;  /* in accordance to ANSI C we don't count this conversion */
+            *pi=consumed-1;
+    }
+    break;
+
+#ifdef WANT_CHARACTER_CLASSES_IN_SCANF
+  case '[':
+    {
+      char cset[256];
+      int flag_not=0;
+      int flag_dash=0;
+      memset(cset,0,sizeof(cset));
+      ch=*format++;
+      /* first char specials */
+      if (ch=='^') {
+        flag_not=1;
+        ch=*format++;
+      }
+      if ((ch=='-')||(ch==']')) {
+        cset[ch]=1;
+        ch=*format++;
+      }
+      /* almost all non special chars */
+      for (;(*format) && (*format!=']');++format) {
+        if (flag_dash) {
+    register unsigned char tmp=*format;
+    for (;ch<=tmp;++ch) cset[ch]=1;
+    flag_dash=0;
+    ch=*format;
+        }
+        else if (*format=='-') flag_dash=1;
+        else {
+    cset[ch]=1;
+    ch=*format;
+        }
+      }
+      /* last char specials */
+      if (flag_dash) cset['-']=1;
+      else cset[ch]=1;
+
+      /* like %c or %s */
+      if (!flag_discard) {
+        s=(char *)va_arg(arg_ptr,char*);
+        ++n;
+      }
+      while (width && (tpch>=0) && (cset[tpch]^flag_not)) {
+        if (!flag_discard) *s=tpch;
+        if (tpch) ++s; else break;
+        --width;
+        tpch=A_GETC(fn);
+      }
+      if (!flag_discard) *s=0;
+      ++format;
+    }
+    break;
+#endif
+  default:
+    goto err_out;
+  }
+      }
+      break;
+
+    /* check if equal format string... */
+    default:
+      if ((unsigned char)tpch != ch) goto err_out;
+      tpch=A_GETC(fn);
+      break;
+    }
+  }
+
+  /* maybe a "%n" follows */
+  if(*format) {
+    while(isspace(*format)) format++;
+    if(format[0] == '%' && format[1] == 'n') {
+      pi = (int *) va_arg(arg_ptr, int *);
+      *pi = consumed - 1;
+    }
+  }
+
+err_out:
+  if (tpch<0 && n==0) return EOF;
+  A_PUTC(tpch,fn);
+  return n;
+}
+
+struct scanf_str_data {
+  unsigned char* str;
+};
+
+static int sgetc(struct scanf_str_data* sd) {
+  register unsigned int ret = *(sd->str++);
+  return (ret)?(int)ret:-1;
+}
+
+static int sputc(int c, struct scanf_str_data* sd) {
+  return (*(--sd->str)==c)?c:-1;
+}
+
+int _win_vsscanf(const char* str, const char* format, va_list arg_ptr)
+{
+  struct scanf_str_data  fdat = { (unsigned char*)str };
+  struct arg_scanf farg = { (void*)&fdat, (int(*)(void*))sgetc, 
(int(*)(int,void*))sputc };
+  return __v_scanf(&farg,format,arg_ptr);
+}
+
+int _win_sscanf(const char *str, const char *format, ...)
+{
+  int n;
+  va_list arg_ptr;
+  va_start(arg_ptr, format);
+  n = _win_vsscanf(str,format,arg_ptr);
+  va_end (arg_ptr);
+  return n;
+}
+
+int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr)
+{
+  struct arg_scanf farg = { (void*)stream, (int(*)(void*))fgetc, 
(int(*)(int,void*))ungetc };
+  return __v_scanf(&farg,format,arg_ptr);
+}
+
+int _win_vscanf(const char *format, va_list arg_ptr)
+{
+  return _win_vfscanf(stdin,format,arg_ptr);
+}
+
+int _win_scanf(const char *format, ...)
+{
+  int n;
+  va_list arg_ptr;
+  va_start(arg_ptr, format);
+  n = _win_vfscanf(stdin,format,arg_ptr);
+  va_end (arg_ptr);
+  return n;
+}
+
+int _win_fscanf(FILE *stream, const char *format, ...)
+{
+  int n;
+  va_list arg_ptr;
+  va_start(arg_ptr, format);
+  n = _win_vfscanf(stream,format,arg_ptr);
+  va_end (arg_ptr);
+  return n;
+}
+
 /* end of win_printf.c */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]