From f8d3dbc8c0f1c59a0546998cb9365e5c291dca07 Mon Sep 17 00:00:00 2001 From: fossee Date: Tue, 3 Sep 2019 11:07:32 +0530 Subject: added examples and modified server --- src/ghdlserver/ghdlserver.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/ghdlserver/ghdlserver.c') diff --git a/src/ghdlserver/ghdlserver.c b/src/ghdlserver/ghdlserver.c index ac34a87..5bf2e99 100644 --- a/src/ghdlserver/ghdlserver.c +++ b/src/ghdlserver/ghdlserver.c @@ -77,7 +77,7 @@ static int get_ngspice_pid(void) FILE* fp = NULL; struct dirent* dir_entry; char path[1024], rd_buff[1024]; - pid_t pid[32]; + pid_t pid = -1; if ((dirp = opendir("/proc/")) == NULL) { @@ -85,11 +85,6 @@ static int get_ngspice_pid(void) exit(-1); } - for(int i=0; i<31; i++) - pid[i] = -1; - - int i=0; - while ((dir_entry = readdir(dirp)) != NULL) { char* nptr; @@ -113,19 +108,15 @@ static int get_ngspice_pid(void) fscanf(fp, "%s", rd_buff); if (strcmp(rd_buff, NGSPICE) == 0) { - pid[i++] = (pid_t)tmp; - // break; + pid = (pid_t)tmp; } } } } - for(int j=0; j