Re: [PATCH xinit] startx: Don't use GNU expr extensions

2015-01-29 Thread Hans de Goede

Hi,

On 29-01-15 11:36, Mark Kettenis wrote:

Use the ':' operator instead of match and avoid the use of \+.  Both
constructions aren't specified by POSIX and not supported in BSD expr.
Also drop the '^' from the regular expressions as it is implicit and
POSIX leaves its behaviour undefined.

Signed-off-by: Mark Kettenis kette...@openbsd.org


Looks good, and I've checked that this still does what we want it to do under
Linux / bash:

Acked-by: Hans de Goede hdego...@redhat.com


---
  startx.cpp | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/startx.cpp b/startx.cpp
index 45d7bd9..ce4713f 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -193,7 +193,7 @@ if [ x$server = x ]; then
  XCOMM the startx session being seen as inactive:
  XCOMM https://bugzilla.redhat.com/show_bug.cgi?id=806491;
  tty=$(tty)
-if expr match $tty '^/dev/tty[0-9]\+$'  /dev/null; then
+if expr $tty : '/dev/tty[0-9][0-9]*$'  /dev/null; then
  tty_num=$(echo $tty | grep -oE '[0-9]+$')
  vtarg=vt$tty_num -keeptty
  fi
@@ -217,7 +217,7 @@ fi
  XCOMM if no vt is specified add vtarg (which may be empty)
  have_vtarg=no
  for i in $serverargs; do
-if expr match $i '^vt[0-9]\+$'  /dev/null; then
+if expr $i : 'vt[0-9][0-9]*$'  /dev/null; then
  have_vtarg=yes
  fi
  done



Regards,

Hans
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xinit] startx: Don't use GNU expr extensions

2015-01-29 Thread Mark Kettenis
Use the ':' operator instead of match and avoid the use of \+.  Both
constructions aren't specified by POSIX and not supported in BSD expr.
Also drop the '^' from the regular expressions as it is implicit and
POSIX leaves its behaviour undefined.

Signed-off-by: Mark Kettenis kette...@openbsd.org
---
 startx.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/startx.cpp b/startx.cpp
index 45d7bd9..ce4713f 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -193,7 +193,7 @@ if [ x$server = x ]; then
 XCOMM the startx session being seen as inactive:
 XCOMM https://bugzilla.redhat.com/show_bug.cgi?id=806491;
 tty=$(tty)
-if expr match $tty '^/dev/tty[0-9]\+$'  /dev/null; then
+if expr $tty : '/dev/tty[0-9][0-9]*$'  /dev/null; then
 tty_num=$(echo $tty | grep -oE '[0-9]+$')
 vtarg=vt$tty_num -keeptty
 fi
@@ -217,7 +217,7 @@ fi
 XCOMM if no vt is specified add vtarg (which may be empty)
 have_vtarg=no
 for i in $serverargs; do
-if expr match $i '^vt[0-9]\+$'  /dev/null; then
+if expr $i : 'vt[0-9][0-9]*$'  /dev/null; then
 have_vtarg=yes
 fi
 done
-- 
2.2.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel