useless argc and argv references removed
This commit is contained in:
parent
5a9c69191a
commit
ce7351458b
@ -14,20 +14,18 @@ void service_path (char *path, const char *sname, int index, int version)
|
||||
snprintf (path, PATH_MAX, "%s/%s-%d-%d", TMPDIR, sname, index, version);
|
||||
}
|
||||
|
||||
int ipc_server_init (int argc, char **argv, char **env
|
||||
int ipc_server_init (char **env
|
||||
, struct ipc_service *srv, const char *sname)
|
||||
{
|
||||
if (srv == NULL)
|
||||
return IPC_ERROR_WRONG_PARAMETERS;
|
||||
|
||||
// TODO
|
||||
// use the argc, argv and env parameters
|
||||
// use 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
|
||||
@ -80,11 +78,15 @@ int ipc_server_write (const struct ipc_client *p, const struct ipc_message *m)
|
||||
return ipc_message_write (p->proc_fd, m);
|
||||
}
|
||||
|
||||
int ipc_application_connection (int argc, char **argv, char **env
|
||||
int ipc_application_connection (char **env
|
||||
, struct ipc_service *srv, const char *sname)
|
||||
{
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
// TODO
|
||||
// use env parameters
|
||||
// it will be useful to change some parameters transparently
|
||||
// ex: to get resources from other machines, choosing the
|
||||
// remote with environment variables
|
||||
|
||||
env = env;
|
||||
|
||||
assert (srv != NULL);
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
// srv->version and srv->index must be already set
|
||||
// init unix socket + fill srv->spath
|
||||
int ipc_server_init (int argc, char **argv, char **env
|
||||
int ipc_server_init (char **env
|
||||
, struct ipc_service *srv, const char *sname);
|
||||
int ipc_server_close (struct ipc_service *srv);
|
||||
int ipc_server_close_client (struct ipc_client *p);
|
||||
@ -37,7 +37,7 @@ int ipc_server_select (struct ipc_clients * clients, struct ipc_service *srv
|
||||
// Initialize connection with unix socket
|
||||
// send the connection string to $TMP/<service>
|
||||
// fill srv->spath && srv->service_fd
|
||||
int ipc_application_connection (int argc, char **argv, char **env
|
||||
int ipc_application_connection (char **env
|
||||
, struct ipc_service *, const char *);
|
||||
int ipc_application_close (struct ipc_service *);
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define MSG "coucou"
|
||||
#define SERVICE_NAME "pongd"
|
||||
|
||||
void non_interactive (int argc, char *argv[], char *env[])
|
||||
void non_interactive (char *env[])
|
||||
{
|
||||
struct ipc_message m;
|
||||
memset (&m, 0, sizeof (struct ipc_message));
|
||||
@ -22,8 +22,8 @@ void non_interactive (int argc, char *argv[], char *env[])
|
||||
srv.version = 0;
|
||||
|
||||
// init service
|
||||
if (ipc_application_connection (argc, argv, env, &srv, SERVICE_NAME) < 0) {
|
||||
handle_err("main", "server_init < 0");
|
||||
if (ipc_application_connection (env, &srv, SERVICE_NAME) < 0) {
|
||||
handle_err("main", "ipc_application_connection < 0");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ void non_interactive (int argc, char *argv[], char *env[])
|
||||
}
|
||||
}
|
||||
|
||||
void interactive (int argc, char *argv[], char *env[])
|
||||
void interactive (char *env[])
|
||||
{
|
||||
struct ipc_message m;
|
||||
memset (&m, 0, sizeof (struct ipc_message));
|
||||
@ -69,8 +69,8 @@ void interactive (int argc, char *argv[], char *env[])
|
||||
srv.version = 0;
|
||||
|
||||
// init service
|
||||
if (ipc_application_connection (argc, argv, env, &srv, SERVICE_NAME) < 0) {
|
||||
handle_err ("main", "server_init < 0");
|
||||
if (ipc_application_connection (env, &srv, SERVICE_NAME) < 0) {
|
||||
handle_err ("main", "ipc_application_connection < 0");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -123,10 +123,13 @@ void interactive (int argc, char *argv[], char *env[])
|
||||
|
||||
int main (int argc, char *argv[], char *env[])
|
||||
{
|
||||
argc = argc; // warnings
|
||||
argv = argv; // warnings
|
||||
|
||||
if (argc == 1)
|
||||
non_interactive (argc, argv, env);
|
||||
non_interactive (env);
|
||||
else
|
||||
interactive (argc, argv, env);
|
||||
interactive (env);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -151,6 +151,9 @@ void main_loop ()
|
||||
|
||||
int main(int argc, char * argv[], char **env)
|
||||
{
|
||||
argc = argc; // warnings
|
||||
argv = argv; // warnings
|
||||
|
||||
srv = malloc (sizeof (struct ipc_service));
|
||||
if (srv == NULL) {
|
||||
exit (1);
|
||||
@ -161,7 +164,7 @@ int main(int argc, char * argv[], char **env)
|
||||
|
||||
// unlink("/tmp/ipc/pongd-0-0");
|
||||
|
||||
if (ipc_server_init (argc, argv, env, srv, PONGD_SERVICE_NAME) < 0) {
|
||||
if (ipc_server_init (env, srv, PONGD_SERVICE_NAME) < 0) {
|
||||
handle_error("server_init < 0");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user