wyebadblock/wyebrun.h

52 lines
1.6 KiB
C
Raw Normal View History

2018-05-19 15:51:50 +00:00
/*
2021-10-05 23:31:00 +00:00
Copyright 2018 jun7@hush.com
2018-05-19 15:51:50 +00:00
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
2018-05-22 06:01:28 +00:00
#include <stdbool.h>
#include <glib/gstdio.h>
2018-05-20 15:29:10 +00:00
2018-06-08 13:37:36 +00:00
#define WYEBPREFIX "--wyebrun"
2018-06-05 09:34:05 +00:00
#define WYEBKEEPSEC 3
2018-05-19 15:51:50 +00:00
//client
2018-06-07 05:29:52 +00:00
//wyebrun spawns the exe automatically
2018-06-05 09:34:05 +00:00
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
2018-06-07 05:29:52 +00:00
//loop the wyebkeep. to stop, use g_source_remove
2018-06-05 09:34:05 +00:00
guint wyebloop(char *exe, int sec);
2018-05-19 15:51:50 +00:00
//send stdin to svr and ret data to stdout
2018-07-29 09:45:25 +00:00
//blank and enter exits
2018-05-19 15:51:50 +00:00
void wyebclient(char *exe);
//server
2018-06-05 09:34:05 +00:00
typedef char *(*wyebdataf)(char *data);
2018-05-19 15:51:50 +00:00
//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);
2018-06-08 13:37:36 +00:00
//the caller is sent as 'exe --wyebrun 9999' and
//used to send the res meaning we are ready.
2018-05-19 15:51:50 +00:00
//3 sec left or client will die
2018-05-20 01:19:51 +00:00
2018-05-19 15:51:50 +00:00
#endif //_WYEBRUN_H