shithub: drawterm-fdroid

Download patch

ref: 0fbac08cd028f95c5f5e99e3f3dfd27a2f2858ab
parent: 07eda1b895f1fd4f4cea3f56deb76e16b0e02c3d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 31 06:36:54 EST 2017

libc: update encodefmt support l flag on < (base32) (from 9front)

--- a/libc/encodefmt.c
+++ b/libc/encodefmt.c
@@ -48,17 +48,14 @@
 	// convert
 	out = buf;
 	switch(f->r){
-	case '<':
-		rv = enc32(out, len, b, ilen);
-		break;
 	case '[':
 		rv = enc64(out, len, b, ilen);
 		break;
+	case '<':
+		rv = enc32(out, len, b, ilen);
+		break;
 	case 'H':
 		rv = enc16(out, len, b, ilen);
-		if(rv >= 0 && (f->flags & FmtLong))
-			for(p = buf; *p; p++)
-				*p = tolower(*p);
 		break;
 	default:
 		rv = -1;
@@ -66,6 +63,10 @@
 	}
 	if(rv < 0)
 		goto error;
+
+	if((f->flags & FmtLong) != 0 && f->r != '[')
+		for(p = buf; *p; p++)
+			*p = tolower(*p);
 
 	fmtstrcpy(f, buf);
 	if(buf != obuf)