#4 Broader Support via GNU Tools

open
nobody
None
5
2001-03-27
2001-03-27
Anonymous
No

I'm using Solaris 8 (INTEL) and xdiskusage does not
work as it should. I feel a great deal of portability
could be gained by having the following section of code
from xdiskusage.C generated from
the AutoConf system.

#define DF_COMMAND "df"
#define DU_COMMAND "du -x"

You should have AutoConf first look for GNU versions of
the
tools (which are variously installed as g{df,du},
g{df,du},
or a straight {df,du} then use --version option with a
grep
for GNU to determine if its the GNU fileutils version.
Then
failing that fall back to uname based hardcoding

Additionally I gathered from the code that you are
using the
-k options when available but this is not stated in
comments
where the #defines exists.

Once I switched to the GNU versions everything
including printing seems to work fine - well done

Regards,
Peter

PS: gcc -v --help produces the following :

/pkgs/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.8/2.95.3/cpp0
-lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix
-D__svr4__ -D__SVR4 -Dsun -D__unix__ -D__svr4__
-D__SVR4 -D__sun__ -D__unix -D__sun -Asystem(svr4)
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
--help help-dummy /var/tmp/ccMvpI4Z.i

Note there is no SVR4

Discussion

  • Bill Spitzak
    Bill Spitzak
    2004-09-29

    Logged In: YES
    user_id=546

    Added code so that you can compile with
    -DDF_COMMAND=foo and -DDU_COMMAND=bar to override
    the versions in the code.