PREV TOC HOME INDEX NEXT


3.2 Error Handling Example

/* error handling routine */
void do_error( devh, funcname )  
int devh;
    char *funcname;
{
   int errorval = ATDV_LASTERR( devh );
   printf( "Error while calling function %s on device %s.  \n", funcname,
                    ATDV_NAMEP( devh ) );
   if ( errorval == E_MSSYSTEM ) {
       printf( "errno = %d\n", errno );
       perror("");
   } else {
       printf( "Error value = %d\n Error message = %s\n",
                    errorval,ATDV_ERRMSGP( devh ) );
   }
   return;
}  
main( )
{
         .
         .
         .
   /* call to Dialogic MSI/SC library function */
   if (ms_setevtmsk( devh, MSEV_SIGMSK, 0, DTA_SETMSK ) ) != 0) {
      do_error( devh, "ms_setevtmsk()" );
   }
   /* successful function call -
      continue processing ...  */
            .
            .
            .
}  
Notes:
1. Calls to ms_open( ) return either a -1 or a nonzero device handle. Therefore, when issuing the ms_open( ) function, check for a return of a -1. The specific error can be found in the global variable errno, contained in errno.h.
2. Calls to ATMS_TSSGBIT( ) return the pointer AT_FAILUREP when the function fails.


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2003, Intel Corporation
All rights reserved
This page generated January, 2003