/usr/include/ColPack/command_line_parameter_processor.h is in libcolpack-dev 1.0.9-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /************************************************************************************
Copyright (C) 2005-2008 Assefaw H. Gebremedhin, Arijit Tarafdar, Duc Nguyen,
Alex Pothen
This file is part of ColPack.
ColPack is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ColPack is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with ColPack. If not, see <http://www.gnu.org/licenses/>.
************************************************************************************/
#include<iostream>
#include<string>
#include<vector>
using namespace std;
/*Convert command line parameters to vector arg for easiness
Input: argc, argv
Output: arg
Precondition: arg is empty
*/
void createArgs(int argc, const char* argv[], vector<string>& arg);
//find argument in vector arg
int findArg(string argument, vector<string>& arg);
//SAMPLE main.cpp
/*
#include "command_line_parameter_processor.h"
using namespace std;
int commandLineProcessing(vector<string>& arg);
int main(int argc, const char* argv[] ) {
vector<string> arg;
//get the list of arguments
createArgs(argc, argv, arg);
//process those arguments
commandLineProcessing(arg);
//...
return 0;
}
int commandLineProcessing(vector<string>& arg) {
int num=findArg("-r", arg);
if (num!=-1) //argument is found, do something
{
//...
}
if (findArg("-append", arg) != -1 || findArg("-app", arg) != -1) //append output to the existing file
{
output_append = true;
}
//"-suffix" has priority over "-suf", i.e., if both "-suffix" and "-suf" are specified, "-suffix <output_suffix>" will be used
int result;
result = findArg("-suffix", arg);
if (result == -1) result = findArg("-suf", arg);
if (result != -1) //suffix is specified
{
output_suffix = arg[result+1];
}
return 0;
}
//*/
|