summaryrefslogtreecommitdiff
path: root/src/srcut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/srcut.cpp')
-rw-r--r--src/srcut.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/srcut.cpp b/src/srcut.cpp
index 8c59440..44131a0 100644
--- a/src/srcut.cpp
+++ b/src/srcut.cpp
@@ -3,6 +3,7 @@
3#include <map> 3#include <map>
4#include <sstream> 4#include <sstream>
5#include <string> 5#include <string>
6#include <unistd.h>
6#include <vector> 7#include <vector>
7 8
8using namespace std; 9using namespace std;
@@ -103,11 +104,34 @@ print(ostream& os, const string& key, const map<string, vector<string>>& contain
103int 104int
104main(int argc, char* argv[]) 105main(int argc, char* argv[])
105{ 106{
107 int show_tags = 0;
108 int ch;
109
110 while ( (ch = getopt(argc, argv, "t")) != -1 ) {
111 switch ( ch ) {
112 case 't':
113 show_tags = 1;
114 break;
115 default:
116 cerr << "unbekannte option" << endl;
117 return EXIT_FAILURE;
118 }
119 }
120 argc -= optind;
121 argv += optind;
122
106 map<string, vector<string>> container; 123 map<string, vector<string>> container;
107 124
108 cin >> container; 125 cin >> container;
109 126
110 for ( int i = 1; i < argc; ++i ) { 127 if ( show_tags ) {
111 print(cout, argv[i], container); 128 for ( const auto& it: container ) {
129 cout << it.first << endl;
130 }
131 }
132 else {
133 for ( int i = 0; i < argc; ++i ) {
134 print(cout, argv[i], container);
135 }
112 } 136 }
113} 137}