Obsolete
/
libipc-old
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
libipc-old/lib/communication2.c

36 lines
1011 B
C
Raw Normal View History

2016-10-14 17:47:08 +02:00
#include "communication2.h"
#include <stdio.h>
#include <time.h>
#include <errno.h>
int srv_init (int argc, char **argv, char **env, struct service *srv, const char *sname, int (*cb)(int argc, char **argv, char **env, struct service *srv, const char *sname))
{
if (srv == NULL)
return ER_PARAMS;
// TODO
// use the argc, argv and env parameters
// it will be useful to change some parameters transparently
// ex: to get resources from other machines, choosing the
// remote with environment variables
argc = argc;
argv = argv;
env = env;
// gets the service path, such as /tmp/<service>
memset (srv->spath, 0, PATH_MAX);
strncat (srv->spath, TMPDIR, PATH_MAX -1);
strncat (srv->spath, sname, PATH_MAX -1);
srv->version = COMMUNICATION_VERSION;
srv->index = 0; // TODO
if (cb != NULL) {
int ret = (*cb) (argc, argv, env, srv, sname);
if (ret != 0)
return ret;
}
return 0;
}