diff options
author | fossee | 2019-09-03 11:07:32 +0530 |
---|---|---|
committer | fossee | 2019-09-03 11:07:32 +0530 |
commit | f8d3dbc8c0f1c59a0546998cb9365e5c291dca07 (patch) | |
tree | 28f0d2fe7f00f1ee854e411b82689eae861a9c52 /src/ghdlserver/ghdlserver.c | |
parent | 491e95ad13764229c3e27dfb625c5dbef9ddec59 (diff) | |
download | nghdl-f8d3dbc8c0f1c59a0546998cb9365e5c291dca07.tar.gz nghdl-f8d3dbc8c0f1c59a0546998cb9365e5c291dca07.tar.bz2 nghdl-f8d3dbc8c0f1c59a0546998cb9365e5c291dca07.zip |
added examples and modified server
Diffstat (limited to 'src/ghdlserver/ghdlserver.c')
-rw-r--r-- | src/ghdlserver/ghdlserver.c | 15 |
1 files changed, 3 insertions, 12 deletions
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<i; j++) - printf("Pid : %d\n", pid[j]); - if (fp) fclose(fp); - return(pid[i-1]); + return(pid); } /* 23.Mar.2017 - RM - Pass the sock_port argument. We need this if a netlist |