Thanks for response. I only was some code because i want learn C and surprised me the different between both codes.
But for example, i try find the "error string" when type "cp" without arguments, but i can not find it. 2017-01-12 23:55 GMT+01:00 Eric Blake <ebl...@redhat.com>: > On 01/12/2017 03:53 PM, francisco dominguez wrote: > > I have a little doubt as to the gnu code, why is it so complex and long? > > Other systems facing the same problem have a much simpler implementation, > > for example the ls command in gnu: > > > > http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/ls.c;h= > 556313c71ebeb853c3fe9cf3c0312639de8aded0;hb=HEAD > > > > And in other system, for example, freebsd, is more simple: > > > > https://github.com/freebsd/freebsd/blob/master/bin/ls/ls.c > > Most likely because GNU ls has more features than FreeBSD ls. There's > probably also some code cost for robustness issues (such as trying hard > for minimal-width columns that are always aligned, rather than being > lazy by over-spacing things or having an extra-wide column throw off > alignment of the remaining columns). > > There's other things factoring into your comparison: the files you point > to show less than 1000 lines for FreeBSD ls.c, compared to more than > 5000 lines for GNU ls.c, but you did not account for how many lines are > in other files that get linked together to form the final executable. > For example, a quick search of the BSD code shows a variable named > 'attrs_off' which is only referenced twice in the file, so to find how > the variable is actually used you have to go browsing around for another > .c file. So file size is a very poor measure of executable complexity. > > Your question is very broad. Is there any specific feature that you are > comparing side-by-side, and wondering what the difference is? > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > >