1
0

Source code upload

This commit is contained in:
calmsacibis995
2022-09-29 17:59:04 +03:00
parent 72fa9da3d7
commit 8fc8fa8089
33399 changed files with 11964078 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
#!smake
#
#
SRC_DEPTH = ../../..
include $(ROOT)/usr/include/make/commondefs
include $(SRC_DEPTH)/include/ssscommondefs
LOCALINCS = -nostdinc -I$(ROOT)/usr/include/sss -I$(ROOT)/usr/include \
-I../include
LLDLIBS= -delay_load -lssdb -lSSC -leventmon
IDB_TAG=-idb $(SSS_EOE)
OBJECT_STYLE=N32
LCDEFS =
LCOPTS =
LCINCS = $(LOCALINCS)
CFILES = uiavail.c uielements.c uiavailmon.c
LD_QUICKSTART_INFO=
COMMONPREF = SSS
LIBPATH = /usr/lib32/internal
TARGETS = libavailability.so
default: $(TARGETS)
include $(COMMONRULES)
clobber clean:
rm -f *.o $(TARGETS)
rm -f *.so so_locations Makedepend
libavailability.so: $(OBJECTS)
cc $(OBJECTS) ../semd_config/semd_config.o \
$(LDFLAGS) -shared -all -soname $@ \
-exports_file $(ROOT)/usr/include/sss/rgPluginServer.export \
-o $@ -g -woff 1048 -no_unresolved
install: default
${INSTALL} $(IDB_TAG) -F $(LIBPATH) $(TARGETS)

View File

