~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/kernel/doc/src/os.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (1.1.13 upstream)
  • mto: (3.3.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20090215164252-dxpjjuq108nz4noa
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE erlref SYSTEM "erlref.dtd">
 
3
 
 
4
<erlref>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>1997</year>
 
8
      <year>2007</year>
 
9
      <holder>Ericsson AB, All Rights Reserved</holder>
 
10
    </copyright>
 
11
    <legalnotice>
 
12
  The contents of this file are subject to the Erlang Public License,
 
13
  Version 1.1, (the "License"); you may not use this file except in
 
14
  compliance with the License. You should have received a copy of the
 
15
  Erlang Public License along with this software. If not, it can be
 
16
  retrieved online at http://www.erlang.org/.
 
17
 
 
18
  Software distributed under the License is distributed on an "AS IS"
 
19
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
20
  the License for the specific language governing rights and limitations
 
21
  under the License.
 
22
 
 
23
  The Initial Developer of the Original Code is Ericsson AB.
 
24
    </legalnotice>
 
25
 
 
26
    <title>os</title>
 
27
    <prepared></prepared>
 
28
    <docno></docno>
 
29
    <date></date>
 
30
    <rev></rev>
 
31
  </header>
 
32
  <module>os</module>
 
33
  <modulesummary>Operating System Specific Functions</modulesummary>
 
34
  <description>
 
35
    <p>The functions in this module are operating system specific.
 
36
      Careless use of these functions will result in programs that will
 
37
      only run on a specific platform. On the other hand, with careful
 
38
      use these functions can be of help in enabling a program to run on
 
39
      most platforms.</p>
 
40
  </description>
 
41
  <funcs>
 
42
    <func>
 
43
      <name>cmd(Command) -> string()</name>
 
44
      <fsummary>Execute a command in a shell of the target OS</fsummary>
 
45
      <type>
 
46
        <v>Command = string() | atom()</v>
 
47
      </type>
 
48
      <desc>
 
49
        <p>Executes <c>Command</c> in a command shell of the target OS,
 
50
          captures the standard output of the command and returns this
 
51
          result as a string. This function is a replacement of
 
52
          the previous <c>unix:cmd/1</c>; on a Unix platform they are
 
53
          equivalent.</p>
 
54
        <p>Examples:</p>
 
55
        <code type="none">
 
56
LsOut = os:cmd("ls"), % on unix platform
 
57
DirOut = os:cmd("dir"), % on Win32 platform</code>
 
58
        <p>Note that in some cases, standard output of a command when
 
59
          called from another program (for example, <c>os:cmd/1</c>)
 
60
          may differ, compared to the standard output of the command
 
61
          when called directly from an OS command shell.</p>
 
62
      </desc>
 
63
    </func>
 
64
    <func>
 
65
      <name>find_executable(Name) -> Filename | false</name>
 
66
      <name>find_executable(Name, Path) -> Filename | false</name>
 
67
      <fsummary>Absolute filename of a program</fsummary>
 
68
      <type>
 
69
        <v>Name = string()</v>
 
70
        <v>Path = string()</v>
 
71
        <v>Filename = string()</v>
 
72
      </type>
 
73
      <desc>
 
74
        <p>These two functions look up an executable program given its
 
75
          name and a search path, in the same way as the underlying
 
76
          operating system. <c>find_executable/1</c> uses the current
 
77
          execution path (that is, the environment variable PATH on
 
78
          Unix and Windows).</p>
 
79
        <p><c>Path</c>, if given, should conform to the syntax of
 
80
          execution paths on the operating system. The absolute
 
81
          filename of the executable program <c>Name</c> is returned,
 
82
          or <c>false</c> if the program was not found.</p>
 
83
      </desc>
 
84
    </func>
 
85
    <func>
 
86
      <name>getenv() -> [string()]</name>
 
87
      <fsummary>List all environment variables</fsummary>
 
88
      <desc>
 
89
        <p>Returns a list of all environement variables.
 
90
          Each environment variable is given as a single string on
 
91
          the format <c>"VarName=Value"</c>, where <c>VarName</c> is
 
92
          the name of the variable and <c>Value</c> its value.</p>
 
93
      </desc>
 
94
    </func>
 
95
    <func>
 
96
      <name>getenv(VarName) -> Value | false</name>
 
97
      <fsummary>Get the value of an environment variable</fsummary>
 
98
      <type>
 
99
        <v>VarName = string() </v>
 
100
        <v>Value = string()</v>
 
101
      </type>
 
102
      <desc>
 
103
        <p>Returns the <c>Value</c> of the environment variable
 
104
          <c>VarName</c>, or <c>false</c> if the environment variable
 
105
          is undefined.</p>
 
106
      </desc>
 
107
    </func>
 
108
    <func>
 
109
      <name>getpid() -> Value </name>
 
110
      <fsummary>Return the process identifier of the emulator process</fsummary>
 
111
      <type>
 
112
        <v>Value = string()</v>
 
113
      </type>
 
114
      <desc>
 
115
        <p>Returns the process identifier of the current Erlang emulator
 
116
          in the format most commonly used by the operating system
 
117
          environment. <c>Value</c> is returned as a string containing
 
118
          the (usually) numerical identifier for a process. On Unix,
 
119
          this is typically the return value of the <c>getpid()</c>
 
120
          system call. On VxWorks, <c>Value</c> contains the task id
 
121
          (decimal notation) of the Erlang task. On Windows,
 
122
          the process id as returned by the <c>GetCurrentProcessId()</c>
 
123
          system call is used.</p>
 
124
      </desc>
 
125
    </func>
 
126
    <func>
 
127
      <name>putenv(VarName, Value) -> true</name>
 
128
      <fsummary>Set a new value for an environment variable</fsummary>
 
129
      <type>
 
130
        <v>VarName = string() </v>
 
131
        <v>Value = string()</v>
 
132
      </type>
 
133
      <desc>
 
134
        <p>Sets a new <c>Value</c> for the environment variable
 
135
          <c>VarName</c>.</p>
 
136
      </desc>
 
137
    </func>
 
138
    <func>
 
139
      <name>type() -> {Osfamily, Osname} | Osfamily</name>
 
140
      <fsummary>Return the OS family and, in some cases, OS name of the current operating system</fsummary>
 
141
      <type>
 
142
        <v>Osfamily = win32 | unix | vxworks</v>
 
143
        <v>Osname = atom()</v>
 
144
      </type>
 
145
      <desc>
 
146
        <p>Returns the <c>Osfamily</c> and, in some cases, <c>Osname</c>
 
147
          of the current operating system.</p>
 
148
        <p>On Unix, <c>Osname</c> will have same value as
 
149
          <c>uname -s</c> returns, but in lower case. For example, on
 
150
          Solaris 1 and 2, it will be <c>sunos</c>.</p>
 
151
        <p>In Windows, <c>Osname</c> will be either <c>nt</c> (on
 
152
          Windows NT), or <c>windows</c> (on Windows 95).</p>
 
153
        <p>On VxWorks the OS family alone is returned, that is
 
154
          <c>vxworks</c>.</p>
 
155
        <note>
 
156
          <p>Think twice before using this function. Use the
 
157
            <c>filename</c> module if you want to inspect or build
 
158
            file names in a portable way.
 
159
            Avoid matching on the <c>Osname</c> atom.</p>
 
160
        </note>
 
161
      </desc>
 
162
    </func>
 
163
    <func>
 
164
      <name>version() -> {Major, Minor, Release} | VersionString</name>
 
165
      <fsummary>Return the Operating System version</fsummary>
 
166
      <type>
 
167
        <v>Major = Minor = Release = integer()</v>
 
168
        <v>VersionString = string()</v>
 
169
      </type>
 
170
      <desc>
 
171
        <p>Returns the operating system version.
 
172
          On most systems, this function returns a tuple, but a string
 
173
          will be returned instead if the system has versions which
 
174
          cannot be expressed as three numbers.</p>
 
175
        <note>
 
176
          <p>Think twice before using this function. If you still need
 
177
            to use it, always <c>call os:type()</c> first.</p>
 
178
        </note>
 
179
      </desc>
 
180
    </func>
 
181
  </funcs>
 
182
</erlref>
 
183