From bug-request at octave dot org Thu Dec 8 11:43:25 2005 Subject: Re: Can I submit a ver.m and license.m? From: William Poetra Yoga Hadisoeseno To: bug at octave dot org Date: Fri, 9 Dec 2005 01:41:51 +0800 ------=_Part_15014_12077861.1134063711400 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Actually most of this was written last week (Gmail's draft is quite a nice feature). On 11/30/05, John W. Eaton wrote: > Then I think it is best to use a persistent variable instead of a > global one, unless there really is a need for this variable to be > globally visible. > Thanks for making the changes for me :) > I implemented a uname function and made the corresponding changes in > ver.m. > > Also, in license.m, I used getpwuid (getuid ()) to get the user name > instead of calling unix and screwing around with ispc/isunix. > OK. I think the uname function should show an example (I used my machine as an example) > Also, it seems that for x =3D ver, Matlab returns a structure with the > fields Name, Version, Release, and Date. I think it would be best for > ver.m to always build that structure, then either return or display it > depending on whether nargout =3D=3D 0. > Oh, I didn't know about this behaviour. The documentation says that we need to supply a string (as in x =3D ver('product') to get a return structure. How does Matlab actually behave? > I also modified the docstring to avoid duplication of the function > call info. > Thanks :) > * miscellaneous/license.m: Use persistent instead of global for > __octave_licenses__. Use puts instad of disp. > Use getuid and getpwuid instead of calling unix ("id -un"). > If nargout =3D 1, return license info instead of printing usage m= essage. > I think there's a typo there... > else > - username =3D "octave_user"; > + username =3D "octave_user"; > endif > Why do we use a tab? I thought we use spaces for indentation? And other places in license.m with the same level of indentation doesn't use a tab, so I've reverted it. > + else > + os_string =3D sprintf ("%s %s %s %s", unm.sysname, unm.release, > + unm.version, unm.machine); > endif > Same here. By the way, I found that `make install' exits with an error, so I'm also attaching the patch for Makefile.in here. Hasn't anyone else experienced the same error? -- William Poetra Yoga Hadisoeseno ------=_Part_15014_12077861.1134063711400 Content-Type: text/plain; name=license_ver.diff.txt; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="license_ver.diff.txt" ? autom4te.cache ? config.h.in ? configure ? scripts/autom4te.cache ? scripts/configure Index: examples/Makefile.in =================================================================== RCS file: /cvs/octave/examples/Makefile.in,v retrieving revision 1.21 diff -u -r1.21 Makefile.in --- a/examples/Makefile.in 30 Nov 2005 15:54:38 -0000 1.21 +++ b/examples/Makefile.in 8 Dec 2005 17:21:19 -0000 at @ -53,7 +53,7 @@ done if test -n "$(DESKTOP_FILE_INSTALL)"; then \ $(DESKTOP_FILE_INSTALL) --dir=$(DESTDIR)$(datadir)/applications \ - --vendor www.octave.org octave.desktop; + --vendor www.octave.org octave.desktop; \ fi .PHONY: install install-strip Index: scripts/ChangeLog =================================================================== RCS file: /cvs/octave/scripts/ChangeLog,v retrieving revision 1.480 diff -u -r1.480 ChangeLog --- a/scripts/ChangeLog 8 Dec 2005 02:28:22 -0000 1.480 +++ b/scripts/ChangeLog 8 Dec 2005 17:22:11 -0000 at @ -70,7 +70,7 @@ Call license instead of hard-coding license info here. * miscellaneous/license.m: Use persistent instead of global for - __octave_licenses__. Use puts instad of disp. + __octave_licenses__. Use puts instead of disp. Use getuid and getpwuid instead of calling unix ("id -un"). If nargout = 1, return license info instead of printing usage message. Index: scripts/miscellaneous/license.m =================================================================== RCS file: /cvs/octave/scripts/miscellaneous/license.m,v retrieving revision 1.2 diff -u -r1.2 license.m --- a/scripts/miscellaneous/license.m 30 Nov 2005 03:04:45 -0000 1.2 +++ b/scripts/miscellaneous/license.m 8 Dec 2005 17:22:15 -0000 at @ -50,6 +50,7 @@ ## ## This function is provided for compatibility with at sc{Matlab} dot ## at end deftypefn +## ## at seealso{ver, version} ## Author: William Poetra Yoga Hadisoeseno at @ -120,9 +121,9 @@ pw = getpwuid (getuid ()); if (isstruct (pw)) - username = pw.name; + username = pw.name; else - username = "octave_user"; + username = "octave_user"; endif retval(1:nr_licenses) = struct ("feature", "", "user", ""); Index: scripts/miscellaneous/ver.m =================================================================== RCS file: /cvs/octave/scripts/miscellaneous/ver.m,v retrieving revision 1.2 diff -u -r1.2 ver.m --- a/scripts/miscellaneous/ver.m 30 Nov 2005 03:04:45 -0000 1.2 +++ b/scripts/miscellaneous/ver.m 8 Dec 2005 17:22:18 -0000 at @ -23,6 +23,7 @@ ## number, license string and operating system, followed by the version ## number for octave-forge, if installed. ## at end deftypefn +## ## at seealso{license, version} ## Author: William Poetra Yoga Hadisoeseno at @ -41,7 +42,7 @@ os_string = "unknown"; else os_string = sprintf ("%s %s %s %s", unm.sysname, unm.release, - unm.version, unm.machine); + unm.version, unm.machine); endif hbar(1:70) = "-"; Index: src/syscalls.cc =================================================================== RCS file: /cvs/octave/src/syscalls.cc,v retrieving revision 1.57 diff -u -r1.57 syscalls.cc --- a/src/syscalls.cc 29 Nov 2005 17:41:33 -0000 1.57 +++ b/src/syscalls.cc 8 Dec 2005 17:22:26 -0000 at @ -1000,18 +1000,19 @@ DEFUN (uname, args, , "-*- texinfo -*-\n\ at deftypefn {Built-in Function} {[@var{uts}, @var{err}, @var{msg}] =} uname ()\n\ -Return system information in the structure. For example,\n\ +Return system information in the structure at var{uts} dot For example,\n\ \n\ at example\n\ at group\n\ uname ()\n\ - at result{} @{\n\ - sysname = \n\ - nodename = \n\ - release = \n\ - version = \n\ - machine = \n\ - at }\n\ + at result{} ans =\n\ + at {\n\ + machine = i686\n\ + nodename = darkstar\n\ + release = 2.4.32\n\ + sysname = Linux\n\ + version = #1 Sun Dec 4 00:13:49 CST 2005\n\ + at }\n\ at end group\n\ at end example\n\ \n\ ------=_Part_15014_12077861.1134063711400-- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------