blob: cc86e0662defc2255b2de89fac8caef57e1414da (
plain)
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
|
//
// FLUID main entry for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2021 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#ifndef _FLUID_SHELL_COMMAND_H
#define _FLUID_SHELL_COMMAND_H
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <direct.h>
# include <windows.h>
# include <io.h>
# include <fcntl.h>
# include <commdlg.h>
# include <FL/platform.H>
#else
# include <unistd.h>
#endif
void show_shell_window();
class Fl_Process {
public:
Fl_Process();
~Fl_Process();
FILE *popen(const char *cmd, const char *mode="r");
int close();
FILE * desc() const;
char * get_line(char * line, size_t s) const;
int get_fileno() const;
#if defined(_WIN32) && !defined(__CYGWIN__)
protected:
HANDLE pin[2], pout[2], perr[2];
char ptmode;
PROCESS_INFORMATION pi;
STARTUPINFO si;
static bool createPipe(HANDLE * h, BOOL bInheritHnd=TRUE);
private:
FILE * freeHandles();
static void clean_close(HANDLE& h);
#endif
protected:
FILE * _fpt;
};
#endif // _FLUID_SHELL_COMMAND_H
|