- while(1) {
- cmd = readline(PROXPROMPT);
- if (cmd) {
- if (cmd[0] != 0x00) {
- while(cmd[strlen(cmd) - 1] == ' ')
- cmd[strlen(cmd) - 1]= 0x00;
- CommandReceived(cmd);
- add_history(cmd);
- }
- free(cmd);
- } else {
- printf("\n");
- break;
- }
- }
+ read_history(".history");
+ while(1) {
+ cmd = readline(PROXPROMPT);
+ if (cmd) {
+ while(cmd[strlen(cmd) - 1] == ' ')
+ cmd[strlen(cmd) - 1] = 0x00;
+
+ if (cmd[0] != 0x00) {
+ if (strncmp(cmd, "quit", 4) == 0) {
+ break;
+ }
+
+ CommandReceived(cmd);
+ add_history(cmd);
+ }
+ free(cmd);
+ } else {
+ printf("\n");
+ break;
+ }
+ }
+
+ write_history(".history");