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
This commit is contained in:
parent
723db82ce5
commit
45c3292e6d
2 changed files with 15 additions and 15 deletions
|
@ -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:
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if( setup->cal_save_file_path == NULL )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
asprintf( &setup->cal_save_file_path, "%s/%s_0x%lx",
|
||||
save_dir, comedi_get_board_name( dev ),
|
||||
( unsigned long ) file_stats.st_ino );
|
||||
|
|
Loading…
Add table
Reference in a new issue