Mercurial > hg > octave-lyh
annotate liboctave/oct-uname.h @ 10485:b4e14e628fc9
Truncate argv() for scripts used without command line parameters. Bug #29423
author | Judd Storrs <jstorrs@gmail.com> |
---|---|
date | Fri, 02 Apr 2010 13:28:02 -0400 |
parents | cbc402e64d83 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
5547 | 1 /* |
2 | |
7017 | 3 Copyright (C) 2005, 2006, 2007 John W. Eaton |
5547 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
5547 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
5547 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_uame_h) | |
24 #define octave_uname_h 1 | |
25 | |
26 #include <string> | |
27 | |
28 class | |
6108 | 29 OCTAVE_API |
5547 | 30 octave_uname |
31 { | |
32 public: | |
33 | |
34 octave_uname (void) | |
35 : utsname_sysname ("unknown"), utsname_nodename ("unknown"), | |
36 utsname_release ("unknown"), utsname_version ("unknown"), | |
37 utsname_machine ("unknown"), | |
38 msg ("uname not supported on this system"), err (-1) | |
39 { init (); } | |
40 | |
41 octave_uname (const octave_uname& unm) | |
42 : utsname_sysname (unm.utsname_sysname), | |
43 utsname_nodename (unm.utsname_nodename), | |
44 utsname_release (unm.utsname_release), | |
45 utsname_version (unm.utsname_version), | |
46 utsname_machine (unm.utsname_machine), | |
47 msg (unm.msg), err (unm.err) | |
48 { } | |
49 | |
50 octave_uname& operator = (const octave_uname& unm) | |
51 { | |
52 if (this != &unm) | |
53 { | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
54 utsname_sysname = unm.utsname_sysname; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
55 utsname_nodename = unm.utsname_nodename; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
56 utsname_release = unm.utsname_release; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
57 utsname_version = unm.utsname_version; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
58 utsname_machine = unm.utsname_machine; |
5547 | 59 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
60 msg = unm.msg; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
61 err = unm.err; |
5547 | 62 } |
63 | |
64 return *this; | |
65 } | |
66 | |
67 ~octave_uname (void) { } | |
68 | |
69 std::string sysname (void) const { return utsname_sysname; } | |
70 std::string nodename (void) const { return utsname_nodename; } | |
71 std::string release (void) const { return utsname_release; } | |
72 std::string version (void) const { return utsname_version; } | |
73 std::string machine (void) const { return utsname_machine; } | |
74 | |
75 std::string message (void) const { return msg; } | |
76 int error (void) const { return err; } | |
77 | |
78 private: | |
79 | |
80 std::string utsname_sysname; | |
81 std::string utsname_nodename; | |
82 std::string utsname_release; | |
83 std::string utsname_version; | |
84 std::string utsname_machine; | |
85 | |
86 std::string msg; | |
87 int err; | |
88 | |
89 void init (void); | |
90 }; | |
91 | |
92 #endif |