fixed some bugs/unproper code

This commit is contained in:
zolliker
2005-03-04 09:44:12 +00:00
parent fc12b6b1c1
commit c706d655c8
5 changed files with 45 additions and 18 deletions

View File

@ -96,11 +96,12 @@ static int LcRead(long pc, LcDriv *me) {
EveWrite(eve, "X"); EveWrite(eve, "X");
FSM_NEXT FSM_NEXT
LcStatus(me); /* check for errors */ LcStatus(me); /* check for errors */
// if (!me->remote) goto skiprmt; /*
// EveWrite(eve, "C0"); if (!me->remote) goto skiprmt;
// me->remote = 0; EveWrite(eve, "C0");
// FSM_NEXT me->remote = 0;
FSM_NEXT
*/
skiprmt: skiprmt:
if (me->dig[1] < 0) goto skip1; if (me->dig[1] < 0) goto skip1;
EveWrite(eve, "R1"); /* read sensor 1 */ EveWrite(eve, "R1"); /* read sensor 1 */

View File

@ -145,9 +145,6 @@ int LoggerWrite(Logger *log, time_t now, int period, char *value) {
*/ */
strftime(stim, sizeof stim,"%H:%M:%S", tm); strftime(stim, sizeof stim,"%H:%M:%S", tm);
fprintf(fil, "%s\t%s%s\n", stim, value, buf); fprintf(fil, "%s\t%s%s\n", stim, value, buf);
// if (0 != strncmp(value, log->old, sizeof(log->old)) || buf[0]!='\0') { /* value has changed */
// log->pos = ftell(fil); /* next time append to the end */
// }
l = strlen(value); l = strlen(value);
if (l >= sizeof(log->old)) { if (l >= sizeof(log->old)) {
l = sizeof(log->old) - 1; l = sizeof(log->old) - 1;
@ -324,6 +321,7 @@ static void LoggerPut(Compressor *c, time_t t, char *value) {
int LoggerGraph(SConnection *pCon, SicsInterp *pSics, void *pData, int LoggerGraph(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]) { int argc, char *argv[]) {
time_t from, to, step, xs, lastt, now; time_t from, to, step, xs, lastt, now;
long lxs;
char *p; char *p;
int i, l, yday, iret, loss; int i, l, yday, iret, loss;
int inRange; int inRange;
@ -431,7 +429,7 @@ int LoggerGraph(SConnection *pCon, SicsInterp *pSics, void *pData,
if (p) { if (p) {
stp = p+1; stp = p+1;
*p='\0'; *p='\0';
iret = sscanf(stp, "%ld", &xs); iret = sscanf(stp, "%ld", &lxs); xs = lxs;
if (iret == 1) { if (iret == 1) {
if (xs < step) { if (xs < step) {
loss = 1; loss = 1;

View File

@ -1,6 +1,34 @@
# this makefile delegates to a version specific makefile # Forwards the execution to a version specific makefile.
# SICS_VERSION must be defined, else usage is printed
# M. Zolliker 03.2005
# where root is VERS_UNDEFINED=
S_UP=.. VERS_UNDEFINED$(SICS_VERSION)=version_undefined
INCL_MF=makefile_$(SICS_VERSION)
-include $(INCL_MF)
version_undefined:
@ echo ""
@ echo "Usage:"
@ echo ""
@ echo " make -f makefile_xxx [target]"
@ echo ""
@ echo ' where makefile_xxx is one of'
@ echo ""
@ ls -1 makefile_* | pr -t -o 4
@ echo ""
@ echo "Or, more convenient, define the following in the login script"
@ echo ""
@ echo " setenv SICS_VERSION version_xxx (assume we are using tcsh)"
@ echo ""
@ echo " where version_xxx is one of"
@ echo ""
@ ls -1 makefile_* | cut -b 10-99 | pr -t -o 4
@ echo ""
@ echo "and then use simply"
@ echo ""
@ echo " make [target]"
@ echo ""
include ../make_forward

View File

@ -182,7 +182,7 @@ static void writeSample(NXhandle hfil, NXdict hdict,
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static int PoldiStart(pPolterdi self, SConnection *pCon) static void PoldiStart(pPolterdi self, SConnection *pCon)
{ {
char pBueffel[256]; char pBueffel[256];
NXhandle hfil = NULL; NXhandle hfil = NULL;
@ -206,14 +206,14 @@ static int PoldiStart(pPolterdi self, SConnection *pCon)
{ {
SCWrite(pCon,"ERROR: Extra severe: failed to create data file name", SCWrite(pCon,"ERROR: Extra severe: failed to create data file name",
eError); eError);
return 0; return;
} }
/* create a Nexus file */ /* create a Nexus file */
NXopen(self->pFile,NXACC_CREATE,&hfil); NXopen(self->pFile,NXACC_CREATE,&hfil);
if(!hfil) if(!hfil)
{ {
SCWrite(pCon,"ERROR: cannot create data file ",eError); SCWrite(pCon,"ERROR: cannot create data file ",eError);
return 0; return;
} }
/* tell Uwe User what we are doing */ /* tell Uwe User what we are doing */
pVar = NULL; pVar = NULL;
@ -245,7 +245,7 @@ static int PoldiStart(pPolterdi self, SConnection *pCon)
SCWrite(pCon,"ERROR: This is a SERIOUS problem!",eError); SCWrite(pCon,"ERROR: This is a SERIOUS problem!",eError);
SCWrite(pCon,"ERROR: DATA NOT WRITTEN",eError); SCWrite(pCon,"ERROR: DATA NOT WRITTEN",eError);
NXclose(&hfil); NXclose(&hfil);
return 0; return;
} }

View File

@ -140,7 +140,7 @@ static int RemHandle(RemServer *remserver) {
return 0; return 0;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int RemCopy(RemServer *remserver, SConnection *pCon) { static void RemCopy(RemServer *remserver, SConnection *pCon) {
char buf[256]; char buf[256];
if (pCon != NULL && remserver->line[0] != '\0') { if (pCon != NULL && remserver->line[0] != '\0') {
snprintf(buf, sizeof(buf), " %s", remserver->line); snprintf(buf, sizeof(buf), " %s", remserver->line);