Author: dnicholson
Date: 2007-02-22 15:34:23 -0700 (Thu, 22 Feb 2007)
New Revision: 7929

Modified:
   trunk/bootscripts/ChangeLog
   trunk/bootscripts/lfs/init.d/functions
Log:
Use POSIX shell built-ins to calculate STRING_LENGTH


Modified: trunk/bootscripts/ChangeLog
===================================================================
--- trunk/bootscripts/ChangeLog 2007-02-22 22:29:24 UTC (rev 7928)
+++ trunk/bootscripts/ChangeLog 2007-02-22 22:34:23 UTC (rev 7929)
@@ -1,4 +1,9 @@
 2007-02-22     Dan Nicholson   <[EMAIL PROTECTED]>
+       * lfs/init.d/functions: Use arithmetic expansion and string length,
+         which are both mandated by POSIX, rather than spawning two processes
+         every time boot_mesg() is called.
+
+2007-02-22     Dan Nicholson   <[EMAIL PROTECTED]>
        * lfs/init.d/functions: In order to provide an `echo' which provides
          handles the -e and -n options for all POSIX shells, a feature test
          is added which stores its result in $ECHO. /bin/echo will be used

Modified: trunk/bootscripts/lfs/init.d/functions
===================================================================
--- trunk/bootscripts/lfs/init.d/functions      2007-02-22 22:29:24 UTC (rev 
7928)
+++ trunk/bootscripts/lfs/init.d/functions      2007-02-22 22:34:23 UTC (rev 
7929)
@@ -110,9 +110,8 @@
        done
 
        ## Figure out the length of what is to be printed to be used
-        ## for warning messges. 
-       STRING_LENGTH="`echo "${1}" | sed \
-               -e 's,.,.,g' -e 'l 1' | grep -c \$`"
+       ## for warning messages. 
+       STRING_LENGTH=$((${#1} + 1))
 
        # Print the message to the screen
        ${ECHO} ${ECHOPARM} -e "${2}${1}"

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to