Chameleon Applications

Chameleon Applications Svn Source Tree

Root/trunk/ChameleonPrefPane/Sources/ShellProcess.h

1/*
2 * shell_process.h
3 *
4 * Created by Rekursor on 1/17/2010.
5 *
6 */
7#ifndef __CHSHELL_PROCESS_H
8#define __CHSHELL_PROCESS_H
9
10#include <Security/Authorization.h>
11#include <stdio.h>
12#include <stdlib.h>
13#include <errno.h>
14#include <sys/stat.h>
15#include <vector>
16#include <string>
17#include "file_util.h"
18//----------------------------------------------------------------
19const int MAX_HD = 32;
20
21//----------------------------------------------------------------
22class ShellProcess
23{
24public:
25// construction / destruction
26ShellProcess() {_fpt= NULL;}
27~ShellProcess() {if (_fpt) close();}
28
29FILE * open(const char *cmd, const char *mode="r");
30int close();
31FILE * desc() const { return _fpt;} // non null if file is open
32char * get_line(char * line, size_t s) const {return _fpt ? fgets(line, s, _fpt) : NULL;}
33
34protected:
35FILE * _fpt;
36};
37
38#endif
39

Archive Download this file

Revision: 341