Faztek's unnofficial Blog

My first blog is dedicated to Internet hosting software.

domingo, junho 24, 2007

Freesco add-ons

Default Freesco package comes without GNU grep and find. Existing grep is just a hard-link to a general script, 'a:' (that's it, just an a and a colon).
% # in my case, 36 is the inode number for 'a:'
% gnu_find * -printf "%i %p\n" | grep ^"36 " | awk '{print $2}'
a: backup basename clr cp-rf crontab dir dirname edit free fromdos grep hostname installpkg listpkg ll lsmod minicom netinfo passwd play ps removepkg report sysedit sysinfo telnet todos uname uptime useradd userdel useredit userlist utils

[Linux] gnu_
find /bin/ -printf "%i %p\n" | grep grep$

[Linux] more /bin/grep
#!/bin/sh
#
# Don't touch next lines. This script provides:
#@@ dir edit telnet lsmod clr a: userlist ll
#@@ basename dirname hostname passwd sysinfo report
#@@ sysedit free grep ps minicom useradd useredit
#@@ userdel netinfo uptime backup uname fromdos todos
#@@ cp-rf crontab play listpkg installpkg removepkg
E=echo

for i in system.cfg live.cfg chat.pwd;do
[ -f /etc/$i ] && . /etc/$i
done
...
p=`basename $0`
case $p in
...
grep) E="$1"
case $1 in
-h) $E Usage: grep [-v] STRING [files ...];;
-v) E="$2"; shift 2; sed -n /$E/!P "$@";;
*) shift; sed -n /$E/P "$@";;
esac;;
...
You can see the basic grep part in blue. If you have installed bash (I hate the default ile command-line) you can play around:
[Linux] alias g=/pkg/bin/grep
[Linux] g a --version
grep (GNU grep) 2.3

Copyright (C) 1988, 1992-1998, 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Linux] echo $?
0
If the result of 'g' is zero, you have GNU grep available.
[Linux] PKG=""
[Linux] $PKG/bin/grep a --version
sed: can't open --version
[Linux] [ $? != 0 ] && echo "You are using sed-grep"
You are using sed-grep
In the example above, you can see and proove the default usage of grep in Freesco.

This is not a page of extensive commands. If you want to learn more, go at www.freesco.org/home/inc/commands.htm

2 Comments:

At 24 junho, 2007 19:07, Blogger Henrique said...

[Linux] pwd
/mnt/bootdev/router
[Linux] f etc/ drv/ kbd/ -type f -name '*.*' -exec grep -Hns var.mes {} \;
etc/syslog.cfg:10:*.* /var/messages


Note by default the messages are at /var, and /var is by default limited by RAM.

+++clip+++
/dev/ram0 2901 2092 809 72% /
+++clip+++

 
At 05 janeiro, 2008 01:24, Blogger Henrique said...

Here's how it compiles on Freesco:

tar xfz netpack-gpack-v0.8.tar.gz
cd netpack/gpack/gPackCount-v0.8/gPackCount/src/


zip:~/test/netpack/gpack/gPackCount-v0.8/gPackCount/src$ make
Need to rebuild libgpcap
cd ../../../gsrc/gpcap && make
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gpcap'
checking pcap...
./make_pcap.sh pcap_development.txt.tmp
Executing: ./configure --disable-protochain
creating cache ./config.cache
checking host system type... i686-pc-linux-gnulibc1
checking target system type... i686-pc-linux-gnulibc1
checking build system type... i686-pc-linux-gnulibc1
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking gcc version... 2
checking for inline... inline
checking for __attribute__... yes
checking for u_int8_t using gcc... yes
checking for u_int16_t using gcc... yes
checking for u_int32_t using gcc... yes
checking how to run the C preprocessor... gcc -E
make[1]: *** [pcap_development.txt] Error 1
make: *** [../../../gsrc/gpcap/libgpcap.so] Interrupt

