]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - builtins/times.def
update .gitignore for developers
[thirdparty/bash.git] / builtins / times.def
index 4dba72489652be0708c6dc9d0678ca9ea4fea10f..f31f43331e96a8cb5a5961d75c4696ef0920e229 100644 (file)
@@ -1,31 +1,35 @@
 This file is times.def, from which is created times.c.
 It implements the builtin "times" in Bash.
 
-Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
+Copyright (C) 1987-2009 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
-Bash is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
+Bash is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
-Bash is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
+Bash is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with Bash; see the file COPYING.  If not, write to the Free Software
-Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+You should have received a copy of the GNU General Public License
+along with Bash.  If not, see <http://www.gnu.org/licenses/>.
 
 $PRODUCES times.c
 
 $BUILTIN times
 $FUNCTION times_builtin
 $SHORT_DOC times
-Print the accumulated user and system times for processes run from
-the shell.
+Display process times.
+
+Prints the accumulated user and system times for the shell and all of its
+child processes.
+
+Exit Status:
+Always succeeds.
 $END
 
 #include <config.h>
@@ -61,6 +65,11 @@ times_builtin (list)
 #if defined (HAVE_GETRUSAGE) && defined (HAVE_TIMEVAL) && defined (RUSAGE_SELF)
   struct rusage self, kids;
 
+  USE_VAR(list);
+
+  if (no_options (list))
+    return (EX_USAGE);
+
   getrusage (RUSAGE_SELF, &self);
   getrusage (RUSAGE_CHILDREN, &kids);  /* terminated child processes */
 
@@ -79,6 +88,11 @@ times_builtin (list)
      `struct tms' with values of type clock_t. */
   struct tms t;
 
+  USE_VAR(list);
+
+  if (no_options (list))
+    return (EX_USAGE);
+
   times (&t);
 
   print_clock_t (stdout, t.tms_utime);
@@ -89,10 +103,17 @@ times_builtin (list)
   putchar (' ');
   print_clock_t (stdout, t.tms_cstime);
   putchar ('\n');
+
 #  else /* !HAVE_TIMES */
+
+  USE_VAR(list);
+
+  if (no_options (list))
+    return (EX_USAGE);
   printf ("0.00 0.00\n0.00 0.00\n");
+
 #  endif /* HAVE_TIMES */
 #endif /* !HAVE_TIMES */
 
-  return (EXECUTION_SUCCESS);
+  return (sh_chkwrite (EXECUTION_SUCCESS));
 }