diff options
| author | Thomas Schmucker <ts@its1.de> | 2022-02-04 15:55:25 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2022-02-04 15:55:25 +0100 |
| commit | 54082bd65ec6abe1515c2a96d6879ed11dcc57f9 (patch) | |
| tree | a523c23501d82daac4fdffdf9601a15ee0f0e935 /src | |
| parent | c206224a92def1a7c11770a1cecb851afcebd095 (diff) | |
| download | scissor-54082bd65ec6abe1515c2a96d6879ed11dcc57f9.tar.gz scissor-54082bd65ec6abe1515c2a96d6879ed11dcc57f9.tar.bz2 scissor-54082bd65ec6abe1515c2a96d6879ed11dcc57f9.zip | |
type
Diffstat (limited to 'src')
| -rw-r--r-- | src/srcut.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/srcut.cpp b/src/srcut.cpp index 44131a0..119bfc3 100644 --- a/src/srcut.cpp +++ b/src/srcut.cpp | |||
| @@ -8,8 +8,10 @@ | |||
| 8 | 8 | ||
| 9 | using namespace std; | 9 | using namespace std; |
| 10 | 10 | ||
| 11 | typedef map<string, vector<string>> container_type; | ||
| 12 | |||
| 11 | istream& | 13 | istream& |
| 12 | operator>>(istream& in, map<string, vector<string>>& container) | 14 | operator>>(istream& in, container_type& container) |
| 13 | { | 15 | { |
| 14 | static constexpr auto begin_marker = "--8<--"; | 16 | static constexpr auto begin_marker = "--8<--"; |
| 15 | static constexpr auto end_marker = "-->8--"; | 17 | static constexpr auto end_marker = "-->8--"; |
| @@ -84,7 +86,7 @@ operator>>(istream& in, map<string, vector<string>>& container) | |||
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | ostream& | 88 | ostream& |
| 87 | print(ostream& os, const string& key, const map<string, vector<string>>& container) | 89 | print(ostream& os, const string& key, const container_type& container) |
| 88 | { | 90 | { |
| 89 | const auto it = container.find(key); | 91 | const auto it = container.find(key); |
| 90 | if ( it != container.end() ) { | 92 | if ( it != container.end() ) { |
| @@ -107,6 +109,7 @@ main(int argc, char* argv[]) | |||
| 107 | int show_tags = 0; | 109 | int show_tags = 0; |
| 108 | int ch; | 110 | int ch; |
| 109 | 111 | ||
| 112 | opterr = 0; | ||
| 110 | while ( (ch = getopt(argc, argv, "t")) != -1 ) { | 113 | while ( (ch = getopt(argc, argv, "t")) != -1 ) { |
| 111 | switch ( ch ) { | 114 | switch ( ch ) { |
| 112 | case 't': | 115 | case 't': |
| @@ -120,7 +123,7 @@ main(int argc, char* argv[]) | |||
| 120 | argc -= optind; | 123 | argc -= optind; |
| 121 | argv += optind; | 124 | argv += optind; |
| 122 | 125 | ||
| 123 | map<string, vector<string>> container; | 126 | container_type container; |
| 124 | 127 | ||
| 125 | cin >> container; | 128 | cin >> container; |
| 126 | 129 | ||
