Greetings!

"H. Peter Anvin" <[EMAIL PROTECTED]> writes:

> Scott McDermott wrote:
> > 
> > H. Peter Anvin on Wed  8/03 00:57 -0800:
> > > > This `head' stuff is really silly !  One step up from the now boring
> > > > `useless use of cat'.
> > >
> > > Someone seems to believe the "head" allows the command to return
> > > earlier.
> > 
> > That was me.  Is this an erroneous assumption? I presented it to speed
> > up the command on a large map.
> > 
> >         [mcdermot@diethylamide /tmp]$ time head ~/mail/mbox | wc -l
> >         0.01 user 0.00 system 0:00.01 elapsed 83% CPU
> >              10
> >         [mcdermot@diethylamide /tmp]$ time wc -l ~/mail/mbox
> >          271567 /home/mcdermot/mail/mbox
> >         0.17 user 0.20 system 0:03.38 elapsed 10% CPU
> > 
> >         (pretty formatted)
> > 
> 
> Seems to work, although I think I prefer ypmatch -m.
> 
>       -hpa

OK, that's good enough for me!  Please see revised patch below.  If
there are no more objections, then I will submit this version for
Debian potato.

--- autofs-3.1.4.orig/samples/rc.autofs.in
+++ autofs-3.1.4/samples/rc.autofs.in
@@ -98,7 +98,8 @@
 #
 # Check for YellowPage maps to be loaded
 #
-if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ]
+if [ -e /usr/bin/ypcat ] && [ -e /usr/bin/ypmatch ] && \
+    ypmatch -m auto.master >/dev/null 2>&1
 then
     ypcat -k auto.master | (
        while read dir map options
@@ -106,7 +107,10 @@
            if [ ! -z "$dir" -a ! -z "$map" \
                        -a x`echo "$map" | cut -c1` != 'x-' ]
            then
-               map=`echo "$map" | sed -e 's/^auto_/auto./'`
+               if echo $map | grep _ >/dev/null && \
+               ! ypmatch -m $map >/dev/null 2>&1 ; then
+                   map=`echo "$map" | sed -e 's/_/./g'`
+               fi
                if echo $options | grep -- '-t' >/dev/null 2>&1 ; then
                    mountoptions="--timeout $(echo $options | \
                      sed 's/^.*-t\(imeout\)*[ \t]*\([0-9][0-9]*\).*$/\2/g')"

Reply via email to