1131554Stjr#!/bin/sh
253568Sobrien# Test for POSIX.2 options for grep
353568Sobrien#
453568Sobrien# grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list 
553568Sobrien#      [-f pattern_file] ... [file. ..]
653568Sobrien# grep [ -E| -F][ -c| -l| -q ][-insvx][-e pattern_list]
753568Sobrien#      -f pattern_file ... [file ...]
853568Sobrien# grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...]
953568Sobrien#
1053568Sobrien
1153568Sobrien: ${srcdir=.}
1253568Sobrien
1353568Sobrienfailures=0
1453568Sobrien
1553568Sobrien# checking for -E extended regex
1653568Sobrienecho "abababccccccd" | ${GREP} -E -e 'c{3}' > /dev/null 2>&1
1753568Sobrienif test $? -ne 0 ; then
1853568Sobrien        echo "Options: Wrong status code, test \#1 failed"
1953568Sobrien        failures=1
2053568Sobrienfi
2153568Sobrien
2253568Sobrien# checking for basic regex
2353568Sobrienecho "abababccccccd" | ${GREP} -G -e 'c\{3\}' > /dev/null 2>&1
2453568Sobrienif test $? -ne 0 ; then
2553568Sobrien        echo "Options: Wrong status code, test \#2 failed"
2653568Sobrien        failures=1
2753568Sobrienfi
2853568Sobrien
2953568Sobrien# checking for fixed string 
3053568Sobrienecho "abababccccccd" | ${GREP} -F -e 'c\{3\}' > /dev/null 2>&1
3153568Sobrienif test $? -ne 1 ; then
3253568Sobrien	echo "Options: Wrong status code, test \#3 failed"
3353568Sobrien	failures=1
3453568Sobrienfi
3553568Sobrien
3653568Sobrienexit $failures
37