1 //===-- runtime/command.cpp -----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "command.h"
10 #include "environment.h"
11 
12 namespace Fortran::runtime {
13 CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentCount)() {
14   int argc{executionEnvironment.argc};
15   if (argc > 1) {
16     // C counts the command name as one of the arguments, but Fortran doesn't.
17     return argc - 1;
18   }
19   return 0;
20 }
21 } // namespace Fortran::runtime
22