OpenCores
URL https://opencores.org/ocsvn/mlite/mlite/trunk

Subversion Repositories mlite

[/] [mlite/] [trunk/] [kernel/] [netutil.c] - Diff between revs 336 and 339

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 336 Rev 339
Line 698... Line 698...
 
 
 
 
static void ConsoleLs(IPSocket *socket, char *argv[])
static void ConsoleLs(IPSocket *socket, char *argv[])
{
{
   FILE *file;
   FILE *file;
   char buf[200];
   char buf[200], buf2[80];
   int bytes;
   int bytes, width;
 
 
   file = fopen(argv[1], "r");
   file = fopen(argv[1], "r");
   if(file == NULL)
   if(file == NULL)
      return;
      return;
 
   width = 0;
   for(;;)
   for(;;)
   {
   {
      bytes = OS_fdir(file, buf);
      bytes = OS_fdir(file, buf);
      if(bytes)
      if(bytes)
         break;
         break;
      strcat(buf, "  ");
      if(buf[0] == 255)
      IPWrite(socket, (uint8*)buf, (int)strlen(buf));
         continue;
 
      bytes = OS_flength(buf);
 
      sprintf(buf2, "%s:%d                    ", buf, bytes);
 
      bytes = strlen(buf2);
 
      bytes -= bytes % 20;
 
      buf2[bytes] = 0;
 
      width += bytes;
 
      if(width == 80)
 
         --bytes;
 
      if(width > 80)
 
      {
 
         IPPrintf(socket, "\n");
 
         width = bytes;
 
      }
 
      IPWrite(socket, (uint8*)buf2, bytes);
   }
   }
   fclose(file);
   fclose(file);
}
}
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.