home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.lbl.gov / 2014.05.ftp.ee.lbl.gov.tar / ftp.ee.lbl.gov / sst.tar.Z / sst.tar / sst / ulawtolin.c < prev    next >
C/C++ Source or Header  |  1990-01-10  |  977b  |  49 lines

  1. /* ulawtolin.c - convert ulaw to linear
  2. **
  3. ** Copyright (C) 1989 by Jef Poskanzer.
  4. **
  5. ** Permission to use, copy, modify, and distribute this software and its
  6. ** documentation for any purpose and without fee is hereby granted, provided
  7. ** that the above copyright notice appear in all copies and that both that
  8. ** copyright notice and this permission notice appear in supporting
  9. ** documentation.  This software is provided "as is" without express or
  10. ** implied warranty.
  11. */
  12.  
  13. #include <stdio.h>
  14. #include "libst.h"
  15.  
  16. main( argc, argv )
  17. int argc;
  18. char *argv[];
  19.     {
  20.     FILE *f;
  21.     double atof();
  22.     int c, lc;
  23.  
  24.     if ( argc == 1 )
  25.     f = stdin;
  26.     else if ( argc == 2 )
  27.     {
  28.     f = fopen( argv[1], "r" );
  29.     if ( f == NULL )
  30.         {
  31.         perror( argv[1] );
  32.         exit( 1 );
  33.         }
  34.     }
  35.     else
  36.     {
  37.     fprintf( stderr, "usage:  %s [<file>]\n", argv[0] );
  38.     exit( 1 );
  39.     }
  40.  
  41.     while ( (c = getc( f )) != EOF )
  42.     {
  43.     lc = st_ulaw_to_linear( c );
  44.     printf( "%d\n", lc );
  45.     }
  46.  
  47.     exit( 0 );
  48.     }
  49.