-
Notifications
You must be signed in to change notification settings - Fork 6
/
wyebrun.h
51 lines (40 loc) · 1.55 KB
/
wyebrun.h
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
/*
Copyright 2018 [email protected]
This file is part of wyebrun.
wyebrun is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wyebrun 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with wyebrun. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WYEBRUN_H
#define _WYEBRUN_H
#include <stdbool.h>
#include <glib/gstdio.h>
#define WYEBPREFIX "--wyebrun"
#define WYEBKEEPSEC 3
//client
//wyebrun spawns the exe automatically
char *wyebget( char *exe, char *data); //don't free the ret val
void wyebsend(char *exe, char *data);
void wyebkeep(char *exe, int sec); //keep alive. default is 3s
//loop the wyebkeep. to stop, use g_source_remove
guint wyebloop(char *exe, int sec);
//send stdin to svr and ret data to stdout
//blank and enter exits
void wyebclient(char *exe);
//server
typedef char *(*wyebdataf)(char *data);
//server is spawned with an arg the caller
bool wyebsvr(int argc, char **argv, wyebdataf func);
//or if there is own GMainLoop
void wyebwatch(char *exe, char *caller, wyebdataf func);
//the caller is sent as 'exe --wyebrun 9999' and
//used to send the res meaning we are ready.
//3 sec left or client will die
#endif //_WYEBRUN_H