From: Kylie McClain <somasissounds@gmail.com>
To: dash@vger.kernel.org
Cc: Kylie McClain <somasis@exherbo.org>
Subject: [PATCH 1/2] mkbuiltins: Use a `while` loop rather than `nl`
Date: Thu, 4 Aug 2016 01:54:10 -0400 [thread overview]
Message-ID: <20160804055411.23558-1-somasissounds@gmail.com> (raw)
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
next reply other threads:[~2016-08-04 8:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 5:54 Kylie McClain [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160804055411.23558-1-somasissounds@gmail.com \
--to=somasissounds@gmail.com \
--cc=dash@vger.kernel.org \
--cc=somasis@exherbo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox