From 45c3292e6d624efa43e9429743618ec002ff451a Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 26 Feb 2003 17:58:53 +0000 Subject: [PATCH] fixed use of short option 's', got rid of semicolon at end of file, only mess with /etc/comedi/calibrations directory if we are using default save file location --- comedi_calibrate/comedi_calibrate.c | 2 +- comedi_calibrate/save_cal.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/comedi_calibrate/comedi_calibrate.c b/comedi_calibrate/comedi_calibrate.c index f4e537f..373eccb 100644 --- a/comedi_calibrate/comedi_calibrate.c +++ b/comedi_calibrate/comedi_calibrate.c @@ -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: diff --git a/comedi_calibrate/save_cal.c b/comedi_calibrate/save_cal.c index 3df0987..f2959ec 100644 --- a/comedi_calibrate/save_cal.c +++ b/comedi_calibrate/save_cal.c @@ -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 ); -- 2.26.2