Remove superfluous trailing white space from C files

This commit is contained in:
Douglas Clowes
2014-05-16 15:48:41 +10:00
parent 1881907e00
commit 4c65f82116
91 changed files with 1313 additions and 1313 deletions

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
S E R I A L S I N Q
Implementation file of the functions for talking with a RS--232 port
on a SINQ terminal server. This code has been adapted from code
provided by David Maden for the EL734 motor controller. A new version
became necessary as the Dornier velocity selector supports a
on a SINQ terminal server. This code has been adapted from code
provided by David Maden for the EL734 motor controller. A new version
became necessary as the Dornier velocity selector supports a
completely different protocoll than the EL734. The basics, however, are
the same.
Mark Koennecke, Juli 1997
Copyright:
@@ -90,7 +90,7 @@
struct RS__MsgStruct to_host;
struct RS__RespStruct from_host;
SerialSleep pFunc;
void *pData;
void *pData;
struct AsynSrv__info sAsync;
};
/*------------------- The default sleep function -----------------------*/
@@ -115,9 +115,9 @@
//struct RS__RplyStruct *rply_ptr;
*pData = NULL;
/*
** allocate memory first
** allocate memory first
*/
*pData = malloc (sizeof (struct SerialInfo));
if (*pData == NULL) {
@@ -138,7 +138,7 @@
}
/* intialize data structures */
StrJoin (my_info->host, sizeof (my_info->host), pHost, "");
StrJoin (my_info->host, sizeof (my_info->host), pHost, "");
my_info->skt = my_info->sAsync.skt;
my_info->port = iPort;
my_info->chan = iChannel;
@@ -176,8 +176,8 @@
}
my_info = *pData;
memset(my_info,0,sizeof(struct SerialInfo));
/*
**-------------------------- Set up the connection
*/
@@ -190,7 +190,7 @@
}
/* intialize data structures */
StrJoin (my_info->host, sizeof (my_info->host), pHost, "");
StrJoin (my_info->host, sizeof (my_info->host), pHost, "");
my_info->skt = my_info->sAsync.skt;
my_info->port = iPort;
my_info->chan = iChannel;
@@ -209,10 +209,10 @@
int SerialConfig(void **pData, int iTmo)
{
struct SerialInfo *my_info = NULL;
my_info = (struct SerialInfo *)*pData;
assert(my_info);
if(iTmo < 100)
{
my_info->tmo = 1;
@@ -224,20 +224,20 @@
if(my_info->tmo > 9999)my_info->tmo = 9999;
}
return 1;
}
}
/*--------------------------------------------------------------------------*/
int GetSerialTmo(void **pData)
{
struct SerialInfo *my_info = NULL;
int iTmo;
my_info = (struct SerialInfo *)*pData;
assert(my_info);
iTmo = my_info->tmo*100-99; /* convert back to milli seconds */
return iTmo;
}
}
int SerialGetTmo(void **pData)
{
return GetSerialTmo(pData);
@@ -247,14 +247,14 @@
{
struct SerialInfo *my_info = NULL;
// int iTmo;
my_info = (struct SerialInfo *)*pData;
assert(my_info);
return my_info->skt;
return my_info->skt;
return 1;
}
}
/*--------------------------------------------------------------------------*/
int SerialClose(void **pData)
{
@@ -295,14 +295,14 @@
int SerialATerm(void **pData, char *pTerm)
{
struct SerialInfo *my_info = NULL;
my_info = (struct SerialInfo *)*pData;
if(my_info == NULL)
{
printf("Serious Programming problem: data = NULL\n");
return 0;
}
/* only three characters in this field */
if(strlen(pTerm) > 4)
{
@@ -310,39 +310,39 @@
}
memset(my_info->pTerms,0,4);
strcpy(my_info->pTerms,pTerm);
return 1;
}
}
/*--------------------------------------------------------------------------*/
int SerialAGetTerm(void **pData, char *pTerm, int iTermLen)
{
struct SerialInfo *my_info = NULL;
my_info = (struct SerialInfo *)*pData;
assert(my_info);
strncpy(pTerm,my_info->pTerms,iTermLen);
return 1;
}
}
/*-------------------------------------------------------------------------*/
int SerialSendTerm(void **pData, char *pTerm)
{
struct SerialInfo *my_info = NULL;
my_info = (struct SerialInfo *)*pData;
assert(my_info);
/* only 0 characters in this field */
if(strlen(pTerm) > 9)
{
return 0;
}
strcpy(my_info->pSendTerm,pTerm);
return 1;
}
}
/*---------------------------------------------------------------------------*/
int SerialSend(void **pData, char *pCommand)
@@ -400,16 +400,16 @@
}else {
strcpy (cmnd_lst_ptr+4, txt_ptr);
/* make sure that the string is properly terminated */
if((strstr(txt_ptr,info_ptr->pSendTerm) == 0) &&
if((strstr(txt_ptr,info_ptr->pSendTerm) == 0) &&
(strlen(txt_ptr) > 0) )
{
strcpy(cmnd_lst_ptr+4+strlen(txt_ptr),info_ptr->pSendTerm);
c_len = strlen(txt_ptr) + strlen(info_ptr->pSendTerm);
c_len = strlen(txt_ptr) + strlen(info_ptr->pSendTerm);
}
else
{
c_len = strlen (txt_ptr);
}
}
sprintf (text, "%4.4d", c_len);
memcpy (cmnd_lst_ptr, text, 4);
cmnd_lst_ptr = cmnd_lst_ptr + c_len + 4;
@@ -445,7 +445,7 @@
int SerialReceive(void **pData, char *pBuffer, int iBufLen)
{
struct SerialInfo *info_ptr;
int status;//, c_len,
int status;//, c_len,
int size, max_size; //, ncmnds;
int bytes_to_come, bytes_left;
int iResult;
@@ -458,7 +458,7 @@
//long lMask = 0L;
//struct timeval tmo = {0,1};
/*
** Do nothing if no connection - the connection gets
** closed if an error is detected.
@@ -478,7 +478,7 @@
if(status <= 0)
{
return SELECTFAIL;
}
}
*/
/* try read the message length to come */
@@ -492,8 +492,8 @@
else if (status == -1) {
iResult = EL734__BAD_RECV_NET; /* It's some other net problem */
}
else
{
else
{
iResult = EL734__BAD_RECV_NET;
}
AsynSrv_Close (&(info_ptr->sAsync),1);
@@ -564,11 +564,11 @@
return True;
}
/*-------------------------------------------------------------------------*/
int SerialReceiveWithTerm(void **pData, char *pBuffer,
int SerialReceiveWithTerm(void **pData, char *pBuffer,
int iBufLen, char *cTerm )
{
struct SerialInfo *info_ptr;
int status;//, c_len,
int status;//, c_len,
int size, max_size;//, ncmnds;
int bytes_to_come, bytes_left;
int iResult;
@@ -581,7 +581,7 @@
//long lMask = 0L;
//struct timeval tmo = {0,1};
/*
** Do nothing if no connection - the connection gets
** closed if an error is detected.
@@ -601,7 +601,7 @@
if(status <= 0)
{
return SELECTFAIL;
}
}
*/
/* try read the message length to come */
@@ -615,8 +615,8 @@
else if (status == -1) {
iResult = EL734__BAD_RECV_NET; /* It's some other net problem */
}
else
{
else
{
iResult = EL734__BAD_RECV_NET;
}
AsynSrv_Close (&(info_ptr->sAsync),1);
@@ -687,7 +687,7 @@
}
return True;
}
/*---------------------------------------------------------------------------*/
int SerialError(int iErr, char *pBuffer, int iBufLen)
{
@@ -702,10 +702,10 @@
break;
case -301:
strncpy(pBuffer,"No reply found", iBufLen);
break;
break;
case -100:
strncpy(pBuffer,"No reply found", iBufLen);
break;
break;
case EL734__BAD_ADR:
strncpy(pBuffer,"SERIAL__BAD_ADR",iBufLen);
break;
@@ -745,7 +745,7 @@
case EL734__BAD_PAR:
strncpy(pBuffer,"SERIAL__BAD_PAR",iBufLen);
break;
case EL734__BAD_RECV:
strncpy(pBuffer,"SERIAL__BAD_RECV",iBufLen);
break;
@@ -800,24 +800,24 @@
case OPENFAILURE:
strncpy(pBuffer,
"FAILED to open connection to serial port server", iBufLen);
break;
break;
default:
strcpy(pBuffer,"Unknown SERIAL error");
break;
break;
}
return 1;
}
/*---------------------------------------------------------------------------*/
int SerialWriteRead(void **pData, char *pCommand,
int SerialWriteRead(void **pData, char *pCommand,
char *pBuffer, int iBufLen)
{
struct SerialInfo *pInfo = NULL;
int iRet;
time_t tTarget, tCurrent;
pInfo = (struct SerialInfo *)*pData;
/* write */
iRet = SerialSend(pData,pCommand);
if(iRet != 1)
@@ -825,11 +825,11 @@
SerialError(iRet, pBuffer,iBufLen);
return iRet;
}
/* check for answers for maximum time out */
tTarget = tCurrent = time(&tCurrent);
tTarget += pInfo->tmo*100 - 90;
while(tCurrent < tTarget)
{
pInfo->pFunc(pInfo->pData, 100);
@@ -843,27 +843,27 @@
return iRet;
}
}
else
else
{
return 1; /* there is data read, we are done */
}
tCurrent = time(&tCurrent);
}
return TIMEOUT;
}
}
/*---------------------------------------------------------------------------*/
int SerialNoReply(void **pData, char *pCommand)
{
struct SerialInfo *pInfo = NULL;
int iRet, iOld, i;
char pBuffer[30];
pInfo = (struct SerialInfo *)*pData;
iOld = pInfo->tmo;
pInfo->tmo = 0;
/* write */
iRet = SerialSend(pData,pCommand);
if(iRet != 1)
@@ -871,7 +871,7 @@
pInfo->tmo = iOld;
return iRet;
}
/* try some time to find a TMO */
for(i = 0 ; i < 10; i++)
{
@@ -888,19 +888,19 @@
}
pInfo->tmo = iOld;
return 1;
}
}
/*-------------------------------------------------------------------------*/
void SetSerialSleep(void **pData, SerialSleep pFun, void *pUserData)
{
struct SerialInfo *pInfo = NULL;
// int iRet;
pInfo = (struct SerialInfo *)*pData;
pInfo->pFunc = pFun;
pInfo->pData = pUserData;
}
pInfo->pData = pUserData;
}