1 ## Copyright (C) 2007-2012 John W. Eaton
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} news (@var{package})
21 ## Display the current NEWS file for Octave or installed package.
23 ## If @var{package} is the name of an installed package, display the current
24 ## NEWS file for that package.
27 function news (package = "octave")
29 if (ischar (package) && strcmpi (package, "octave"))
30 octetcdir = octave_config_info ("octetcdir");
31 newsfile = fullfile (octetcdir, "NEWS");
33 elseif (nargin == 1 && ischar (package))
34 installed = pkg ("list");
35 names = cellfun (@(x) x.name, installed, "UniformOutput", false);
36 ## we are nice and let the user use any case on the package name
37 pos = strcmpi (names, package);
39 error ("Package '%s' is not installed.", package);
41 newsfile = fullfile (installed{pos}.dir, "packinfo", "NEWS");
47 if (exist (newsfile, "file"))
48 f = fopen (newsfile, "r");
49 while (ischar (line = fgets (f)))
53 if (strcmpi (package, "octave"))
54 error ("news: unable to locate NEWS file");
56 error ("news: unable to locate NEWS file of %s package", package);
62 ## Remove from test statistics. No real tests possible