Chapter 9 Putting It All Together: An X9.31 Example 325

The X9.31 Sample Program
Surrendering Control

The following function, included as part of x931.c, can be used whenever an action

may take a long time, and you need a mechanism for surrendering control.

/* General Surrender Function */
/* ========================== */
int GeneralSurrenderFunction (handle)
POINTER handle;
{
char s[100];
static time_t currentTime;
time_t getTime;
if ((int)*handle == 0) {
getTime = time(NULL);
strftime (s, 100, "%H:%M:%S on %A, %d %B %Y", localtime(&getTime));
printf ("\n%s\n", s);
printf ("Surrender function ...\n");
*handle = 1;
time (&currentTime);
}
else {
time (&getTime);
if (currentTime != getTime) {
printf (" .");
currentTime = getTime;
}
}
return (0);
} /* end GeneralSurrenderFunction */