Imported from ../bash-4.0-rc1.tar.gz.
[platform/upstream/bash.git] / lib / readline / history.c
index 1ccf4db..8e613bb 100644 (file)
@@ -1,24 +1,23 @@
 /* history.c -- standalone history library */
 
-/* Copyright (C) 1989-2005 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
 
-   This file contains the GNU History Library (the Library), a set of
+   This file contains the GNU History Library (History), a set of
    routines for managing the text of previously typed lines.
 
-   The Library is free software; you can redistribute it and/or modify
+   History 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.
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   The Library 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.
+   History 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.
 
-   The GNU General Public License is often shipped with GNU software, and
-   is generally kept in a file called COPYING or LICENSE.  If you do not
-   have a copy of the license, 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 History.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 /* The goal is to make the implementation transparent, so that you
    don't have to know what data types are used, just what functions
@@ -158,7 +157,7 @@ history_set_pos (pos)
   return (1);
 }
  
-/* Return the current history array.  The caller has to be carefull, since this
+/* Return the current history array.  The caller has to be careful, since this
    is the actual array of data, and could be bashed or made corrupt easily.
    The array is terminated with a NULL pointer. */
 HIST_ENTRY **
@@ -319,6 +318,8 @@ add_history_time (string)
 {
   HIST_ENTRY *hs;
 
+  if (string == 0)
+    return;
   hs = the_history[history_length - 1];
   FREE (hs->timestamp);
   hs->timestamp = savestring (string);
@@ -483,7 +484,7 @@ stifle_history (max)
 
 /* Stop stifling the history.  This returns the previous maximum
    number of history entries.  The value is positive if the history
-   was stifled,  negative if it wasn't. */
+   was stifled, negative if it wasn't. */
 int
 unstifle_history ()
 {