#include #include #include #include #include "definitions.h" #include "net.h" #define COMMAND_LENGTH 80 /* max length of a command. */ int main() { int i=1; int status=FAILURE; int number_of_terminators=1; char *command=NULL; char **reply=NULL; float DES_RA, DES_DEC=0; char NAME[20]="\0"; int ITEM=0; if ((command = (char *) calloc(COMMAND_LENGTH, sizeof(char)))==NULL) { fprintf(stderr, "*ERROR* failed to allocate command buffer!"); fflush(stderr); exit(EXIT_FAILURE); } if ((reply = (char **) calloc(COMMAND_LENGTH, sizeof(char *))) == NULL) { fprintf(stderr, "*ERROR* failed to allocate command buffer!"); fflush(stderr); exit(EXIT_FAILURE); } for (i=0; i 10)) { printf(" Entry out of range!\n"); exit(EXIT_FAILURE); } printf(" Enter the data for entry %d in the following form:\n", ITEM); printf(" AlfGem 112.8527 31.9998\n"); printf(" \n "); scanf("%s %f %f", NAME, &DES_RA, &DES_DEC); sprintf(command, "STAR %d,%.4f,%.4f,J,2000.0,1,S,\"%s\"", ITEM, DES_RA, DES_DEC, NAME); /* sprintf(command, "STAR %d,%.4f,%.4f,J,2000.0", ITEM, DES_RA, DES_DEC); */ printf("The command is \"%s\"\n", command); status = vrsi_command_tcpip(command, reply, (int) COMMAND_LENGTH,1,"10.212.212.121",5001); if (status != SUCCESS) { fprintf(stderr,"*ERROR* failed to send command %s\n", command); fflush(stderr); exit(EXIT_FAILURE); } if (reply != NULL) { printf("Received the reply:\n\t%s\n",reply[0]); } exit(EXIT_SUCCESS); }