ARPDAS_QNX6 1.0
ci_cmdee.c
Go to the documentation of this file.
00001 /* ci_cmdee.c */
00002 
00003 #include <stdio.h>
00004 #include <unistd.h>
00005 #include <fcntl.h>
00006 #include <string.h>
00007 #include <errno.h>
00008 #include "nortlib.h"
00009 #include "nl_assert.h"
00010 #include "tm.h"
00011 
00012 /**
00013  * Initializes a read-only connection to the command server.  Returns the
00014  * file descriptor or -1. Errors are reported via nl_error with deference to
00015  * nl_response.
00016  */
00017 #define CMDEE_BUFSIZE 160
00018 int ci_cmdee_init( const char *cmd_node ) {
00019   char buf[CMDEE_BUFSIZE];
00020   int fd;
00021 
00022   nl_assert(cmd_node != NULL);
00023   snprintf(buf, CMDEE_BUFSIZE, "cmd/%s", cmd_node );
00024   fd = open( tm_dev_name(buf), O_RDONLY );
00025   if ( fd == -1 ) {
00026     if (nl_response)
00027       nl_error( nl_response, "Unable to open tm device %s: %s",
00028         buf, strerror(errno) );
00029   }
00030   return fd;
00031 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines