From 598944c893f8eec1680890353ae32f9d52bc4ffd Mon Sep 17 00:00:00 2001 From: midipix Date: Aug 09 2018 09:47:53 +0000 Subject: front-end utility: ptyc_main(): remove the redundant argc parameter. --- diff --git a/include/ptycon/ptycon.h b/include/ptycon/ptycon.h index e6ef22f..7a84e9d 100644 --- a/include/ptycon/ptycon.h +++ b/include/ptycon/ptycon.h @@ -99,7 +99,7 @@ ptyc_api int ptyc_wait_for_console (struct ptyc_driver_ctx *); ptyc_api void ptyc_free_console (struct ptyc_driver_ctx *); /* utility api */ -ptyc_api int ptyc_main (int, char **, char **); +ptyc_api int ptyc_main (char **, char **); #ifdef __cplusplus } diff --git a/project/overrides.mk b/project/overrides.mk index e69de29..4ac3b36 100644 --- a/project/overrides.mk +++ b/project/overrides.mk @@ -0,0 +1 @@ +src/$(PACKAGE).o: CFLAGS_CONFIG += -Wno-unused-parameter diff --git a/src/driver/ptyc_amain.c b/src/driver/ptyc_amain.c index 1021048..37c2657 100644 --- a/src/driver/ptyc_amain.c +++ b/src/driver/ptyc_amain.c @@ -56,7 +56,7 @@ static int ptyc_exit(struct ptyc_driver_ctx * dctx, int nerrors) return nerrors ? 2 : 0; } -int ptyc_main(int argc, char ** argv, char ** envp) +int ptyc_main(char ** argv, char ** envp) { int ret; struct ptyc_driver_ctx * dctx; @@ -65,7 +65,9 @@ int ptyc_main(int argc, char ** argv, char ** envp) return ret; if ((ret = ptyc_get_driver_ctx(argv,envp,PTYC_DRIVER_FLAGS,&dctx))) - return (ret == PTYC_USAGE) ? !--argc : 2; + return (ret == PTYC_USAGE) + ? !argv || !argv[0] || !argv[1] + : 2; if (dctx->cctx->drvflags & PTYC_DRIVER_VERSION) if ((ptyc_version(dctx)) < 0) diff --git a/src/ptycon.c b/src/ptycon.c index 000b333..1b5bf7f 100644 --- a/src/ptycon.c +++ b/src/ptycon.c @@ -36,7 +36,7 @@ static int ptycon_dbg_init(char ** argv) return 0; } -static int32_t ptycon_start(int argc, char ** argv, char ** envp) +static int32_t ptycon_start(char ** argv, char ** envp) { int32_t status; nt_runtime_data * rtdata; @@ -49,7 +49,6 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp) return status; if (rtdata->argv) { - argc = rtdata->argc; argv = rtdata->argv; envp = rtdata->envp; } @@ -67,7 +66,7 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp) /* no tty session? */ if (!rtdata->tty_keys[0]) - return ptyc_main(argc,argv,envp); + return ptyc_main(argv,envp); /* tty */ ntapi->tt_aligned_block_memset( @@ -119,7 +118,7 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp) return status; /* main */ - return ptyc_main(argc,argv,envp); + return ptyc_main(argv,envp); } static int __stdcall ptycon_daemon_entry_point(void * hswap) @@ -137,8 +136,7 @@ static int __stdcall ptycon_daemon_entry_point(void * hswap) 0,0,0))) ptycon_exit(status); - ptycon_exit(ptycon_start( - argc,argv,envp)); + ptycon_exit(ptycon_start(argv,envp)); return NT_STATUS_INTERNAL_ERROR; }