www.pudn.com > vxWorks_Lab.rar > fantasyLib.c
/* fantasyLib.c - example use of error codes */
#include "vxWorks.h"
#include "fantasyLib.h"
#include "stdio.h"
#include "errno.h"
#include "string.h"
int fantasyCurrent;
STATUS fantasySet
(
int dream,
char *world
)
{
if (dream < 0)
{
errno = S_fantasyLib_INVALID_DREAM;
perror("This time");
return (ERROR);
}
/* Boring fantasies. Must be on earth */
if (strcmp("Earth", world))
{
errno = S_fantasyLib_UNKNOWN_WORLD;
perror("This time");
return (ERROR);
}
fantasyCurrent = (dream - 32) * 100/180;
return (OK);
}