Add updated simevent by emg - smdev - suckless mdev
 (HTM) git clone git://git.suckless.org/smdev
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f8534bbc2f38111b8756c91c6f41ccd557dec2a1
 (DIR) parent fb09fb0c621fa0a38147c93345316b3213e46f80
 (HTM) Author: sin <sin@2f30.org>
       Date:   Fri, 27 Feb 2015 22:45:37 +0000
       
       Add updated simevent by emg
       
       Diffstat:
         M bin/simevent                        |      16 ++++++----------
       
       1 file changed, 6 insertions(+), 10 deletions(-)
       ---
 (DIR) diff --git a/bin/simevent b/bin/simevent
       @@ -3,16 +3,12 @@
        # Simulate add/remove events by writing directly
        # into the uevent files.
        
       -if [ -z $1 ]; then
       -        echo "usage: $(basename $0) add|remove" 2>&1
       +if [ "$#" -ne 1 ] || [ "$1" != add ] && [ "$1" != remove ]; then
       +        # warning: can't trust $0, better off just hard coding the name
       +        # echo "usage: simevent add|remove" 1>&2
       +        printf "usage: %s add|remove\n" "${0##*/}" 1>&2
                exit 1
        fi
        
       -ev=$1
       -for i in $(find /sys/devices -type f); do
       -        f=$(basename $i)
       -        if [ "$f" = "dev" ]; then
       -                d=$(dirname $i)
       -                echo $ev > $d/uevent
       -        fi
       -done
       +find /sys/devices -type f -path '*/dev' -exec \
       +        sh -c 'for f do printf %s\\n "$0" > "${f%/*}"/uevent; done' "$1" {} +