2021-08-25 15:51:48 +08:00
|
|
|
//===-- 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
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2021-09-02 07:00:53 +08:00
|
|
|
#include "flang/Runtime/command.h"
|
2021-08-25 15:51:48 +08:00
|
|
|
#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
|