Wrapper

#include <syslog.h>
#include <stdio.h>
#include <iostream>
#include <sstream>
 
using namespace std;
 
main( int argc, char ** argv, char ** envp )
{
        stringstream cmdss;
        cmdss << "/usr/bin/logger.back ";
 
        int i;
        for (i=1; i<argc; ++i) {
          cmdss << "'"  << argv[i] << "' ";
        }
 
        const string &cmdstr = cmdss.str();
        const char* cstr = cmdstr.c_str();
 
        openlog ("bariwrap", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_DAEMON);
        syslog (LOG_INFO, "cmd %s", cstr);
        closelog ();
 
        FILE *fp = NULL;
        fp = popen(cstr, "w");
        if (!fp) {
                cerr << "Cannot execute" << endl;
        }
 
        for (string line; getline(cin,line);) {
                syslog (LOG_INFO, "line %s", line.c_str());
                fwrite(line.c_str(), 1, line.length(), fp);
        }
 
        pclose(fp);
 
}