test/test_physfs.c
changeset 500 6de777c231e3
parent 495 51ca637c3a28
child 508 0e75524a96af
equal deleted inserted replaced
499:c362db7bb95f 500:6de777c231e3
   712 
   712 
   713 
   713 
   714 static int process_command(char *complete_cmd)
   714 static int process_command(char *complete_cmd)
   715 {
   715 {
   716     const command_info *i;
   716     const command_info *i;
   717     char *cmd_copy = malloc(strlen(complete_cmd) + 1);
   717     char *cmd_copy;
   718     char *args;
   718     char *args;
   719     int rc = 1;
   719     int rc = 1;
   720 
   720 
       
   721     if (complete_cmd == NULL)  /* can happen if user hits CTRL-D, etc. */
       
   722     {
       
   723         printf("\n");
       
   724         return(0);
       
   725     } /* if */
       
   726 
       
   727     cmd_copy = malloc(strlen(complete_cmd) + 1);
   721     if (cmd_copy == NULL)
   728     if (cmd_copy == NULL)
   722     {
   729     {
   723         printf("\n\n\nOUT OF MEMORY!\n\n\n");
   730         printf("\n\n\nOUT OF MEMORY!\n\n\n");
   724         return(0);
   731         return(0);
   725     } /* if */
   732     } /* if */
   875             } /* else */
   882             } /* else */
   876         } /* for */
   883         } /* for */
   877 #endif
   884 #endif
   878 
   885 
   879         rc = process_command(buf);
   886         rc = process_command(buf);
   880         free(buf);
   887         if (buf != NULL)
       
   888             free(buf);
   881     } while (rc);
   889     } while (rc);
   882 
   890 
   883     if (!PHYSFS_deinit())
   891     if (!PHYSFS_deinit())
   884         printf("PHYSFS_deinit() failed!\n  reason: %s.\n", PHYSFS_getLastError());
   892         printf("PHYSFS_deinit() failed!\n  reason: %s.\n", PHYSFS_getLastError());
   885 
   893