From 7df32c5fa32db40d0aacf7018346137b786224a8 Mon Sep 17 00:00:00 2001 From: dockes Date: Thu, 8 Nov 2007 07:54:45 +0000 Subject: [PATCH] add -b option to only output url list --- src/query/recollq.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/query/recollq.cpp b/src/query/recollq.cpp index 0f5cff11..3cbe941b 100644 --- a/src/query/recollq.cpp +++ b/src/query/recollq.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: recollq.cpp,v 1.8 2007-10-25 07:27:30 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: recollq.cpp,v 1.9 2007-11-08 07:54:45 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -55,6 +55,7 @@ static char usage [] = " -c : specify config directory, overriding $RECOLL_CONFDIR\n" " -d also dump file contents\n" " -n limit the maximum number of results (0->no limit, default 2000)\n" +" -b : basic. Just output urls, no mime types or titles\n" ; static void Usage(void) @@ -70,6 +71,7 @@ static int op_flags; #define OPT_c 0x8 #define OPT_d 0x10 #define OPT_n 0x20 +#define OPT_b 0x40 static RclConfig *rclconfig; RclConfig *RclConfig::getMainConfig() @@ -92,6 +94,7 @@ int main(int argc, char **argv) while (**argv) switch (*(*argv)++) { case 'a': op_flags |= OPT_a; break; + case 'b': op_flags |= OPT_b; break; case 'c': op_flags |= OPT_c; if (argc < 2) Usage(); a_config = *(++argv); argc--; goto b1; @@ -166,15 +169,18 @@ int main(int argc, char **argv) if (!rcldb.getDoc(i, doc, &pc)) break; - char cpc[20]; - sprintf(cpc, "%d", pc); - cout - << doc.mimetype.c_str() << "\t" - << "[" << doc.url.c_str() << "]" << "\t" - << "[" << doc.meta["title"].c_str() << "]" << "\t" - << doc.fbytes.c_str() << "\tbytes" << "\t" - << endl; - + if (op_flags & OPT_b) { + cout << doc.url.c_str() << endl; + } else { + char cpc[20]; + sprintf(cpc, "%d", pc); + cout + << doc.mimetype.c_str() << "\t" + << "[" << doc.url.c_str() << "]" << "\t" + << "[" << doc.meta["title"].c_str() << "]" << "\t" + << doc.fbytes.c_str() << "\tbytes" << "\t" + << endl; + } if (op_flags & OPT_d) { string fn = doc.url.substr(7); struct stat st;