w/o cout from iostream.h RH really can use the latest and greatest gcc for this utility.

svn path=/trunk/kdebase/src/kreadconfig/; revision=79637
wilder
Harri Porten 26 years ago committed by Aleix Pol
parent 39b567ee8c
commit e31185a77e
  1. 17
      src/kreadconfig/kreadconfig.cpp

@ -1,22 +1,22 @@
/* Read KGlobal::config() entries - for use in shell scripts.
* (c) 2001 Red Hat, Inc.
* Programmed by Bernhard Rosenkraenzer <bero@redhat.com>
*
*
* If --type is specified as bool, the return value is 0 if the value
* is set, 1 if it isn't set. There is no output.
*
*
* If --type is specified as num, the return value matches the value
* of the key. There is no output.
*
*
* If --type is not set, the value of the key is simply printed to stdout.
*
*
* Usage examples:
* if kreadconfig --group KDE --key macStyle --type bool; then
* echo "We're using Mac-Style menus."
* else
* echo "We're using normal menus."
* fi
*
*
* TRASH=`kreadconfig --group Paths --key Trash`
* if test -n "$TRASH"; then
* mv someFile "$TRASH"
@ -30,7 +30,8 @@
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kaboutdata.h>
#include <iostream>
#include <stdio.h>
static KCmdLineOptions options[] =
{
{ "group <group>", I18N_NOOP("Group to look in"), "KDE" },
@ -55,7 +56,7 @@ int main(int argc, char **argv)
QString key=QString::fromLatin1(args->getOption("key"));
QCString dflt=args->getOption("default");
QCString type=args->getOption("type").lower();
KApplication app( false, false ); // no styles, no gui
KConfig *konfig=KGlobal::config();
@ -68,7 +69,7 @@ int main(int argc, char **argv)
return konfig->readLongNumEntry(key, dflt.toLong());
} else {
/* Assume it's a string... */
cout << konfig->readEntry(key, dflt).latin1() << endl;
fprintf(stdout, "%s\n", konfig->readEntry(key, dflt).latin1());
return 0;
}
}

Loading…
Cancel
Save