Jpp  16.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JLs.cc File Reference

Example program to use JSYSTEM::ls. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JSystem/JShell.hh"
#include "JSystem/JSystemToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to use JSYSTEM::ls.

Author
mdejong

Definition in file JLs.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file JLs.cc.

18 {
19  using namespace std;
20  using namespace JPP;
21 
22  int debug;
23 
24  try {
25 
26  JParser<> zap("Example program to mimic shell ls command");
27 
28  zap['d'] = make_field(debug) = 0;
29 
30  zap(argc, argv);
31  }
32  catch(const exception &error) {
33  FATAL(error.what() << endl);
34  }
35 
36  string option;
37 
38  for (int i = 1; i != argc; ++i) {
39  option += " ";
40  option += argv[i];
41  }
42 
43  ls buffer(option.c_str());
44 
45  for (ls::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
46  cout << *i << endl;
47  }
48 }
Utility class to parse command line options.
Definition: JParser.hh:1500
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67