ci_sendcmd

Synopsis

    #include "nortlib.h"
    #include "cmdalgo.h"
    
    int ci_sendcmd(const char *cmdtext, int mode);
    

Description

ci_sendcmd() is the basic method to send a command to a CMDGEN-generated Command Server. cmdtext is a NUL-terminated ASCII string. It should include any terminating newline (e.g. "Quit\n") or the command will not actually be executed. The string must conform to the syntax specified in the CMDGEN input for the particular server or a syntax error will occur.

If cmdtext is NULL, a syntax-independent quit request is sent to the server.

The mode argument takes on the following values:

CMDINTERP_SEND (0)
Execute the command and log it to memo via msg().
CMDINTERP_TEST (1)
Check the command for syntax only, but do not execute it or log it.
CMDINTERP_SEND_QUIET (2)
Execute the command but do not log it to memo.

Returns

Returns zero on success. If the command server cannot be located (and nl_response is set below 3) returns 1. Otherwise, the return value is the sum of a type code and a value. The possible types are CMDREP_QUIT, CMDREP_SYNERR and CMDREP_EXECERR. CMDREP_QUIT indicates that the command you sent was a quit request, which probably means the client should shut down also. CMDREP_SYNERR indicates there was a syntax error in the command you sent. The value portion of the return code is the offset within the command where the error occurred. CMDREP_EXECERR indicates that an error occurred when the server was executing the instructions associated with the command. The value portion of the return code is the error code.

See Also

ci_sendfcmd(), ci_settime(), ci_time_str(), and Command Server and Client functions.

Source File

/usr/local/src/nortlib/cic.c

Alphabetical List
Subject List
Return to Manuals Page
webmaster@huarp.harvard.edu
Copyright 2001 by the President and Fellows of Harvard College