From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mimir.eigenstate.org ([206.124.132.107]) by ewsd; Fri May 1 14:36:27 EDT 2020 Received: from abbatoir.fios-router.home (pool-162-83-132-245.nycmny.fios.verizon.net [162.83.132.245]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id ded44599 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Fri, 1 May 2020 11:35:44 -0700 (PDT) Message-ID: <2FEF219DA98009787EB1F5009C70E299@eigenstate.org> To: 9front@9front.org Subject: ape sscanf %lld Date: Fri, 1 May 2020 11:35:43 -0700 From: ori@eigenstate.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: extended proven replication-scale controller This implements %lld and %jd for sscanf, also found when dealing with zic. diff -r 8006152d13d2 sys/src/ape/lib/ap/stdio/vfscanf.c --- a/sys/src/ape/lib/ap/stdio/vfscanf.c Tue Apr 28 20:51:19 2020 -0700 +++ b/sys/src/ape/lib/ap/stdio/vfscanf.c Fri May 01 11:34:11 2020 -0700 @@ -97,7 +97,13 @@ } else width=-1; - type=*fmtp=='h' || *fmtp=='l' || *fmtp=='L'?*fmtp++:'n'; + type = 'n'; + if(*fmtp=='h' || *fmtp=='l' || *fmtp=='L' || *fmtp=='j') + type = *fmtp++; + if(type == 'l' && *fmtp == 'l'){ + type = 'V'; + fmtp++; + } if(!icvt[*fmtp]) goto NonSpecial; if(!(*icvt[*fmtp])(f, &args, store, width, type)) return ncvt?ncvt:EOF; @@ -138,7 +144,7 @@ static int icvt_fixed(FILE *f, va_list *args, int store, int width, int type, int unsgned, int base){ - unsigned long int num=0; + unsigned long long num=0; int sign=1, ndig=0, dig; int c; do @@ -199,6 +205,8 @@ case 'n': *va_arg(*args, int *)=num*sign; break; case 'l': case 'L': *va_arg(*args, long *)=num*sign; break; + case 'j': + case 'V': *va_arg(*args, long long*)=num*sign; break; } break; case UNSIGNED: @@ -207,6 +215,8 @@ case 'n': *va_arg(*args, unsigned int *)=num*sign; break; case 'l': case 'L': *va_arg(*args, unsigned long *)=num*sign; break; + case 'j': + case 'V': *va_arg(*args, unsigned long long *)=num*sign; break; } break; case POINTER: