]> granicus.if.org Git - postgresql/commitdiff
Add in, I think, support for %lld in snprintf(), specifically with
authorMarc G. Fournier <scrappy@hub.org>
Wed, 23 Sep 1998 03:11:24 +0000 (03:11 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Wed, 23 Sep 1998 03:11:24 +0000 (03:11 +0000)
Irix in mind...

src/backend/port/snprintf.c

index 9cc378687824ecb925933e4f20790cee48af644f..bd421329a92b7c5bd9e9a8c7d23658ee6a453039 100644 (file)
@@ -70,7 +70,7 @@
  * causing nast effects.
  **************************************************************/
 
-/*static char _id[] = "$Id: snprintf.c,v 1.6 1998/09/18 05:20:22 momjian Exp $";*/
+/*static char _id[] = "$Id: snprintf.c,v 1.7 1998/09/23 03:11:24 scrappy Exp $";*/
 static char *end;
 static int     SnprfOverflow;
 
@@ -126,6 +126,7 @@ dopr (char *buffer, const char *format, ... )
        int ch;
        long value;
        int longflag  = 0;
+       int longlongflag  = 0;
        int pointflag = 0;
        int maxwidth  = 0;
        char *strvalue;
@@ -167,7 +168,11 @@ dopr (char *buffer, const char *format, ... )
                                 len = va_arg( args, int );
                               goto nextch;
                       case '.': pointflag = 1; goto nextch;
-                       case 'l': longflag = 1; goto nextch;
+                       case 'l': if(longflag) {
+                                   longlongflag = 1; goto nextch;
+                                 } else {
+                                   longflag = 1; goto nextch;
+                                 }
                        case 'u': case 'U':
                                /*fmtnum(value,base,dosign,ljust,len,zpad) */
                                if( longflag ){
@@ -186,7 +191,11 @@ dopr (char *buffer, const char *format, ... )
                                fmtnum( value, 8,0, ljust, len, zpad ); break;
                        case 'd': case 'D':
                                if( longflag ){
+                                 if( longlongflag ) {
+                                       value = va_arg( args, long long );
+                                 } else {
                                        value = va_arg( args, long );
+                                 }
                                } else {
                                        value = va_arg( args, int );
                                }