dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mkbuiltins: Use a `while` loop rather than `nl`
@ 2016-08-04  5:54 Kylie McClain
  2016-08-04  5:54 ` [PATCH 2/2] histedit: Remove non-glibc fallback code Kylie McClain
  2016-08-04 17:17 ` [PATCH 1/2] mkbuiltins: Use a `while` loop rather than `nl` Harald van Dijk
  0 siblings, 2 replies; 9+ messages in thread
From: Kylie McClain @ 2016-08-04  5:54 UTC (permalink / raw)
  To: dash; +Cc: Kylie McClain

From: Kylie McClain <somasis@exherbo.org>

nl, while specified in POSIX, is rather obscure and isn't provided by small
coreutils implementations such as `busybox`. This while loop works just as
well for our purposes.
---
 src/mkbuiltins | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mkbuiltins b/src/mkbuiltins
index b4d6f4e..a47bce8 100644
--- a/src/mkbuiltins
+++ b/src/mkbuiltins
@@ -101,7 +101,8 @@ cat <<\!
  */
 
 !
-sed 's/	-[a-z]*//' $temp2 | nl -ba -v0 |
+sed 's/	-[a-z]*//' $temp2 | while read line;do \
+	i=$(( ${i:--1} + 1 )); printf '%s %s\n' "${i}" "${line}";done |
 	LC_ALL= LC_COLLATE=C sort -u -k 3,3 |
 	tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
 	awk '{	printf "#define %s (builtincmd + %d)\n", $3, $1}'
-- 
2.9.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-08 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04  5:54 [PATCH 1/2] mkbuiltins: Use a `while` loop rather than `nl` Kylie McClain
2016-08-04  5:54 ` [PATCH 2/2] histedit: Remove non-glibc fallback code Kylie McClain
2016-08-04 15:59   ` Jilles Tjoelker
2016-08-08 15:50     ` Jilles Tjoelker
2016-08-04 17:17 ` [PATCH 1/2] mkbuiltins: Use a `while` loop rather than `nl` Harald van Dijk
2016-08-06  9:02   ` Seb
2016-08-07 10:17     ` Seb
2016-08-06 16:51   ` Harald van Dijk
2016-08-08 15:33   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).