*** ls.c.orig	Mon Jul 19 23:24:25 1999
--- ls.c.new	Mon Jul 19 23:24:00 1999
***************
*** 38,39 ****
--- 38,44 ----
  
+ /* modified on Apr 17 1999 by weasel
+    Peter Palfrader <ppalfrad@cosy.sbg.ac.at>
+    
+    with -M filesizes are now print like 1_234_567 to make life easier */
+ 
  #ifdef _AIX
*************** static int trace_links;
*** 422,423 ****
--- 427,434 ----
  
+ /* weasel add on Apr 17 1999 */
+ static int easy_to_read_file_length;
+ /* Nonzero means that file length is outputted more readable with
+    an underscore every 3 chars.  -M */
+ /* end of addition */
+ 
  static int trace_dirs;
*************** main (int argc, char **argv)
*** 701,702 ****
--- 712,716 ----
  	      GNU_PACKAGE, VERSION);
+       /* weasel add on Apr 17 1999 */
+       printf ("\nmodified by Weasel (Peter Palfrader<ppalfrad@cosy.sbg.ac.at>) \n -M added. this prints filesizes a more readable way.\n");
+       /* end of addition */
        close_stdout ();
*************** decode_switches (int argc, char **argv)
*** 852,853 ****
--- 866,868 ----
    trace_links = 0;
+   easy_to_read_file_length = 0;
    trace_dirs = 0;
*************** decode_switches (int argc, char **argv)
*** 907,910 ****
  
    while ((c = getopt_long (argc, argv,
! 			   "abcdefghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
  			   long_options, NULL)) != -1)
--- 922,926 ----
  
+ /*weasel changed on Apr 17 1999        -- added M*/
    while ((c = getopt_long (argc, argv,
! 			   "abcdefghiklmnopqrstuvw:xABCDFGHI:LMNQRST:UX1",
  			   long_options, NULL)) != -1)
*************** decode_switches (int argc, char **argv)
*** 1062,1063 ****
--- 1078,1085 ----
  
+ /*weasel added on Apr 17 1999*/
+ 	case 'M':
+ 	  easy_to_read_file_length=1;
+ 	  break;
+ /*end of addition*/
+ 
  	case 'Q':
*************** print_long_format (const struct fileinfo
*** 2282,2287 ****
      {
!       char hbuf[LONGEST_HUMAN_READABLE + 1];
!       sprintf (p, "%8s ",
! 	       human_readable ((uintmax_t) f->stat.st_size, hbuf, 1,
! 			       output_block_size < 0 ? output_block_size : 1));
      }
--- 2304,2370 ----
      {
!       /* weasel modification on Apr 17 1999.
! 	 original code:
! 
!          char hbuf[LONGEST_HUMAN_READABLE + 1];
!          sprintf (p, "%8s ",
! 	          human_readable ((uintmax_t) f->stat.st_size, hbuf, 1,
! 			          output_block_size < 0 ? output_block_size : 1));
!       */
!       if (!easy_to_read_file_length)
! 	{
! 	  char hbuf[LONGEST_HUMAN_READABLE + 1];
! 	  sprintf (p, "%8s ",
! 		   human_readable ((uintmax_t) f->stat.st_size, hbuf, 1,
! 				   output_block_size < 0 ? output_block_size : 1));
! 	}
!       else
! 	{
! 	  /* a Quick and dirty implementation of i2a */
! 	  char hbuf[14]; /* hope that's long enough */
! 	  long size = f->stat.st_size;
! 	  
! 	  int index;
! 	  int indexerror = 0;
! 
! 	  for (index=0; index<13; index++)
! 	    {
! 	      hbuf[index] = ' ';
! 	    };
! 	  hbuf[13] = '\0';
! 	  
! 	  index = 12;
! 
! 	  if (!size)
! 	    {
! 	      hbuf[index] = '0';
! 	    }
! 	  else
! 	    {
! 	      int digits_to_underscore = 3;
! 	      while ((size) && (!indexerror))
! 		{
! 		  if (!(digits_to_underscore--))
! 		    {
! 		      if (index>=0) { hbuf[index--] = '_'; }
! 		      else          { indexerror = 1; };
! 		      digits_to_underscore = 2;
! 		    };
! 		  if (index>=0) { hbuf[index--] = 48 + (size % 10); }
! 		  else          { indexerror = 1; };
! 		  size = size / 10;
! 		};
! 	    };
! 	  if (!indexerror)
! 	    {
! 	      sprintf (p, "%s ", hbuf);
! 	    }
! 	  else
! 	    { /* do the original thing. this has been tested and looked at a 1000 times */
! 	      char hbuf[LONGEST_HUMAN_READABLE + 1];
! 	      sprintf (p, "%8s ",
! 		       human_readable ((uintmax_t) f->stat.st_size, hbuf, 1,
! 				       output_block_size < 0 ? output_block_size : 1));
! 	    };
! 	};
!       /* end of modification */
      }
