228 lines
6.0 KiB
Plaintext
228 lines
6.0 KiB
Plaintext
#include "availability.h"
|
|
|
|
int read_java_scritps(const char *screen_name,const char *screen_end)
|
|
{
|
|
FILE *fp;
|
|
char buffer[256];
|
|
fp = fopen("/var/esp/ssc/javascripts","r");
|
|
memset(buffer,0,256);
|
|
while (strcasecmp(buffer,screen_name) && !feof(fp))
|
|
{
|
|
fgets(buffer,256,fp);
|
|
buffer[strlen(buffer)-1] = '\0';
|
|
}
|
|
if (feof(fp))
|
|
return 0;
|
|
fgets(buffer,256,fp);
|
|
buffer[strlen(buffer)-1] = '\0';
|
|
while (strcasecmp(buffer,screen_end))
|
|
{
|
|
@format "%s\n" buffer
|
|
fgets(buffer,256,fp);
|
|
buffer[strlen(buffer)-1] = '\0';
|
|
}
|
|
fclose(fp);
|
|
return 1;
|
|
}
|
|
|
|
int getnumrecords (sscErrorHandle hError,ssdb_Error_Handle error_handle,ssdb_Request_Handle req_handle)
|
|
{
|
|
int number_of_records;
|
|
|
|
number_of_records = ssdbGetNumRecords(error_handle,req_handle);
|
|
|
|
if(ssdbGetLastErrorCode(error_handle) != SSDBERR_SUCCESS)
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return 0;
|
|
}
|
|
return number_of_records;
|
|
}
|
|
|
|
|
|
void help_create(sscErrorHandle hError,char *helpfile)
|
|
{
|
|
int fd;
|
|
char buffer[1024];
|
|
memset(buffer,0,1024);
|
|
unlink("/var/esp/ssc/help.html");
|
|
if ((fd = open("/var/esp/ssc/help.html",O_CREAT | O_RDWR,0777)) < 0)
|
|
return;
|
|
sprintf(buffer,"<html> <head> <title>SGI Embedded Support Partner - Help</title></head>\n"
|
|
"<frameset cols=\"170,*\" border=0>\n"
|
|
"<frame src=\"/help_navigator.html\" name=\"help_index\" scrolling=\"auto\"\n"
|
|
"marginheight=8 marginwidth=8 border=0 frameborder=0 framespacing=0>\n"
|
|
"<frame src=\"/help_contents.html#%s\" name=\"help_main\"\n"
|
|
"scrolling=\"auto\" marginheight=8 marginwidth=8 border=0 frameborder=0 framespacing=0>\n"
|
|
"<noframes>\n"
|
|
"<body bgcolor=\"#FFFFFF\">Your browser does not support frames. "
|
|
"Please install a browser that supports frames.\n"
|
|
"</body>\n"
|
|
"</noframes>\n"
|
|
"</frameset> </html>\n",helpfile);
|
|
write(fd,buffer,strlen(buffer));
|
|
close(fd);
|
|
}
|
|
|
|
int get_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum)
|
|
{
|
|
int key;
|
|
|
|
|
|
if ((key = sscFindPairByKey(cmdp,0,varname)) < 0)
|
|
{
|
|
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ <B>SERVER ERROR</B>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@ <p>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
|
|
@cell
|
|
@format "Error #: %d" errornum
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </body></html>
|
|
return 0;
|
|
}
|
|
if(type)
|
|
{
|
|
if (sscanf(cmdp[key].value,"%d",intval) != 1)
|
|
{
|
|
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ <B>SERVER ERROR</B>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@ <p>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
|
|
@cell
|
|
@format "Error #: %d" errornum
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </body></html>
|
|
return 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (cmdp[key].value && cmdp[key].value[0])
|
|
strcpy(string,cmdp[key].value);
|
|
else
|
|
{
|
|
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ <B>SERVER ERROR</B>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@ <p>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
|
|
@cell
|
|
@format "Error #: %d" errornum
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </body></html>
|
|
return 0;
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int get_variable_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum)
|
|
{
|
|
int key;
|
|
|
|
|
|
if ((key = sscFindPairByKey(cmdp,0,varname)) < 0)
|
|
{
|
|
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ <B>SERVER ERROR</B>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@ <p>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
|
|
@cell
|
|
@format "Error #: %d" errornum
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </body></html>
|
|
return 0;
|
|
}
|
|
if(type)
|
|
{
|
|
if (sscanf(cmdp[key].value,"%d",intval) != 1)
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (cmdp[key].value && cmdp[key].value[0])
|
|
strcpy(string,cmdp[key].value);
|
|
else
|
|
strcpy(string,"");
|
|
}
|
|
return 1;
|
|
}
|