From 5920b5d2e8ead646a8cbb66847a4586b4db16ad6 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sun, 20 Feb 2005 15:24:02 +0000 Subject: [PATCH] re PR libfortran/20085 (iargc returns wrong count for number of program arguments) PR 20085 * intrinsic/args.c (iargc): Off by 1. From-SVN: r95302 --- libgfortran/ChangeLog | 5 +++++ libgfortran/intrinsics/args.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 22de50117988..4aa4077b441b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2005-02-20 Steven G. Kargl + + PR 20085 + * intrinsic/args.c (iargc): Off by 1. + 2005-02-19 Steven G. Kargl * intrinsic/date_and_time.c: Fix conformance problems. diff --git a/libgfortran/intrinsics/args.c b/libgfortran/intrinsics/args.c index e1032d434085..72f1b987c87b 100644 --- a/libgfortran/intrinsics/args.c +++ b/libgfortran/intrinsics/args.c @@ -1,6 +1,6 @@ /* Implementation of the GETARG and IARGC g77, and corresponding F2003, intrinsics. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. Contributed by Bud Davis and Janne Blomqvist. This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -78,7 +78,9 @@ getarg_i8 (GFC_INTEGER_8 *pos, char *val, gfc_charlen_type val_len) } -/* Return the number of commandline arguments. */ +/* Return the number of commandline arguments. The g77 info page + states that iargc does not include the specification of the + program name itself. */ extern GFC_INTEGER_4 iargc (void); export_proto(iargc); @@ -91,7 +93,7 @@ iargc (void) get_args (&argc, &argv); - return argc; + return (argc - 1); } -- 2.43.5