Skip to content

Commit

Permalink
STY: Pass number of characters in KPP name as printf argument
Browse files Browse the repository at this point in the history
I looked up how to do this.  Apparently you just stick a star for the width and put the variable with the width before the variable you want to have that width.
  • Loading branch information
DWesl committed Feb 8, 2024
1 parent d51f4ca commit c116e16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/gen_irr_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ int irr_diag_scalar_indices( char *dirname )
sprintf( line," chm_opts_ndx(:nchm_opts) = (/ ");
for( i = 0; i < nChmOpts; i++ ) {
if( i == 0 )
snprintf( piece,TABLE_ENTRY+EXTRA_FOR_DEST_BUFFER,"%." #TABLE_ENTRY "s_kpp",chm_scheme[i]);
snprintf( piece,TABLE_ENTRY+EXTRA_FOR_DEST_BUFFER,"%.*s_kpp", TABLE_ENTRY, chm_scheme[i]);
else
snprintf( piece,TABLE_ENTRY+EXTRA_FOR_DEST_BUFFER," ,%." #TABLE_ENTRY "s_kpp",chm_scheme[i]);
snprintf( piece,TABLE_ENTRY+EXTRA_FOR_DEST_BUFFER," ,%.*s_kpp", TABLE_ENTRY, chm_scheme[i]);
strcat( line,piece );
}
strcat( line," /)\n" );
Expand Down

0 comments on commit c116e16

Please sign in to comment.