Skip to content
Snippets Groups Projects
Verified Commit cf7b2631 authored by Zhang Huanjie's avatar Zhang Huanjie
Browse files

sendstat add version

parent 7b4f0596
Branches
No related tags found
No related merge requests found
1.0-20200325
2020.03.25 增加版本号
......@@ -75,7 +75,7 @@ void getstat(void) {
char buf[MAXLEN];
char *p;
/* hostname */
fp= fopen("/etc/ethudp/HOSTNAME","r");
fp= fopen("/etc/ethudp/HOSTNAME","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
ret=snprintf(sendbuf+len,MAXLEN-len,"hostname=%s",buf);
if(ret>0) len+=ret;
......@@ -87,7 +87,7 @@ void getstat(void) {
if(ret>0) len+=ret;
/* uptime */
fp= fopen("/proc/uptime","r");
fp= fopen("/proc/uptime","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
long int upt;
if(sscanf(buf,"%ld",&upt)==1) {
......@@ -98,7 +98,7 @@ void getstat(void) {
if(fp!=NULL) fclose(fp);
/* vpnindex */
fp= fopen("/etc/ethudp/SITE/INDEX","r");
fp= fopen("/etc/ethudp/SITE/INDEX","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
ret=snprintf(sendbuf+len,MAXLEN-len,"index=%s",buf);
if(ret>0) len+=ret;
......@@ -106,7 +106,7 @@ void getstat(void) {
if(fp!=NULL) fclose(fp);
/* SN */
fp= fopen("/etc/ethudp/SITE/SN","r");
fp= fopen("/etc/ethudp/SITE/SN","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
ret=snprintf(sendbuf+len,MAXLEN-len,"sn=%s",buf);
if(ret>0) len+=ret;
......@@ -114,12 +114,28 @@ void getstat(void) {
if(fp!=NULL) fclose(fp);
/* ZC */
fp= fopen("/etc/ethudp/SITE/ZC","r");
fp= fopen("/etc/ethudp/SITE/ZC","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
ret=snprintf(sendbuf+len,MAXLEN-len,"zc=%s",buf);
if(ret>0) len+=ret;
}
if(fp!=NULL) fclose(fp);
/* VPNSETUP VERSION */
fp= fopen("/usr/src/vpnsetup/VERSION","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
ret=snprintf(sendbuf+len,MAXLEN-len,"vpnsetupversion=%s",buf);
if(ret>0) len+=ret;
}
if(fp!=NULL) fclose(fp);
/* EthUDP VERSION */
fp= fopen("/usr/src/ethudp/VERSION","r");
if((fp!=NULL) && (fgets(buf,MAXLEN,fp)!=NULL) ){
ret=snprintf(sendbuf+len,MAXLEN-len,"ethudpversion=%s",buf);
if(ret>0) len+=ret;
}
if(fp!=NULL) fclose(fp);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment