Skip to contentSkip to conversation

avoid "expr length" (improved version)

TRIVIAL Rusty Russell 1 participant 1 message Mar 22, 2004 Kbuild

lore
Share & tools
lore
#0 lore raw

From: Martin Schaffner <[email protected]>

---
I improved my patch to avoid the "expr length" GNU-ism. It should be much clearer now. It uses "wc -c" to count the letters.

Thanks,
Martin

Makefile renamed from Makefile.orig +1 -1
@@ -652,7 +652,7 @@
 uts_len := 64
 
 define filechk_version.h
-	if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
+	if ((`echo -n "$(KERNELRELEASE)" | wc -c ` > $(uts_len))); then \
 	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
 	  exit 1; \
 	fi; \
Signature · 3 lines
  What is this? http://www.kernel.org/pub/linux/kernel/people/rusty/trivial/
  Don't blame me: the Monkey is driving
  File: Martin Schaffner <[email protected]>: [PATCH] avoid "expr length" (improved version)