| //===-- runtime/command.cpp -----------------------------------------------===// |
| // |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| // |
| //===----------------------------------------------------------------------===// |
| |
| #include "flang/Runtime/command.h" |
| #include "environment.h" |
| |
| namespace Fortran::runtime { |
| CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentCount)() { |
| int argc{executionEnvironment.argc}; |
| if (argc > 1) { |
| // C counts the command name as one of the arguments, but Fortran doesn't. |
| return argc - 1; |
| } |
| return 0; |
| } |
| } // namespace Fortran::runtime |