Skip to content

Commit efe54f4

Browse files
committed
make sure bname is a valid fortran name when inserting into source snippets
1 parent 75e870f commit efe54f4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fpm/src/fpm/cmd/new.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module fpm_cmd_new
22

33
use fpm_command_line, only : fpm_new_settings
44
use fpm_environment, only : run, OS_LINUX, OS_MACOS, OS_WINDOWS
5-
use fpm_filesystem, only : join_path, exists, basename, mkdir, is_dir
5+
use fpm_filesystem, only : join_path, exists, basename, mkdir, is_dir, to_fortran_name
66
use,intrinsic :: iso_fortran_env, only : stderr=>error_unit
77
implicit none
88
private
@@ -70,7 +70,7 @@ subroutine cmd_new(settings)
7070
&'']
7171
! create placeholder module src/bname.f90
7272
littlefile=[character(len=80) :: &
73-
&'module '//bname, &
73+
&'module '//to_fortran_name(bname), &
7474
&' implicit none', &
7575
&' private', &
7676
&'', &
@@ -79,7 +79,7 @@ subroutine cmd_new(settings)
7979
&' subroutine say_hello', &
8080
&' print *, "Hello, '//bname//'!"', &
8181
&' end subroutine say_hello', &
82-
&'end module '//bname]
82+
&'end module '//to_fortran_name(bname)]
8383
! create NAME/src/NAME.f90
8484
call warnwrite(join_path(settings%name, 'src', bname//'.f90'),&
8585
& littlefile)
@@ -121,7 +121,7 @@ subroutine cmd_new(settings)
121121
if(exists(bname//'/src/'))then
122122
littlefile=[character(len=80) :: &
123123
&'program main', &
124-
&' use '//bname//', only: say_hello', &
124+
&' use '//to_fortran_name(bname)//', only: say_hello', &
125125
&' implicit none', &
126126
&'', &
127127
&' call say_hello()', &

0 commit comments

Comments
 (0)