#include <stdio.h>
#include <stdlib.h>

#ifdef __unix__
      #include <sys/stat.h>
      #include <sys/types.h>
#elif __MSDOS__
      #include <sys\stat.h>
#endif

int main(int argc, char *argv[])
{
 struct stat attribut;
 unsigned long sizeofall=0;

 if(argc == 1)
  {
   if(stat(*argv, &attribut) == -1)
    {
     fprintf(stderr,"Fehler bei stat....\n");
     exit (1);
    }
   else
    {
     printf("Größe von %s = %ld Bytes\n",*argv,attribut.st_size);
     exit (1);
    }
  }
 else
  {
   while(*++argv)
    {
     if(stat(*argv, &attribut) == -1)
      {
       fprintf(stderr,"Fehler bei stat....\n");
       exit (1);
      }
     else
      {
       printf("Größe von %s = %ld Bytes\n",*argv,attribut.st_size);
       sizeofall+=attribut.st_size;
      }
    }/*Ende while*/
  }/*Ende else*/
 printf("Größe aller Dateien in der Kommandozeile = %ld Bytes",sizeofall);
 printf("= %ld KB\n",sizeofall/=1024);
 return 0;
}