+ if (script_file)
+ printf("using 'scripting' commands file %s\n", arg->script_cmds_file);
+ }
+
+ read_history(".history");
+
+ while(1) {
+
+ // If there is a script file
+ if (script_file) {
+
+ if (!fgets(script_cmd_buf, sizeof(script_cmd_buf), script_file)) {
+ fclose(script_file);
+ script_file = NULL;
+ } else {
+ char *nl;
+ nl = strrchr(script_cmd_buf, '\r');
+ if (nl)
+ *nl = '\0';
+
+ nl = strrchr(script_cmd_buf, '\n');
+
+ if (nl)
+ *nl = '\0';
+
+ int newlen = strlen(script_cmd_buf);
+ if ((cmd = (char*) malloc( newlen + 1)) != NULL) {
+ memset(cmd, 0x00, newlen);
+ strcpy(cmd, script_cmd_buf);
+ printf("%s\n", cmd);
+ }
+ }
+ } else {
+ cmd = readline(PROXPROMPT);