zip:~/test/netpack/gpack/gPackCount-v0.8/gPackCount/src$ make CC_BASIC=-DFREESCO
Need to rebuild libgpcap
cd ../../../gsrc/gpcap && make
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gpcap'
checking pcap...
./make_pcap.sh pcap_development.txt.tmp
Executing: ./configure --disable-protochain
loading cache ./config.cache
checking host system type... i686-pc-linux-gnulibc1
checking target system type... i686-pc-linux-gnulibc1
checking build system type... i686-pc-linux-gnulibc1
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking gcc version... 2
checking for inline... inline
checking for __attribute__... yes
checking for u_int8_t using gcc... yes
checking for u_int16_t using gcc... yes
checking for u_int32_t using gcc... yes
checking how to run the C preprocessor... gcc -E
checking for sys/ioccom.h... no
checking for sys/sockio.h... no
checking for ifaddrs.h... no
checking for limits.h... yes
checking for netinet/if_ether.h... no
checking for ANSI ioctl definitions... yes
checking for ether_hostton... no
checking for strerror... yes
checking for strlcpy... no
checking if --disable-protochain option is specified... disabled
checking packet capture type... linux
checking if --enable-ipv6 option is specified... no
checking whether to build optimizer debugging code... no
checking whether to build parser debugging code... no
checking Linux kernel version... 2
checking if if_packet.h has tpacket_stats defined... no
checking whether we have /proc/net/dev... yes
checking for flex... flex
checking for flex 2.4 or higher... yes
checking for bison... bison
checking for ranlib... ranlib
checking if sockaddr struct has sa_len member... no
checking if dl_hp_ppa_info_t struct has dl_module_id_1 member... no
checking if unaligned accesses fail... no
checking for a BSD compatible install... /usr/bin/ginstall -c
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h
Making pcap: pcap_development.txt.tmp
cat pcap_development.txt.tmp > pcap_development.txt
rm -f pcap_development.txt.tmp
pcap check: OK: pcap_development.txt
pcap present: OK
Compiling gpthread.cpp : obj is gpthread.o
Compiling gpproto.cpp : obj is gpproto.o
Compiling gpstat.cpp : obj is gpstat.o
Compiling gpifcap.cpp : obj is gpifcap.o
Compiling gpastbl.cpp : obj is gpastbl.o
Compiling gpbuffer.cpp : obj is gpbuffer.o
Compiling gpcrypt.cpp : obj is gpcrypt.o
Compiling gpblowfish.cpp : obj is gpblowfish.o
gpblowfish.cpp:293: warning: aggregate has a partly bracketed initializer
gpblowfish.cpp:293: warning: aggregate has a partly bracketed initializer
gpblowfish.cpp:293: warning: aggregate has a partly bracketed initializer
gpblowfish.cpp:293: warning: aggregate has a partly bracketed initializer
Compiling gpblowfb.cpp : obj is gpblowfb.o
gcc -pipe -shared -fPIC -o libgpcap.so \
gpthread.o gpproto.o gpstat.o gpifcap.o gpastbl.o gpbuffer.o gpcrypt.o gpblowfish.o gpblowfb.o \
bpf_dump.o bpf_filter.o bpf_image.o etherent.o gencode.o grammar.o inet.o nametoaddr.o optimize.o pcap-linux.o pcap.o savefile.o scanner.o version.o
Done lib: libgpcap.so
make[1]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gpcap'
Compiling gPackConf.cpp : obj is gPackConf.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackConf.o -c gPackConf.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackStatIO.cpp : obj is gPackStatIO.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackStatIO.o -c gPackStatIO.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackStatInner.cpp : obj is gPackStatInner.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackStatInner.o -c gPackStatInner.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackStatScrap.cpp : obj is gPackStatScrap.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackStatScrap.o -c gPackStatScrap.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackIpHash.cpp : obj is gPackIpHash.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackIpHash.o -c gPackIpHash.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackIpTuple.cpp : obj is gPackIpTuple.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackIpTuple.o -c gPackIpTuple.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackIpCache.cpp : obj is gPackIpCache.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackIpCache.o -c gPackIpCache.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackIpDnsCache.cpp : obj is gPackIpDnsCache.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackIpDnsCache.o -c gPackIpDnsCache.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackPorts.cpp : obj is gPackPorts.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackPorts.o -c gPackPorts.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackGpStub.cpp : obj is gPackGpStub.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackGpStub.o -c gPackGpStub.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackOwnAddr.cpp : obj is gPackOwnAddr.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackOwnAddr.o -c gPackOwnAddr.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Compiling gPackCount.cpp : obj is gPackCount.o
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: -O2 -Wall -o ./gPackCount.o -c gPackCount.cpp
g++: -rpath: linker input file unused since linking not done
g++: ../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio:: linker input file unused since linking not done
Need to rebuild libgobj
cd ../../../gsrc/gobj && make
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Compiling gstorage.cpp : obj is gstorage.o
g++ -g -DFREESCO -O2 -Wall -o ./gstorage.o -c gstorage.cpp
Compiling gcontrol.cpp : obj is gcontrol.o
g++ -g -DFREESCO -O2 -Wall -o ./gcontrol.o -c gcontrol.cpp
Compiling gfile.cpp : obj is gfile.o
g++ -g -DFREESCO -O2 -Wall -o ./gfile.o -c gfile.cpp
Compiling gfilestat.cpp : obj is gfilestat.o
g++ -g -DFREESCO -O2 -Wall -o ./gfilestat.o -c gfilestat.cpp
Compiling glist.cpp : obj is glist.o
g++ -g -DFREESCO -O2 -Wall -o ./glist.o -c glist.cpp
Compiling glistext.cpp : obj is glistext.o
g++ -g -DFREESCO -O2 -Wall -o ./glistext.o -c glistext.cpp
Compiling garray.cpp : obj is garray.o
g++ -g -DFREESCO -O2 -Wall -o ./garray.o -c garray.cpp
Compiling gstack.cpp : obj is gstack.o
g++ -g -DFREESCO -O2 -Wall -o ./gstack.o -c gstack.cpp
Compiling ghash.cpp : obj is ghash.o
g++ -g -DFREESCO -O2 -Wall -o ./ghash.o -c ghash.cpp
Compiling garg.cpp : obj is garg.o
g++ -g -DFREESCO -O2 -Wall -o ./garg.o -c garg.cpp
garg.cpp: In method `unsigned int gArg::thisFindParamFromStr(char *, unsigned int, class gParamElem *, bool &, unsigned int &)':
garg.cpp:758: warning: `unsigned int i' might be used uninitialized in this function
Compiling gstring.cpp : obj is gstring.o
g++ -g -DFREESCO -O2 -Wall -o ./gstring.o -c gstring.cpp
Compiling gstringext.cpp : obj is gstringext.o
g++ -g -DFREESCO -O2 -Wall -o ./gstringext.o -c gstringext.cpp
Compiling gdir.cpp : obj is gdir.o
g++ -g -DFREESCO -O2 -Wall -o ./gdir.o -c gdir.cpp
Compiling gconfig.cpp : obj is gconfig.o
g++ -g -DFREESCO -O2 -Wall -o ./gconfig.o -c gconfig.cpp
Compiling gnet.cpp : obj is gnet.o
g++ -g -DFREESCO -O2 -Wall -o ./gnet.o -c gnet.cpp
Compiling gtime.cpp : obj is gtime.o
g++ -g -DFREESCO -O2 -Wall -o ./gtime.o -c gtime.cpp
Compiling gcalendar.cpp : obj is gcalendar.o
g++ -g -DFREESCO -O2 -Wall -o ./gcalendar.o -c gcalendar.cpp
Compiling gweb.cpp : obj is gweb.o
g++ -g -DFREESCO -O2 -Wall -o ./gweb.o -c gweb.cpp
Compiling ghttp.cpp : obj is ghttp.o
g++ -g -DFREESCO -O2 -Wall -o ./ghttp.o -c ghttp.cpp
Compiling gmath.cpp : obj is gmath.o
g++ -g -DFREESCO -O2 -Wall -o ./gmath.o -c gmath.cpp
gcc -pipe -shared -fPIC -o libgobj.so gstorage.o gcontrol.o gfile.o gfilestat.o glist.o glistext.o garray.o gstack.o ghash.o garg.o gstring.o gstringext.o gdir.o gconfig.o gnet.o gtime.o gcalendar.o gweb.o ghttp.o gmath.o
Done lib: libgobj.so
make[1]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Need to rebuild libgobjeio
cd ../../../gsrc/gobjeio && make
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gobjeio'
Compiling giostorage.cpp : obj is giostorage.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giostorage.o -c giostorage.cpp
Compiling gioctrl.cpp : obj is gioctrl.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./gioctrl.o -c gioctrl.cpp
gioctrl.cpp:26: warning: #warning No GOEIO_LINUX_MEM defined: direct memory management
Compiling giotag.cpp : obj is giotag.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giotag.o -c giotag.cpp
Compiling giopaths.cpp : obj is giopaths.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giopaths.o -c giopaths.cpp
Compiling giolarge.cpp : obj is giolarge.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giolarge.o -c giolarge.cpp
Compiling giodeconv.cpp : obj is giodeconv.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giodeconv.o -c giodeconv.cpp
Compiling giofile.cpp : obj is giofile.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giofile.o -c giofile.cpp
Compiling giofileidx.cpp : obj is giofileidx.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./giofileidx.o -c giofileidx.cpp
Compiling gxstring.cpp : obj is gxstring.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./gxstring.o -c gxstring.cpp
Compiling gxsupuni.cpp : obj is gxsupuni.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./gxsupuni.o -c gxsupuni.cpp
Compiling gxnet.cpp : obj is gxnet.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./gxnet.o -c gxnet.cpp
Compiling gxnetpair.cpp : obj is gxnetpair.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./gxnetpair.o -c gxnetpair.cpp
Compiling gxnetserve.cpp : obj is gxnetserve.o
g++ -g -DFREESCO -I../gobj -O2 -Wall -o ./gxnetserve.o -c gxnetserve.cpp
gcc -pipe -shared -fPIC -o libgobjeio.so giostorage.o gioctrl.o giotag.o giopaths.o giolarge.o giodeconv.o giofile.o giofileidx.o gxstring.o gxsupuni.o gxnet.o gxnetpair.o gxnetserve.o
cd ../gobj && make
make[2]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Done lib: libgobj.so
make[2]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Done lib: libgobjeio.so
make[1]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gobjeio'
Main prog
g++ -g -DFREESCO -I../../../gsrc/gobj -I../../../gsrc/gpcap -I../../../gsrc/gobjeio -I../../../gsrc/pcap -pipe -rdynamic -Wl,-rpath,../../../gsrc/gobj:../../../gsrc/gpcap:../../../gsrc/gobjeio: gPackConf.o gPackStatIO.o gPackStatInner.o gPackStatScrap.o gPackIpHash.o gPackIpTuple.o gPackIpCache.o gPackIpDnsCache.o gPackPorts.o gPackGpStub.o gPackOwnAddr.o gPackCount.o -O2 -Wall -L../../../gsrc/gobj -L../../../gsrc/gpcap -L../../../gsrc/gobjeio -lgobj -lgpcap -lgobjeio -o gpackcount
cd ../../../gsrc/gobj && make CC_BASIC="-DFREESCO"
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Done lib: libgobj.so
make[1]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gobj'
cd ../../../gsrc/gpcap && make CC_BASIC="-DFREESCO"
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gpcap'
pcap present: OK
Done lib: libgpcap.so
make[1]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gpcap'
cd ../../../gsrc/gobjeio && make
make[1]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gobjeio'
cd ../gobj && make
make[2]: Entering directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Done lib: libgobj.so
make[2]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gobj'
Done lib: libgobjeio.so
make[1]: Leaving directory `/home/guest/test/netpack/gpack/gsrc/gobjeio'
Done: gpackcount

 

Enviar um comentário

<< Home