/*
-* Changes by Boris:
+* Changes by Boris and Jan:
*
* 1. Original code is in a sub-routine called start()
-* 2. usage has a tcp parameter
-* 3. main() can enter a tcp loop or just call start()
+* 2. main() can enter a tcp loop (if called with attribute \"tcp\") or just call start() (otherwise)
+*
*
*/
static int hexMode = HEXMODE;
-static const char trbcmd_version[] = "$Revision: 2.40 $";
+static const char trbcmd_version[] = "$Revision: 2.41 $";
/* ---- User Buffer Size ----------------------------------------------- */
fprintf(STDOUT, "Usage: %s [-h] [-f script-file] [-n number] [-d level] "
"[-H] [-V] <COMMAND>\n", progName);
fprintf(STDOUT, "Options:\n");
+ fprintf(STDOUT, " --tcp start in TCP/IP-server mode (!)\n");
fprintf(STDOUT, " -h give this help\n");
- fprintf(STDOUT, " -tcp start in TCP/IP-server mode (!)\n");
fprintf(STDOUT, " -f execute commands given in script-file\n");
fprintf(STDOUT, " -n repeat COMMAND number times, -1 = endless loop\n");
fprintf(STDOUT, " -M turn on HighMemoryMode (maximum usage is 20MByte, default: "
trb_strterm(trb_term));
}
}
-
-//<<<<<<< trbcmd.c
-// for (i = 0; i < status; i += 2) {
-// fprintf(STDOUT, "0x%04x 0x%08x\n",
-// data[i], data[i + 1]);
-// }
-
- /* Check Status-Bits */
- /////////////////////////////////////////////////////////////////////////////////
- // BORIS for the HUB:
- /*if ((trb_term.status_common != 0x01) ||
- (trb_term.status_channel != 0)) {
- if (scriptFile != NULL) {
- fprintf(STDERR, "Line #%d: ", lineCtr);
- }
- fprintf(STDERR, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term));
- }*/
- //end BORIS /////////////////////////////////////////////////////////////////////
-//=======
free(data);
-//>>>>>>> 2.39
} else if (strncmp(cmd[0], "rm", CMD_SIZE) == 0) {
reg_address + i, *p++);
}
}
-//<<<<<<< trbcmd.c
-// }
-
- /* Check Status-Bits */
- /////////////////////////////////////////////////////////////////////////////////
- // BORIS for the HUB:
- /*if ((trb_term.status_common != 0x01) ||
- (trb_term.status_channel != 0)) {
- if (scriptFile != NULL) {
- fprintf(STDERR, "Line #%d: ", lineCtr);
-//=======
-
/* Check Status-Bits */
if ((trb_term.status_common != 0x01) ||
(trb_term.status_channel != 0)) {
}
fprintf(STDERR, "WARNING Status-Bits:\n%s\n",
trb_strterm(trb_term));
-//>>>>>>> 2.39
}
-//<<<<<<< trbcmd.c
-// fprintf(STDERR, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term));
-// }*/
- /////////////////////////////////////////////////////////////////////////////////
-// if (data != NULL) free(data);
-//=======
}
-
free(data);
-//>>>>>>> 2.39
} else if (strncmp(cmd[0], "wm", CMD_SIZE) == 0) {
/*******************************************/
- if (argc == 2 && strcmp(argv[1], "tcp") == 0){
+ if (argc == 2 && strcmp(argv[1], "--tcp") == 0){
// TCP/IP SERVER INIT
// Init values and memory
//***********************
int mainStatus = 1;
- int len, bytes_sent;
char command[256];
int bytes_got;
int status = 1;
- int i,j;
- char buffer[32];
- char response[256000];
// Enter an infinite loop
// to acquire instructions