fixed use of short option 's', got rid of semicolon at end of file,
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 26 Feb 2003 17:58:53 +0000 (17:58 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 26 Feb 2003 17:58:53 +0000 (17:58 +0000)
only mess with /etc/comedi/calibrations directory if we are using
default save file location

comedi_calibrate/comedi_calibrate.c
comedi_calibrate/save_cal.c

index f4e537ff833ccaf94b52bed7f145dd5cde0bebe5..373eccb17d7d079ec76d3469c583b806cc82860d 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
 
        fn = "/dev/comedi0";
        while (1) {
-               c = getopt_long(argc, argv, "f:vq", options, &index);
+               c = getopt_long(argc, argv, "fs:vq", options, &index);
                if (c == -1)break;
                switch (c) {
                case 0:
index 3df09879e814809d7718f1e1f2e7f2d0dc8390fe..f2959ecd0b550a16d30ec96ea0caa99a70847975 100644 (file)
@@ -103,7 +103,7 @@ int write_calibration_perl_hash( FILE *file, comedi_t *dev,
                fprintf( file, ",\n" );
        }
        fprintf( file, "\t],\n"
-               "};\n");
+               "}\n");
 
        return 0;
 }
@@ -118,21 +118,21 @@ int write_calibration_file( calibration_setup_t *setup, saved_calibration_t sett
        struct stat file_stats;
        comedi_t *dev = setup->dev;
 
-       if( fstat( comedi_fileno( dev ), &file_stats ) < 0 )
+       if( setup->cal_save_file_path == NULL )
        {
-               fprintf( stderr, "failed to get file stats of comedi device file\n" );
-               return -1;
-       }
+               if( fstat( comedi_fileno( dev ), &file_stats ) < 0 )
+               {
+                       fprintf( stderr, "failed to get file stats of comedi device file\n" );
+                       return -1;
+               }
 
-       snprintf( command, sizeof( command ), "install -d %s", save_dir );
-       if( system( command ) )
-       {
-               fprintf( stderr, "failed to create directory %s\n", save_dir );
-               return -1;
-       }
+               snprintf( command, sizeof( command ), "install -d %s", save_dir );
+               if( system( command ) )
+               {
+                       fprintf( stderr, "failed to create directory %s\n", save_dir );
+                       return -1;
+               }
 
-       if( setup->cal_save_file_path == NULL )
-       {
                asprintf( &setup->cal_save_file_path, "%s/%s_0x%lx",
                        save_dir, comedi_get_board_name( dev ),
                        ( unsigned long ) file_stats.st_ino );