test/test_physfs.c
changeset 74 a4a5066fb640
parent 72 ad828df14344
child 101 bd18e17ad6ad
equal deleted inserted replaced
73:96828990c739 74:a4a5066fb640
   570     do
   570     do
   571     {
   571     {
   572 #if (defined HAVE_READLINE)
   572 #if (defined HAVE_READLINE)
   573         buf = readline("> ");
   573         buf = readline("> ");
   574 #else
   574 #else
       
   575         int i;
   575         buf = malloc(512);
   576         buf = malloc(512);
   576         memset(buf, '\0', 512);
   577         memset(buf, '\0', 512);
   577         scanf("%s", buf);
   578         printf("> ");
       
   579         for (i = 0; i < 511; i++)
       
   580         {
       
   581             int ch = fgetc(stdin);
       
   582             if (ch == EOF)
       
   583             {
       
   584                 strcpy(buf, "quit");
       
   585                 break;
       
   586             } /* if */
       
   587             else if ((ch == '\n') || (ch == '\r'))
       
   588             {
       
   589                 buf[i] = '\0';
       
   590                 break;
       
   591             } /* else if */
       
   592             else if (ch == '\b')
       
   593             {
       
   594                 if (i > 0)
       
   595                     i--;
       
   596             } /* else if */
       
   597             else
       
   598             {
       
   599                 buf[i] = (char) ch;
       
   600             } /* else */
       
   601         } /* for */
   578 #endif
   602 #endif
       
   603 
   579         rc = process_command(buf);
   604         rc = process_command(buf);
   580         free(buf);
   605         free(buf);
   581     } while (rc);
   606     } while (rc);
   582 
   607 
   583     if (!PHYSFS_deinit())
   608     if (!PHYSFS_deinit())