A Cardiovascular Simulator for Research 1.0.0
(2,029 bytes)
/* The function check_wfdb.c determines which version of the WFDB
software package is currently installed and returns a flag to
standard output depending on the command line argument. The
following scenarios may occur:
1) If the argument install has been included at the command line
and a version less than or equal to 10.1.6 is currently installed,
the flag will be set to 1.
2) If the argument install has been included at the command line
and a version greater than 10.1.6 is currently installed, the
flag will be set to 0.
3) If the argument uninstall been included at the command line
and a version equal to 10.1.6 is currently installed, the flag
will be set to 1.
4) If the argument uninstall has been included at the command line
and a version not equal to 10.1.6 is currently installed, the flag
will be set to 0.
Function argument: either install or uninstall
Function outputs: (none)
Compilation line: gcc -o check_wfdb check_wfdb.c -lwfdb */
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <wfdb/wfdb.h>
main (argc, argv)
int argc;
char **argv;
{
char tmp[128], *buf;
char vero[3], vert[3], verth[3];
int i, one, two, three, X;
X = 0;
buf = wfdberror();
sscanf(buf,"%s %s %s %s",tmp,tmp,tmp,tmp);
for (i=0;i<128;i++)
{
if (tmp[i] == '.') tmp[i] = ' ';
}
sscanf(tmp,"%s %s %s\n",vero,vert,verth);
one = atoi(vero);
two = atoi(vert);
three = atoi(verth);
if (!strcmp(argv[1],"install"))
{
if (one > 10)
{
printf("%d\n",X);
}
else
{
if (two > 1)
{
printf("%d\n",X);
}
else
{
if (three > 6)
{
printf("%d\n",X);
}
else
{
X = 1;
printf("%d\n",X);
}
}
}
}
else if (!strcmp(argv[1],"uninstall"))
{
if (one == 10 & two == 1 & three == 6)
{
X = 1;
printf("%d\n",X);
}
else
{
printf("%d\n",X);
}
}
}