Agilent Technologies 8714ET Switch User Manual


 
6-18 LAN Interface Supplement
Controlling the Analyzer via the LAN
Controlling the Analyzer with a C Program
char *query ;
/*********************************************************/
/* if the command has a '?' in it, use queryInstrument. */
/* otherwise, simply send the command. */
/* Actually, we must a little more specific so that */
/* marker value queries are treated as commands. */
/* Example: SENS:FREQ:CENT (CALC1:MARK1:X?) */
/*********************************************************/
if ( (query = strchr(cmd,'?')) != NULL)
{
/* Make sure we don't have a marker value query, or
* any command with a '?' followed by a ')' character.
* This kind of command is not a query from our point of view.
* The analyzer does the query internally, and uses the result.
*/
query++ ; /* bump past '?' */
while (*query)
{
if (*query == ' ') /* attempt to ignore white spc */
query++ ;
else break ;
}
if ( *query != ')' )
{
q = 1 ;
}
}
return q ;
}
/***************************************************************************
*
> $Function: main$
*
* $Description: Read command line arguments, and talk to analyzer.
Send query results to stdout. $
*
* $Return: (int) . . . non-zero if an error occurs
*
***************************************************************************/
int main(int argc, char *argv[])
{
SOCKET instSock;
char *charBuf = (char *) malloc(INPUT_BUF_SIZE);
char *basename;
int chr;
char command[1024];
char *destination;
unsigned char quiet = 0;
unsigned char show_errs = 0;
int number = 0;
basename = strrchr(argv[0], '/');
if (basename != NULL)
basename++ ;