@@ -0,0 +1,107 @@
#ifndef H_UI_H
#define H_UI_H
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <ssdbapi.h>
#include <ssdberr.h>
#include <sys/types.h>
#include "rgPluginAPI.h"
#include "sscHTMLGen.h"
#include "sscPair.h"
#include <time.h>
#define START 0
#define END 1
#define MAXNUMBERS_OF_KEYS 512
#define MAX_ACTIONS 512
#define CHARTYPE 0
#define INTTYPE 1
/* --------------------------------------------------------------------------- */
#ifdef __TIME__
#ifdef __DATE__
#define INCLUDE_TIME_DATE_STRINGS 1
#endif
#endif
/* --------------------------------------------------------------------------- */
#define MYVERSION_MAJOR 1 /* Report Generator PlugIn Major Version number */
#define MYVERSION_MINOR 0 /* Report Generator PlugIn Minor Version number */
/* --------------------------------------------------------------------------- */
/* globals for parsing input */
static char szDefaultUserName[] = ""; /* Default user name */
static char szDefaultPassword[] = ""; /* Default password */
static char szDefaultHostName[] = "localhost"; /* Default host name */
static char szDefaultDatabaseName[] = "ssdb"; /* Default db name */
enum REQUEST {
GLOBALPAGE=1, /* Bring up global page */
GLOBALCONFIRM, /* Confirm global setting changes */
AVAILMON_CONFIG,
AVAILMON_CONFIG_CONFIRM,
AVAILMON_MAIL,
AVAILMON_MAIL_CONFIRM
};
/* Local "Session" structure */
typedef struct sss_s_MYSESSION {
unsigned long signature; /* sizeof(mySession) */
struct sss_s_MYSESSION *next; /* next pointer */
int textonly; /* text mode only flag */
int report_type;
} mySession;
static char myTitle[] = "Event Reports";
static const char myLogo[] = "Availability Plugin Server";
static const char szVersion[] = "Version";
static const char szTitle[] = "Title";
static const char szThreadSafe[] = "ThreadSafe";
static const char szUnloadable[] = "Unloadable";
static const char szUnloadTime[] = "UnloadTime";
static const char szAcceptRawCmdString[] = "AcceptRawCmdString"; /* Obligatory attribute name: how plugin will process cmd parameters */
static char szServerNameErrorPrefix[] = "SSS WEB Config Server Error: %s";
static char szVersionStr[64];
static pthread_mutex_t seshFreeListmutex;
static const char szUnloadTimeValue[] = "120"; /* Unload time for this plug in (sec.) */
static const char szThreadSafeValue[] = "0"; /* "Thread Safe" flag value - this plugin is thread safe */
static const char szUnloadableValue[] = "1"; /* "Unloadable" flag value - RG core might unload this plugin from memory */
static const char szAcceptRawCmdStringValue[] = "1"; /* RG server accept "raw" command string like key=value&key2=value&... */
static const char szUserAgent[] = "User-Agent";
static int volatile mutex_inited = 0; /* seshFreeListmutex mutex inited flag */
static mySession *sesFreeList = 0; /* Session free list */
/* Global Setup */
void global_setup(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void globalconfirm(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
int getnumrecords (sscErrorHandle hError,ssdb_Error_Handle error_handle,ssdb_Request_Handle req_handle);
void availmon_config(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle);
void availmon_config_confirm(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void availmon_mail(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void availmon_mail_confirm(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void availmon_mail_confirm_html(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle, int pageselect);
/* utility functions */
int read_java_scritps(const char *screen_name,const char *screen_end);
void print_error(void);
void help_create(sscErrorHandle hError,char *helpfile);
int get_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum);
void message(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
#endif /* endif H_UI_H */

View File

@@ -0,0 +1,431 @@
/*
* Copyright 1992-1999 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
#include "availability.h"
/* ----------------------------- rgpgInit ------------------------------------ */
int RGPGAPI rgpgInit(sscErrorHandle hError)
{
/* Try initialize "free list of mySession" mutex */
if(pthread_mutex_init(&seshFreeListmutex,0))
{
sscError(hError,szServerNameErrorPrefix,"Can't initialize mutex");
return 0; /* error */
}
mutex_inited++;
#ifdef INCLUDE_TIME_DATE_STRINGS
sprintf(szVersionStr,"%d.%d %s %s",MYVERSION_MAJOR,MYVERSION_MINOR,__DATE__,__TIME__);
#else
sprintf(szVersionStr,"%d.%d",MYVERSION_MAJOR,MYVERSION_MINOR);
#endif
return 1; /* success */
}
/* ----------------------------- rgpgDone ------------------------------------ */
int RGPGAPI rgpgDone(sscErrorHandle hError)
{
mySession *s;
if(mutex_inited)
{
pthread_mutex_destroy(&seshFreeListmutex);
mutex_inited = 0;
while((s = sesFreeList) != 0)
{
sesFreeList = s->next;
free(s);
}
return 1; /* success */
}
return 0; /* error - not inited */
}
/* -------------------------- rgpgCreateSesion ------------------------------- */
rgpgSessionID RGPGAPI rgpgCreateSesion(sscErrorHandle hError)
{
mySession *s;
pthread_mutex_lock(&seshFreeListmutex);
if((s = sesFreeList) != 0)
sesFreeList = s->next;
pthread_mutex_unlock(&seshFreeListmutex);
if(!s)
s = (mySession*)malloc(sizeof(mySession));
if(!s)
{
sscError(hError,szServerNameErrorPrefix,"No memory to create session in rgpgCreateSesion()");
return 0;
}
memset(s,0,sizeof(mySession));
s->signature = sizeof(mySession);
return (rgpgSessionID)s;
}
/* ------------------------- rgpgDeleteSesion -------------------------------- */
void RGPGAPI rgpgDeleteSesion(sscErrorHandle hError,rgpgSessionID _s)
{
mySession *s = (mySession *)_s;
if(!s || s->signature != sizeof(mySession))
{
sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgDeleteSesion()");
}
else
{
pthread_mutex_lock(&seshFreeListmutex);
s->next = sesFreeList;
sesFreeList = s;
s->signature = 0;
pthread_mutex_unlock(&seshFreeListmutex);
}
}
/* ------------------------ rgpgGetAttribute --------------------------------- */
char *RGPGAPI rgpgGetAttribute(sscErrorHandle hError,rgpgSessionID session, const char *attributeID, const char *extraAttrSpec,int *typeattr)
{
char *s;
if(typeattr)
*typeattr = RGATTRTYPE_STATIC;
if(!strcasecmp(attributeID,szVersion))
s = (char*)szVersionStr;
else if(!strcasecmp(attributeID,szTitle))
s = (char*)myLogo;
else if(!strcasecmp(attributeID,szUnloadTime))
s = (char*)szUnloadTimeValue;
else if(!strcasecmp(attributeID,szThreadSafe))
s = (char*)szThreadSafeValue;
else if(!strcasecmp(attributeID,szUnloadable))
s = (char*)szUnloadableValue;
else if(!strcasecmp(attributeID,szAcceptRawCmdString))
s = (char*)szAcceptRawCmdStringValue;
else
{
sscError(hError,"%s No such attribute '%s' in rgpgGetAttribute()",szServerNameErrorPrefix,attributeID);
return 0;
}
if(!s)
sscError(hError,szServerNameErrorPrefix,"No memory in rgpgGetAttribute()");
return s;
}
/* --------------------- rgpgFreeAttributeString ------------------------------ */
void RGPGAPI rgpgFreeAttributeString(sscErrorHandle hError,rgpgSessionID session,const char *attributeID,const char *extraAttrSpec,
char *attrString,int restype)
{
if(((restype == RGATTRTYPE_SPECIALALLOC) || (restype == RGATTRTYPE_MALLOCED)) && attrString)
free(attrString);
}
/*----------------------------------------rgpgSetAttribute---------------------------------------------*/
void RGPGAPI rgpgSetAttribute(sscErrorHandle hError, rgpgSessionID session, const char *attributeID, const char *extraAttrSpec, const char *value)
{
char buff[128]; mySession *sess = session;
if(!strcasecmp(attributeID,szVersion) || !strcasecmp(attributeID,szTitle) ||
!strcasecmp(attributeID,szThreadSafe) || !strcasecmp(attributeID,szUnloadable) ||
!strcasecmp(attributeID,szUnloadTime))
{
sscError(hError,szServerNameErrorPrefix,"Attempt to set read only attribute in rgpgSetAttribute()");
return;
}
if(!strcasecmp(attributeID,"User-Agent") && value)
{
sess->textonly = (strcasecmp(value,"Lynx") == 0) ? 1 : 0;
return;
}
if(!sess || sess->signature != sizeof(mySession))
{
sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgGetAttribute()");
return;
}
}
/*----------------------------------------rgpgGenerateReport---------------------------------------------*/
int RGPGAPI rgpgGenerateReport(sscErrorHandle hError, rgpgSessionID _session, int argc, char* argv[],char *rawCommandString, streamHandle result,
char *accessmask)
{
ssdb_Client_Handle client;
ssdb_Connection_Handle connection;
ssdb_Request_Handle req_handle;
ssdb_Error_Handle error_handle;
int i,cmdpsize,SQL_TYPE;
CMDPAIR cmdp[MAXNUMBERS_OF_KEYS];
mySession *session = _session;
if ((error_handle = ssdbCreateErrorHandle()) == NULL)
{
sscError(hError,"SSDB API Error %d: \"%s\" - can't create error handle\n",
ssdbGetLastErrorCode(0),ssdbGetLastErrorString(0));
return 0;
}
if ((client = ssdbNewClient(error_handle,szDefaultUserName,szDefaultPassword,0)) == NULL)
{
sscError(hError,"SSDB API Error %d: \"%s\" - can't create new client handle\n",
ssdbGetLastErrorCode(error_handle),ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
return 0;
}
/* Establish a connection to a database */
if ((connection = ssdbOpenConnection(error_handle,client,szDefaultHostName,szDefaultDatabaseName,0)) == NULL)
{
sscError(hError,"SSDB API Error %d: \"%s\" - can't open connection\n",
ssdbGetLastErrorCode(error_handle),ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
ssdbDeleteClient(error_handle,client);
return 0;
}
/* Initialize The HTML Generator */
i = createMyHTMLGenerator(result);
if (i != 0)
{
sscError(hError, "Sample server: Can't open the HTML generator");
ssdbDeleteErrorHandle(error_handle);
ssdbDeleteClient(error_handle,client);
ssdbCloseConnection (error_handle,connection);
return 0;
}
if (argc < 2)
{
sscError(hError, "Invalid Request\n");
ssdbDeleteErrorHandle(error_handle);
ssdbDeleteClient(error_handle,client);
ssdbCloseConnection (error_handle,connection);
return 0;
}
cmdpsize = sscInitPair(rawCommandString,cmdp,MAXNUMBERS_OF_KEYS);
/* Check WEB browser type (Lynx is only tex based) */
for(i = 0;(i = sscFindPairByKey(cmdp,i,szUserAgent)) >= 0;i++)
if(!strcasecmp(cmdp[i].value,"Lynx")) session->textonly = 1;
/* Availmon Setup */
if (!strcasecmp(argv[1],"AVAILMON_CONFIG"))
session->report_type = AVAILMON_CONFIG;
else if (!strcasecmp(argv[1],"AVAILMON_CONFIG_CONFIRM"))
session->report_type = AVAILMON_CONFIG_CONFIRM;
else if (!strcasecmp(argv[1],"AVAILMON_MAIL"))
session->report_type = AVAILMON_MAIL;
else if (!strcasecmp(argv[1],"AVAILMON_MAIL_CONFIRM"))
session->report_type = AVAILMON_MAIL_CONFIRM;
else if (!strcasecmp(argv[1],"GLOBALPAGE"))
session->report_type = GLOBALPAGE;
else if (!strcasecmp(argv[1],"GLOBALCONFIRM"))
session->report_type = GLOBALCONFIRM;
else
{
sscError(hError, "Invalid Report Request %s",argv[1]);
}
switch (session->report_type)
{
case AVAILMON_CONFIG:
availmon_config(hError,session,connection,error_handle);
break;
case AVAILMON_CONFIG_CONFIRM:
availmon_config_confirm(hError,session,connection,error_handle,cmdp);
break;
case AVAILMON_MAIL:
availmon_mail(hError,session,connection,error_handle,cmdp);
break;
case AVAILMON_MAIL_CONFIRM:
availmon_mail_confirm(hError,session,connection,error_handle,cmdp);
break;
case GLOBALPAGE:
global_setup(hError,session,connection,error_handle,cmdp);
break;
case GLOBALCONFIRM:
globalconfirm(hError,session,connection,error_handle,cmdp);
break;
}
/* Destroy The HTML Generator */
i = deleteMyHTMLGenerator();
if (i != 0)
{
sscError(hError, "Sample server: Can't destroy the HTML generator");
}
if (ssdbIsConnectionValid(error_handle,connection))
ssdbCloseConnection (error_handle,connection);
if (ssdbIsClientValid(error_handle,client))
ssdbDeleteClient(error_handle,client);
if (error_handle)
ssdbDeleteErrorHandle(error_handle);
return 0;
}
#if 0
<script language="JavaScript">
<!--
function showMap()
{ var map=window.open('help.html', 'help',
'width=650,height=350,status=yes,scrollbars=yes,resizable=yes');
map.main=self;
map.main.name="sss_main";
map.focus();
}
function isPosInt(inputVal)
{ inputStr = inputVal.toString()
for(i = 0;i < inputStr.length; i++)
{ oneChar = inputStr.charAt(i);
if(oneChar < "0" || oneChar > "9") return false;
}
return true;
}
function checkString(inputVal, fieldname)
{ inputStr = inputVal.toString()
for(i = 0;i < inputStr.length; i++)
{ oneChar = inputStr.charAt(i);
if(oneChar == "\"")
{ alert("String " + fieldname + " should not contain \"'s");
return false;
}
}
return true;
}
function clearForm(av_config_form) {
for(i = 0; i < av_config_form.av_autoemail.length; i++)
{ av_config_form.av_autoemail[i].checked = 0;
}
for(i = 0; i < av_config_form.av_shutdown.length; i++)
{ av_config_form.av_shutdown[i].checked = 0;
}
for(i = 0; i < av_config_form.av_hinv.length; i++)
{ av_config_form.av_hinv[i].checked = 0;
}
for(i = 0; i < av_config_form.av_sysmsg.length; i++)
{ av_config_form.av_sysmsg[i].checked = 0;
}
for(i = 0; i < av_config_form.av_uptimed.length; i++)
{ av_config_form.av_uptimed[i].checked = 0;
}
av_config_form.av_daysupdate.value = "";
av_config_form.av_lasttick.value = "";
av_config_form.av_tickduration.value = "";
}
function checkData(av_config_form)
{ var autoEmailChoice = -1;
var sutdownChoice = -1;
var hinvChoice = -1;
var msgChoice = -1;
var uptimedChoice = -1;
var statusUpdate = av_config_form.av_daysupdate.value;
av_config_form.av_daysupdate.focus();
var uptimeFile = av_config_form.av_lasttick.value;
av_config_form.av_lasttick.focus();
var uptimeCheck = av_config_form.av_tickduration.value;
av_config_form.av_tickduration.focus();
for(i = 0; i < av_config_form.av_autoemail.length; i++)
{ if(av_config_form.av_autoemail[i].checked)
autoEmailChoice = i;
}
for(i = 0; i < av_config_form.av_shutdown.length; i++)
{ if(av_config_form.av_shutdown[i].checked)
sutdownChoice = i;
}
for(i = 0; i < av_config_form.av_hinv.length; i++)
{ if(av_config_form.av_hinv[i].checked)
hinvChoice = i;
}
for(i = 0; i < av_config_form.av_sysmsg.length; i++)
{ if(av_config_form.av_sysmsg[i].checked)
msgChoice = i;
}
for(i = 0; i < av_config_form.av_uptimed.length; i++)
{ if(av_config_form.av_uptimed[i].checked)
uptimedChoice = i;
}
if(autoEmailChoice == -1 && sutdownChoice == -1 && hinvChoice == -1 && msgChoice == -1 && uptimedChoice ==-1 && statusUpdate == "" && uptimeFile == "" && uptimeCheck == "")
{ alert("Nothing to setup");
return false;
}
if(autoEmailChoice == -1)
{ alert("You must enable or disable automatic email distribution");
return false;
}
msg1 = "\n\nAutomatic e-mail distribution = " + av_config_form.av_autoemail[autoEmailChoice].value;
if(sutdownChoice == -1)
{ alert("You must enable or disable display of shutdown reason");
return false;
}
msg1 += "\nDisplay of shutdown reason = " + av_config_form.av_shutdown[sutdownChoice].value;
if(hinvChoice == -1)
{ alert("You must choose to include HINV information into e-mail or not")
return false;
}
msg1 += "\nInclude HINV information into e-mail = " + av_config_form.av_hinv[hinvChoice].value;
if(msgChoice == -1)
{ alert("You must enable or disable capturing of important system messages");
return false;
}
msg1 += "\nCapturing of important system messages = " + av_config_form.av_sysmsg[msgChoice].value;
if(uptimedChoice == -1)
{ alert("You must to choose to start uptime deamon or not");
return false;
}
msg1 += "\nStart uptime daemon = " + av_config_form.av_uptimed[uptimedChoice].value;
if(statusUpdate == "")
{ alert("You must enter number of days between status updates");
return false;
}
if(!isPosInt(statusUpdate) || statusUpdate > 300)
{ msg1 = "Incorrect entry for number of days between status updates\nMust be less or equal to 300 days";
alert(msg1);
return false;
}
msg1 += "\nNumber of days between status updates = " + statusUpdate;
if(uptimeFile == "")
{ uptimeFile = "/var/adm/avail/.save/lasttick";
document.av_config_form.av_lasttick.value = uptimeFile;
}
else {
if (!checkString(document.av_config_form.av_lasttick.value, "filename for last update write")) return false;
}
msg1 += "\nFilename for last uptime write = " + uptimeFile;
if(!isPosInt(uptimeCheck) || uptimeCheck > 600)
{ msg1 = "Incorrect entry for time interval between uptime check\nMust be less or equal to 600 seconds";
alert(msg1);
return false;
}
if(uptimeCheck == "")
{ uptimeCheck = "300";
document.av_config_form.av_tickduration.value = uptimeCheck;
}
msg1 += "\nInterval in seconds between uptime check = " + uptimeCheck;
return window.confirm("You entered the following configuration for Availmon Monitor setup:" + msg1);
}
#endif

View File

@@ -0,0 +1,431 @@
/*
* Copyright 1992-1999 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
#include "availability.h"
/* ----------------------------- rgpgInit ------------------------------------ */
int RGPGAPI rgpgInit(sscErrorHandle hError)
{
/* Try initialize "free list of mySession" mutex */
if(pthread_mutex_init(&seshFreeListmutex,0))
{
sscError(hError,szServerNameErrorPrefix,"Can't initialize mutex");
return 0; /* error */
}
mutex_inited++;
#ifdef INCLUDE_TIME_DATE_STRINGS
sprintf(szVersionStr,"%d.%d %s %s",MYVERSION_MAJOR,MYVERSION_MINOR,__DATE__,__TIME__);
#else
sprintf(szVersionStr,"%d.%d",MYVERSION_MAJOR,MYVERSION_MINOR);
#endif
return 1; /* success */
}
/* ----------------------------- rgpgDone ------------------------------------ */
int RGPGAPI rgpgDone(sscErrorHandle hError)
{
mySession *s;
if(mutex_inited)
{
pthread_mutex_destroy(&seshFreeListmutex);
mutex_inited = 0;
while((s = sesFreeList) != 0)
{
sesFreeList = s->next;
free(s);
}
return 1; /* success */
}
return 0; /* error - not inited */
}
/* -------------------------- rgpgCreateSesion ------------------------------- */
rgpgSessionID RGPGAPI rgpgCreateSesion(sscErrorHandle hError)
{
mySession *s;
pthread_mutex_lock(&seshFreeListmutex);
if((s = sesFreeList) != 0)
sesFreeList = s->next;
pthread_mutex_unlock(&seshFreeListmutex);
if(!s)
s = (mySession*)malloc(sizeof(mySession));
if(!s)
{
sscError(hError,szServerNameErrorPrefix,"No memory to create session in rgpgCreateSesion()");
return 0;
}
memset(s,0,sizeof(mySession));
s->signature = sizeof(mySession);
return (rgpgSessionID)s;
}
/* ------------------------- rgpgDeleteSesion -------------------------------- */
void RGPGAPI rgpgDeleteSesion(sscErrorHandle hError,rgpgSessionID _s)
{
mySession *s = (mySession *)_s;
if(!s || s->signature != sizeof(mySession))
{
sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgDeleteSesion()");
}
else
{
pthread_mutex_lock(&seshFreeListmutex);
s->next = sesFreeList;
sesFreeList = s;
s->signature = 0;
pthread_mutex_unlock(&seshFreeListmutex);
}
}
/* ------------------------ rgpgGetAttribute --------------------------------- */
char *RGPGAPI rgpgGetAttribute(sscErrorHandle hError,rgpgSessionID session, const char *attributeID, const char *extraAttrSpec,int *typeattr)
{
char *s;
if(typeattr)
*typeattr = RGATTRTYPE_STATIC;
if(!strcasecmp(attributeID,szVersion))
s = (char*)szVersionStr;
else if(!strcasecmp(attributeID,szTitle))
s = (char*)myLogo;
else if(!strcasecmp(attributeID,szUnloadTime))
s = (char*)szUnloadTimeValue;
else if(!strcasecmp(attributeID,szThreadSafe))
s = (char*)szThreadSafeValue;
else if(!strcasecmp(attributeID,szUnloadable))
s = (char*)szUnloadableValue;
else if(!strcasecmp(attributeID,szAcceptRawCmdString))
s = (char*)szAcceptRawCmdStringValue;
else
{
sscError(hError,"%s No such attribute '%s' in rgpgGetAttribute()",szServerNameErrorPrefix,attributeID);
return 0;
}
if(!s)
sscError(hError,szServerNameErrorPrefix,"No memory in rgpgGetAttribute()");
return s;
}
/* --------------------- rgpgFreeAttributeString ------------------------------ */
void RGPGAPI rgpgFreeAttributeString(sscErrorHandle hError,rgpgSessionID session,const char *attributeID,const char *extraAttrSpec,
char *attrString,int restype)
{
if(((restype == RGATTRTYPE_SPECIALALLOC) || (restype == RGATTRTYPE_MALLOCED)) && attrString)
free(attrString);
}
/*----------------------------------------rgpgSetAttribute---------------------------------------------*/
void RGPGAPI rgpgSetAttribute(sscErrorHandle hError, rgpgSessionID session, const char *attributeID, const char *extraAttrSpec, const char *value)
{
char buff[128]; mySession *sess = session;
if(!strcasecmp(attributeID,szVersion) || !strcasecmp(attributeID,szTitle) ||
!strcasecmp(attributeID,szThreadSafe) || !strcasecmp(attributeID,szUnloadable) ||
!strcasecmp(attributeID,szUnloadTime))
{
sscError(hError,szServerNameErrorPrefix,"Attempt to set read only attribute in rgpgSetAttribute()");
return;
}
if(!strcasecmp(attributeID,"User-Agent") && value)
{
sess->textonly = (strcasecmp(value,"Lynx") == 0) ? 1 : 0;
return;
}
if(!sess || sess->signature != sizeof(mySession))
{
sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgGetAttribute()");
return;
}
}
/*----------------------------------------rgpgGenerateReport---------------------------------------------*/
int RGPGAPI rgpgGenerateReport(sscErrorHandle hError, rgpgSessionID _session, int argc, char* argv[],char *rawCommandString, streamHandle result,
char *accessmask)
{
ssdb_Client_Handle client;
ssdb_Connection_Handle connection;
ssdb_Request_Handle req_handle;
ssdb_Error_Handle error_handle;
int i,cmdpsize,SQL_TYPE;
CMDPAIR cmdp[MAXNUMBERS_OF_KEYS];
mySession *session = _session;
if ((error_handle = ssdbCreateErrorHandle()) == NULL)
{
sscError(hError,"SSDB API Error %d: \"%s\" - can't create error handle\n",
ssdbGetLastErrorCode(0),ssdbGetLastErrorString(0));
return 0;
}
if ((client = ssdbNewClient(error_handle,szDefaultUserName,szDefaultPassword,0)) == NULL)
{
sscError(hError,"SSDB API Error %d: \"%s\" - can't create new client handle\n",
ssdbGetLastErrorCode(error_handle),ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
return 0;
}
/* Establish a connection to a database */
if ((connection = ssdbOpenConnection(error_handle,client,szDefaultHostName,szDefaultDatabaseName,0)) == NULL)
{
sscError(hError,"SSDB API Error %d: \"%s\" - can't open connection\n",
ssdbGetLastErrorCode(error_handle),ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
ssdbDeleteClient(error_handle,client);
return 0;
}
/* Initialize The HTML Generator */
i = createMyHTMLGenerator(result);
if (i != 0)
{
sscError(hError, "Sample server: Can't open the HTML generator");
ssdbDeleteErrorHandle(error_handle);
ssdbDeleteClient(error_handle,client);
ssdbCloseConnection (error_handle,connection);
return 0;
}
if (argc < 2)
{
sscError(hError, "Invalid Request\n");
ssdbDeleteErrorHandle(error_handle);
ssdbDeleteClient(error_handle,client);
ssdbCloseConnection (error_handle,connection);
return 0;
}
cmdpsize = sscInitPair(rawCommandString,cmdp,MAXNUMBERS_OF_KEYS);
/* Check WEB browser type (Lynx is only tex based) */
for(i = 0;(i = sscFindPairByKey(cmdp,i,szUserAgent)) >= 0;i++)
if(!strcasecmp(cmdp[i].value,"Lynx")) session->textonly = 1;
/* Availmon Setup */
if (!strcasecmp(argv[1],"AVAILMON_CONFIG"))
session->report_type = AVAILMON_CONFIG;
else if (!strcasecmp(argv[1],"AVAILMON_CONFIG_CONFIRM"))
session->report_type = AVAILMON_CONFIG_CONFIRM;
else if (!strcasecmp(argv[1],"AVAILMON_MAIL"))
session->report_type = AVAILMON_MAIL;
else if (!strcasecmp(argv[1],"AVAILMON_MAIL_CONFIRM"))
session->report_type = AVAILMON_MAIL_CONFIRM;
else if (!strcasecmp(argv[1],"GLOBALPAGE"))
session->report_type = GLOBALPAGE;
else if (!strcasecmp(argv[1],"GLOBALCONFIRM"))
session->report_type = GLOBALCONFIRM;
else
{
sscError(hError, "Invalid Report Request %s",argv[1]);
}
switch (session->report_type)
{
case AVAILMON_CONFIG:
availmon_config(hError,session,connection,error_handle);
break;
case AVAILMON_CONFIG_CONFIRM:
availmon_config_confirm(hError,session,connection,error_handle,cmdp);
break;
case AVAILMON_MAIL:
availmon_mail(hError,session,connection,error_handle,cmdp);
break;
case AVAILMON_MAIL_CONFIRM:
availmon_mail_confirm(hError,session,connection,error_handle,cmdp);
break;
case GLOBALPAGE:
global_setup(hError,session,connection,error_handle,cmdp);
break;
case GLOBALCONFIRM:
globalconfirm(hError,session,connection,error_handle,cmdp);
break;
}
/* Destroy The HTML Generator */
i = deleteMyHTMLGenerator();
if (i != 0)
{
sscError(hError, "Sample server: Can't destroy the HTML generator");
}
if (ssdbIsConnectionValid(error_handle,connection))
ssdbCloseConnection (error_handle,connection);
if (ssdbIsClientValid(error_handle,client))
ssdbDeleteClient(error_handle,client);
if (error_handle)
ssdbDeleteErrorHandle(error_handle);
return 0;
}
#if 0
<script language="JavaScript">
<!--
function showMap()
{ var map=window.open('help.html', 'help',
'width=650,height=350,status=yes,scrollbars=yes,resizable=yes');
map.main=self;
map.main.name="sss_main";
map.focus();
}
function isPosInt(inputVal)
{ inputStr = inputVal.toString()
for(i = 0;i < inputStr.length; i++)
{ oneChar = inputStr.charAt(i);
if(oneChar < "0" || oneChar > "9") return false;
}
return true;
}
function checkString(inputVal, fieldname)
{ inputStr = inputVal.toString()
for(i = 0;i < inputStr.length; i++)
{ oneChar = inputStr.charAt(i);
if(oneChar == "\"")
{ alert("String " + fieldname + " should not contain \"'s");
return false;
}
}
return true;
}
function clearForm(av_config_form) {
for(i = 0; i < av_config_form.av_autoemail.length; i++)
{ av_config_form.av_autoemail[i].checked = 0;
}
for(i = 0; i < av_config_form.av_shutdown.length; i++)
{ av_config_form.av_shutdown[i].checked = 0;
}
for(i = 0; i < av_config_form.av_hinv.length; i++)
{ av_config_form.av_hinv[i].checked = 0;
}
for(i = 0; i < av_config_form.av_sysmsg.length; i++)
{ av_config_form.av_sysmsg[i].checked = 0;
}
for(i = 0; i < av_config_form.av_uptimed.length; i++)
{ av_config_form.av_uptimed[i].checked = 0;
}
av_config_form.av_daysupdate.value = "";
av_config_form.av_lasttick.value = "";
av_config_form.av_tickduration.value = "";
}
function checkData(av_config_form)
{ var autoEmailChoice = -1;
var sutdownChoice = -1;
var hinvChoice = -1;
var msgChoice = -1;
var uptimedChoice = -1;
var statusUpdate = av_config_form.av_daysupdate.value;
av_config_form.av_daysupdate.focus();
var uptimeFile = av_config_form.av_lasttick.value;
av_config_form.av_lasttick.focus();
var uptimeCheck = av_config_form.av_tickduration.value;
av_config_form.av_tickduration.focus();
for(i = 0; i < av_config_form.av_autoemail.length; i++)
{ if(av_config_form.av_autoemail[i].checked)
autoEmailChoice = i;
}
for(i = 0; i < av_config_form.av_shutdown.length; i++)
{ if(av_config_form.av_shutdown[i].checked)
sutdownChoice = i;
}
for(i = 0; i < av_config_form.av_hinv.length; i++)
{ if(av_config_form.av_hinv[i].checked)
hinvChoice = i;
}
for(i = 0; i < av_config_form.av_sysmsg.length; i++)
{ if(av_config_form.av_sysmsg[i].checked)
msgChoice = i;
}
for(i = 0; i < av_config_form.av_uptimed.length; i++)
{ if(av_config_form.av_uptimed[i].checked)
uptimedChoice = i;
}
if(autoEmailChoice == -1 && sutdownChoice == -1 && hinvChoice == -1 && msgChoice == -1 && uptimedChoice ==-1 && statusUpdate == "" && uptimeFile == "" && uptimeCheck == "")
{ alert("Nothing to setup");
return false;
}
if(autoEmailChoice == -1)
{ alert("You must enable or disable automatic email distribution");
return false;
}
msg1 = "\n\nAutomatic e-mail distribution = " + av_config_form.av_autoemail[autoEmailChoice].value;
if(sutdownChoice == -1)
{ alert("You must enable or disable display of shutdown reason");
return false;
}
msg1 += "\nDisplay of shutdown reason = " + av_config_form.av_shutdown[sutdownChoice].value;
if(hinvChoice == -1)
{ alert("You must choose to include HINV information into e-mail or not")
return false;
}
msg1 += "\nInclude HINV information into e-mail = " + av_config_form.av_hinv[hinvChoice].value;
if(msgChoice == -1)
{ alert("You must enable or disable capturing of important system messages");
return false;
}
msg1 += "\nCapturing of important system messages = " + av_config_form.av_sysmsg[msgChoice].value;
if(uptimedChoice == -1)
{ alert("You must to choose to start uptime deamon or not");
return false;
}
msg1 += "\nStart uptime daemon = " + av_config_form.av_uptimed[uptimedChoice].value;
if(statusUpdate == "")
{ alert("You must enter number of days between status updates");
return false;
}
if(!isPosInt(statusUpdate) || statusUpdate > 300)
{ msg1 = "Incorrect entry for number of days between status updates\nMust be less or equal to 300 days";
alert(msg1);
return false;
}
msg1 += "\nNumber of days between status updates = " + statusUpdate;
if(uptimeFile == "")
{ uptimeFile = "/var/adm/avail/.save/lasttick";
document.av_config_form.av_lasttick.value = uptimeFile;
}
else {
if (!checkString(document.av_config_form.av_lasttick.value, "filename for last update write")) return false;
}
msg1 += "\nFilename for last uptime write = " + uptimeFile;
if(!isPosInt(uptimeCheck) || uptimeCheck > 600)
{ msg1 = "Incorrect entry for time interval between uptime check\nMust be less or equal to 600 seconds";
alert(msg1);
return false;
}
if(uptimeCheck == "")
{ uptimeCheck = "300";
document.av_config_form.av_tickduration.value = uptimeCheck;
}
msg1 += "\nInterval in seconds between uptime check = " + uptimeCheck;
return window.confirm("You entered the following configuration for Availmon Monitor setup:" + msg1);
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,227 @@
#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))
{
FormatedBody("%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)
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
return 0;
}
if(type)
{
if (sscanf(cmdp[key].value,"%d",intval) != 1)
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
return 0;
}
}
else
{
if (cmdp[key].value && cmdp[key].value[0])
strcpy(string,cmdp[key].value);
else
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
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)
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
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;
}

View File

@@ -0,0 +1,227 @@
#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
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@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
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@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
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@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
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@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;
}