git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Remove non-POSIX 'expr index' from instaweb.

From
Bryan Larsen <bryan@larsen.st>
Date
Sep 14, 2007, 22:01 UTC
Message-ID
<ef57d1660709141501m332b31a5yc5f3644c1edbdd0e@mail.gmail.com>

git-instaweb.sh uses the non-POSIX 'expr index' command, which is not present on some BSD's. This patch replaces this usage with a simple grep expression.

Signed-off-by: Bryan Larsen < bryan@larsen.st>
---
 git-instaweb.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index ce631a0..ef1a4bf 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -30,8 +30,7 @@ test -z "$port" && port=1234

 start_httpd () {
        httpd_only="`echo $httpd | cut -f1 -d' '`"
-       if test "`expr index $httpd_only /`" -eq '1' || \
-                               which $httpd_only >/dev/null
+       if test echo $http_only | grep ^/ || which $httpd_only >/dev/null
        then
                $httpd $fqgitdir/gitweb/httpd.conf
        else
-- 
1.5.3.1
Message 1 of 1 in “Remove non-POSIX 'expr index' from instaweb.”
  1. Remove non-POSIX 'expr index' from instaweb.Bryan Larsen, Sep 14, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.