Hello,
Upstream flex converted macro PRINT_SPACES() into a single fprintf() call.
https://github.com/westes/flex/commit/37a6184dabcd82fa1d17c24c000f3da469296195#diff-25d902c24283ab8cfbac54dfa101ad31
Applying this to OpenBSD lex reduces the differences in scanopt.c between the
two.
- Michael
Index: scanopt.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/scanopt.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 scanopt.c
--- scanopt.c 31 May 2017 07:20:26 -0000 1.6
+++ scanopt.c 30 Nov 2017 01:50:43 -0000
@@ -409,14 +409,8 @@ int scanopt_usage (scanner, fp, usag
}
desccol = maxlen[0] + indent * 2;
-#define PRINT_SPACES(fp,n)\
- do{\
- int _n;\
- _n=(n);\
- while(_n-- > 0)\
- fputc(' ',(fp));\
- }while(0)
-
+#define PRINT_SPACES(fp,n) \
+ fprintf((fp), "%*s", (n), "")
/* Second pass (same as above loop), this time we print. */
/* Sloppy hack: We iterate twice. The first time we print short and
long options.