Here's a context-diff patch for gmod 2.0.1 which adds in the -C option.
It checks (uncompressed) songs to see if their length matches what gmod
read in.  If the file is longer (has garbage tacked onto the end), the
program moves the song to <filename>.old, then strips off the garbage.
The -C option is really only useful for cleaning up stuff that you've
ripped.

--Alexander Mohr

--begin included file--
*** gmod.c	Sat Apr  8 07:17:43 1995
--- ../ngmod/gmod.c	Sun Apr 23 12:02:19 1995
***************
*** 104,113 ****
    struct song_info song_char;
  #ifdef USE_X
    struct options_info options =
!   {255, 0, 1, 1, 0, 0, 0, 255, 0, 0, 100, 0};
  #else
    struct options_info options =
!   {255, 0, 0, 1, 1, 0, 0, 0, 255, 0, 0, 100, 0};
  #endif
    struct options_info saved_opt;
  #ifndef USE_X
--- 104,113 ----
    struct song_info song_char;
  #ifdef USE_X
    struct options_info options =
!   {255, 0, 1, 1, 0, 0, 0, 255, 0, 0, 100, 0, 0};
  #else
    struct options_info options =
!   {255, 0, 0, 1, 1, 0, 0, 0, 255, 0, 0, 100, 0, 0};
  #endif
    struct options_info saved_opt;
  #ifndef USE_X
*** load_mod.c	Sat Apr  8 07:17:43 1995
--- ../ngmod/load_mod.c	Sun Apr 23 12:41:47 1995
***************
*** 570,584 ****
    else
      ret_val = load_mod_module (mod_fd, name, song_char, options, header);
  
    if (compressed == MY_FALSE)
!     fclose (mod_fd);
    else
      {
        free (command);
        free (fixedname);		/* added by Peter Federighi */
        pclose (mod_fd);
      }
! 
    if (!ret_val)
      free_patterns (0);
    else
--- 572,658 ----
    else
      ret_val = load_mod_module (mod_fd, name, song_char, options, header);
  
+ 
    if (compressed == MY_FALSE)
!     {
!       if ( feof( mod_fd ) )
! 	{
! 	  fprintf( stderr, "Error: EOF Encountered.\n" );
! 	  fclose( mod_fd );
! 	}
!       else if ( options.check_only )  /* Added by Alexander Mohr */
! 	{
! 	  int true_length;
! 	  int is_eof;
! 	  
! 	  true_length = ftell( mod_fd );
! 	  fgetc( mod_fd );
! 	  is_eof = feof( mod_fd );
! 	  fprintf( stdout, "%s   Length: %7d\n",
! 		  is_eof ? "Check Passed" : "Check FAILED",
! 		  true_length );
! 	  fclose (mod_fd);
! 	  if ( !is_eof )
! 	    {
! 	      char tmp_name[400];
! 	      printf( "Attempting to fix %s...\n", name );
! 	      sprintf( tmp_name, "%s.old", name );
! 	      if ( link( name, tmp_name ) != 0 )
! 		{
! 		  printf( "Unable to link %s to %s.\n", name, tmp_name );
! 		}
! 	      else if ( unlink( name ) != 0 )
! 		{
! 		  printf( "Unable to unlink %s.\n", name );
! 		}
! 	      else
! 		{
! 		  unsigned char *storage;
! 		  storage = (unsigned char *)malloc( true_length * sizeof( unsigned char ) );
! 		  if ((mod_fd = fopen (tmp_name, "rb")) == NULL)
! 		    {
! 		      printf( "Unable to open %s.\n", tmp_name );
! 		    }
! 		  else if ( fread( storage, sizeof( unsigned char ), true_length, mod_fd )
! 			   != true_length )
! 		    {
! 		      printf( "Unable to read %d from %s.\n", true_length, tmp_name );
! 		    }
! 		  else
! 		    {
! 		      fclose( mod_fd );
! 		      if ((mod_fd = fopen (name, "wb")) == NULL)
! 			{
! 			  printf( "Unable to open %s for writing.\n", name );
! 			}
! 		      else if ( fwrite( storage, sizeof( unsigned char ), true_length, mod_fd )
! 			       != true_length )
! 			{
! 			  printf( "Unable to write %d to %s.\n", true_length, name );
! 			}
! 		      else
! 			{
! 			  fclose( mod_fd );
! 			  printf( "%s successfully fixed.\n", name );
! 			}
! 		    }
! 		  free( storage );
! 		}
! 	    }
! 	  ret_val = 0;
! 	}
!       else
! 	{
! 	  fclose (mod_fd);
! 	}
!     }
    else
      {
        free (command);
        free (fixedname);		/* added by Peter Federighi */
        pclose (mod_fd);
      }
!   
    if (!ret_val)
      free_patterns (0);
    else
*** parse.c	Sat Apr  8 07:17:44 1995
--- ../ngmod/parse.c	Sun Apr 23 11:59:16 1995
***************
*** 26,34 ****
    int option, num_err = 0;
  
  #ifdef USE_X
!   while ((option = getopt (argc, argv, "chP:rRv:")) != -1)
  #else
!   while ((option = getopt (argc, argv, "bcehlm:pP:qrRsv:xz5")) != -1)
  #endif
      switch (option)
        {
--- 26,34 ----
    int option, num_err = 0;
  
  #ifdef USE_X
!   while ((option = getopt (argc, argv, "cChP:rRv:")) != -1)
  #else
!   while ((option = getopt (argc, argv, "bcCehlm:pP:qrRsv:xz5")) != -1)
  #endif
      switch (option)
        {
***************
*** 42,47 ****
--- 42,48 ----
  	printf ("     -b     DISABLE BPM tempos\n");
  #endif
  	printf ("     -c     DISABLE compression of modules in memory\n");
+ 	printf ("     -C     Check and fix mod length (doesn't play songs)\n");
  #ifndef USE_X
  	printf ("     -e     Show empty samples (for messages)\n");
  #endif
***************
*** 74,79 ****
--- 75,83 ----
  	break;
        case 'c':
  	options->compress = 0;
+ 	break;
+       case 'C':
+ 	options->check_only = 1;
  	break;
        case 'e':
  	options->show_empty_samples = 1;
*** structs.h	Sat Apr  8 07:17:44 1995
--- ../ngmod/structs.h	Sun Apr 23 12:02:23 1995
***************
*** 121,126 ****
--- 121,127 ----
    unsigned char randomize;
    signed char pan_factor;
    unsigned char use_50hz;
+   unsigned char check_only;
  };
  
  struct sample_info
--end--



