summaryrefslogtreecommitdiffstats
path: root/tdeio/tests/kionetrctest.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:04:16 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:04:16 -0600
commit5159cd2beb2e87806a5b54e9991b7895285c9d3e (patch)
tree9b70e8be47a390f8f4d56ead812ab0c9dad88709 /tdeio/tests/kionetrctest.cpp
parentc17cb900dcf52b8bd6dc300d4f103392900ec2b4 (diff)
downloadtdelibs-5159cd2beb2e87806a5b54e9991b7895285c9d3e.tar.gz
tdelibs-5159cd2beb2e87806a5b54e9991b7895285c9d3e.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdeio/tests/kionetrctest.cpp')
-rw-r--r--tdeio/tests/kionetrctest.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/tdeio/tests/kionetrctest.cpp b/tdeio/tests/kionetrctest.cpp
new file mode 100644
index 000000000..2d96c8495
--- /dev/null
+++ b/tdeio/tests/kionetrctest.cpp
@@ -0,0 +1,71 @@
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+
+#include "authinfo.h"
+
+void output( const KURL& u )
+{
+ kdDebug() << "Looking up auto login for: " << u.url() << endl;
+ TDEIO::NetRC::AutoLogin l;
+ bool result = TDEIO::NetRC::self()->lookup( u, l, true );
+ if ( !result )
+ {
+ kdDebug() << "Either no .netrc and/or .kionetrc file was "
+ "found or there was problem when attempting to "
+ "read from them! Please make sure either or both "
+ "of the above files exist and have the correct "
+ "permission, i.e. a regular file owned by you with "
+ "with a read/write permission (0600)" << endl;
+ return;
+ }
+
+ kdDebug() << "Type: " << l.type << endl
+ << "Machine: " << l.machine << endl
+ << "Login: " << l.login << endl
+ << "Password: " << l.password << endl;
+
+ TQMap<TQString,TQStringList>::ConstIterator it = l.macdef.begin();
+ for ( ; it != l.macdef.end(); ++it )
+ {
+ kdDebug() << "Macro: " << it.key() << "= "
+ << it.data().join(" ") << endl;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ const char *version = "0.5";
+ const char *description = "Unit test for .netrc and kionetrc parser.";
+ KCmdLineOptions options[] =
+ {
+ { "+command", "[url1,url2 ,...]", 0 },
+ KCmdLineLastOption
+ };
+
+ TDECmdLineArgs::init( argc, argv, "kionetrctest", description, version );
+ TDECmdLineArgs::addCmdLineOptions( options );
+ TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
+ int count = args->count();
+ TDEApplication app;
+
+ if ( !count )
+ args->usage();
+ else
+ {
+ KURL u;
+ for( int i=0 ; i < count; i++ )
+ {
+ u = args->arg(i);
+ if ( !u.isValid() )
+ {
+ kdDebug() << u.url() << " is invalid! Ignoring..." << endl;
+ continue;
+ }
+ output( u );
+ }
+ }
+ args->clear();
+ return 0;
+}