This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 'cygcheck -f' pattern syntax.


On 9/22/2011 2:10 PM, Oleksandr Gavenko wrote:
$ time cygcheck -f 'stdio.h'
real 0m1.016s
user 0m0.031s
sys 0m0.015s
$ time cygcheck -f '*stdio.h'
$ time cygcheck -f '*stdio.h'
$ time cygcheck -f '*stdio.h'
$ time cygcheck -f /usr/include/stdio.h
cygwin-1.7.9-1

real 0m0.907s
user 0m0.015s
sys 0m0.031s

So 'cygcheck -f' does not allow 'glob' and 'regex'.

I write simple script that allow use regex:

#!/bin/sh

regex=$(echo "$1" | sed -e 's|\\|&&|g' -e 's|=|\\=|g')

for file in /etc/setup/*.lst.gz; do
name=${file#/etc/setup/}
name=${name%.lst.gz}
gzip -d -c $file | sed -n "\=$regex={s=^=$name: /=;p;}"
done

But this script is extremely slow:

$ time ./cygsearch.sh 'bin/emacs'
emacs: /usr/bin/emacs-nox.exe
emacs: /usr/bin/emacs.ico
emacs: /usr/bin/emacsclient.exe
emacs-X11: /usr/bin/emacs-X11.exe

real 0m38.797s
user 0m44.620s
sys 0m25.574s


much faster


$ time cp /etc/setup/*.gz .

real    0m1.450s
user    0m0.061s
sys     0m1.202s

$ time gunzip *.gz

real    0m1.937s
user    0m0.170s
sys     0m1.764s

$ time grep -H "stdio.h" *.lst
cygwin.lst:usr/include/stdio.h
cygwin.lst:usr/include/sys/stdio.h
gcc4-core.lst:usr/lib/gcc/i686-pc-cygwin/4.5.3/include/ssp/stdio.h
gcc4-g++.lst:usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/tr1/stdio.h
libboost-devel.lst:usr/include/boost/iostreams/filter/stdio.hpp
libglib2.0-devel.lst:usr/include/glib-2.0/glib/gstdio.h
libhdf5-devel.lst:usr/include/H5FDstdio.h
libicu-devel.lst:usr/include/unicode/ustdio.h
mingw-gcc-core.lst:usr/lib/gcc/i686-pc-mingw32/4.5.2/include/ssp/stdio.h
mingw-runtime.lst:usr/i686-pc-mingw32/sys-root/mingw/include/stdio.h
mingw64-i686-gcc-core.lst:usr/lib/gcc/i686-w64-mingw32/4.5.3/include/ssp/stdio.h
mingw64-i686-gcc-g++.lst:usr/lib/gcc/i686-w64-mingw32/4.5.3/include/c++/tr1/stdio.h
mingw64-i686-headers.lst:usr/i686-w64-mingw32/sys-root/mingw/include/stdio.h
perl.lst:usr/lib/perl5/5.10/i686-cygwin/CORE/nostdio.h
splint.lst:usr/share/splint/lib/stdio.h

real    0m0.816s
user    0m0.046s
sys     0m0.781s


Regards Marco



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]