/usr/lib/swi-prolog/doc/Manual/cmdline.html is in swi-prolog-nox 6.6.6-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SWI-Prolog 7.1.16 Reference Manual: Section 2.4</title><link rel="home" href="index.html">
<link rel="contents" href="Contents.html">
<link rel="index" href="DocIndex.html">
<link rel="summary" href="summary.html">
<link rel="previous" href="initgoal.html">
<link rel="next" href="gemacs.html">
<style type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/
dd.defbody
{ margin-bottom: 1em;
}
dt.pubdef, dt.multidef
{ color: #fff;
padding: 2px 10px 0px 10px;
margin-bottom: 5px;
font-size: 18px;
vertical-align: middle;
overflow: hidden;
}
dt.pubdef { background-color: #0c3d6e; }
dt.multidef { background-color: #ef9439; }
.bib dd
{ margin-bottom: 1em;
}
.bib dt
{ float: left;
margin-right: 1.3ex;
}
pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}
div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}
div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}
div.author
{ text-align: center;
font-style: italic;
}
div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}
div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}
div.toc-h1
{ font-size: 200%;
font-weight: bold;
}
div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}
div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}
div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}
span.sec-nr
{
}
span.sec-title
{
}
span.pred-ext
{ font-weight: bold;
}
span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #fff;
}
div.caption
{ width: 80%;
margin: auto;
text-align:center;
}
/* Footnotes */
.fn {
color: red;
font-size: 70%;
}
.fn-text, .fnp {
position: absolute;
top: auto;
left: 10%;
border: 1px solid #000;
box-shadow: 5px 5px 5px #888;
display: none;
background: #fff;
color: #000;
margin-top: 25px;
padding: 8px 12px;
font-size: larger;
}
sup:hover span.fn-text
{ display: block;
}
/* Lists */
dl.latex
{ margin-top: 1ex;
margin-bottom: 0.5ex;
}
dl.latex dl.latex dd.defbody
{ margin-bottom: 0.5ex;
}
/* PlDoc Tags */
dl.tags
{ font-size: 90%;
margin-left: 5ex;
margin-top: 1ex;
margin-bottom: 0.5ex;
}
dl.tags dt
{ margin-left: 0pt;
font-weight: bold;
}
dl.tags dd
{ margin-left: 3ex;
}
td.param
{ font-style: italic;
font-weight: bold;
}
/* Index */
dt.index-sep
{ font-weight: bold;
font-size: +1;
margin-top: 1ex;
}
/* Tables */
table.center
{ margin: auto;
}
table.latex
{ border-collapse:collapse;
}
table.latex tr
{ vertical-align: text-top;
}
table.latex td,th
{ padding: 2px 1em;
}
table.latex tr.hline td,th
{ border-top: 1px solid black;
}
table.frame-box
{ border: 2px solid black;
}
</style>
</head>
<body style="background:white">
<div class="navigate"><a class="nav" href="index.html"><img src="home.gif" alt="Home"></a>
<a class="nav" href="Contents.html"><img src="index.gif" alt="Contents"></a>
<a class="nav" href="DocIndex.html"><img src="yellow_pages.gif" alt="Index"></a>
<a class="nav" href="summary.html"><img src="info.gif" alt="Summary"></a>
<a class="nav" href="initgoal.html"><img src="prev.gif" alt="Previous"></a>
<a class="nav" href="gemacs.html"><img src="next.gif" alt="Next"></a>
</div>
<h2 id="sec:cmdline"><a id="sec:2.4"><span class="sec-nr">2.4</span> <span class="sec-title">Command
line options</span></a></h2>
<a id="sec:cmdline"></a>
<p>SWI-Prolog can be executed in one of the following modes:
<dl class="latex">
<dt><b><code>swipl --help</code></b></dt>
<dt><b><code>swipl --version</code></b></dt>
<dt><b><code>swipl --arch</code></b></dt>
<dt><b><code>swipl --dump-runtime-variables</code></b></dt>
<dd class="defbody">
These options must appear as only option. They cause Prolog to print an
informational message and exit. See <a class="sec" href="cmdline.html">section
2.4.1</a>.</dd>
<dt><b><code>swipl</code> [<var>option</var> ...] <var>script-file</var>
[<var>arg</var> ...]</b></dt>
<dd class="defbody">
These arguments are passed on Unix systems if file that starts with <code>#!/path/to/executable</code>
[<var>option</var> ...] is executed. Arguments after the script file are
made available in the Prolog flag <a class="flag" href="flags.html#flag:argv">argv</a>.</dd>
<dt><b><code>swipl</code> [<var>option</var> ...] <var>prolog-file</var>
... [[<code>--</code>] <var>arg</var> ...]</b></dt>
<dd class="defbody">
This is the normal way to start Prolog. The options are described in
<a class="sec" href="cmdline.html">section 2.4.2</a>, <a class="sec" href="cmdline.html">section
2.4.3</a> and <a class="sec" href="cmdline.html">section 2.4.4</a>. The
Prolog flag <b>argc</b> provides access to <var>arg</var> ... If the <var>options</var>
are followed by one or more Prolog file names (i.e., names with
extension <code>.pl</code>, <code>.prolog</code> or (on Windows) the
user preferred extension registered during installation), these files
are loaded. The first file is registered in the Prolog flag
<a class="flag" href="flags.html#flag:associated_file">associated_file</a>.
In addition, <b>pl-win[.exe]</b> switches to the directory in which this
primary source file is located using <a id="idx:workingdirectory2:13"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>.</dd>
<dt><b><code>swipl</code> -o <var>output</var> -c <var>prolog-file</var>
...</b></dt>
<dd class="defbody">
The <strong>-c</strong> option is used to compile a set of Prolog files
into an executable. See <a class="sec" href="cmdline.html">section 2.4.5</a>.</dd>
<dt><b><code>swipl</code> -o <var>output</var> -b <var>bootfile</var> <var>prolog-file</var>
...</b></dt>
<dd class="defbody">
Bootstrap compilation. See <a class="sec" href="cmdline.html">section
2.4.6</a>.
</dd>
</dl>
<p><h3 id="sec:info-options"><a id="sec:2.4.1"><span class="sec-nr">2.4.1</span> <span class="sec-title">Informational
command line options</span></a></h3>
<a id="sec:info-options"></a>
<dl class="latex">
<dt><strong>--arch</strong> <var></var></dt>
<dd class="defbody">
When given as the only option, it prints the architecture identifier
(see Prolog flag <a class="flag" href="flags.html#flag:arch">arch</a>)
and exits. See also
<strong>-dump-runtime-variables</strong>. Also available as
<strong>-arch</strong>.</dd>
<dt><strong>--dump-runtime-variables</strong> <var>[=format]</var></dt>
<dd class="defbody">
When given as the only option, it prints a sequence of variable settings
that can be used in shell scripts to deal with Prolog parameters. This
feature is also used by <b>swipl-ld</b> (see <a class="sec" href="plld.html">section
9.5</a>). Below is a typical example of using this feature.
<pre class="code">
eval `swipl --dump-runtime-variables`
cc -I$PLBASE/include -L$PLBASE/lib/$PLARCH ...
</pre>
<p>The option can be followed by <code>=sh</code> to dump in POSIX shell
format (default) or <code>cmd</code> to dump in MS-Windows <b>cmd.exe</b>
compatible format.</dd>
<dt><strong>--help</strong> <var></var></dt>
<dd class="defbody">
When given as the only option, it summarises the most important options.
Also available as <strong>-h</strong> and <strong>-help</strong>.</dd>
<dt><strong>--version</strong> <var></var></dt>
<dd class="defbody">
When given as the only option, it summarises the version and the
architecture identifier. Also available as <strong>-v</strong>.
</dd>
</dl>
<p><h3 id="sec:running-options"><a id="sec:2.4.2"><span class="sec-nr">2.4.2</span> <span class="sec-title">Command
line options for running Prolog</span></a></h3>
<a id="sec:running-options"></a>
<dl class="latex">
<dt><strong>--home=DIR</strong> <var></var></dt>
<dd class="defbody">
Use DIR as home directory. See <a class="sec" href="findhome.html">section
9.6</a> for details.</dd>
<dt><strong>--quiet</strong> <var></var></dt>
<dd class="defbody">
<a id="idx:verbose:14"></a><a id="idx:quiet:15"></a>Set the Prolog flag <a class="flag" href="flags.html#flag:verbose">verbose</a>
to <code>silent</code>, suppressing informational and banner messages.
Also available as <strong>-q</strong>.</dd>
<dt><strong>--nodebug</strong> <var></var></dt>
<dd class="defbody">
Disable debugging. See the <a id="idx:currentprologflag2:16"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>
flag
<a class="flag" href="flags.html#flag:generate_debug_info">generate_debug_info</a>
for details.</dd>
<dt><strong>--nosignals</strong> <var></var></dt>
<dd class="defbody">
Inhibit any signal handling by Prolog, a property that is sometimes
desirable for embedded applications. This option sets the flag
<a class="flag" href="flags.html#flag:signals">signals</a> to <code>false</code>.
See <a class="sec" href="foreigninclude.html">section 9.4.21.1</a> for
details.</dd>
<dt><strong>--pldoc</strong> <var>[=port]</var></dt>
<dd class="defbody">
Start the PlDoc documentation system on a free network port and launch
the user's browser on <a class="url" href="http://localhost:\bnfmeta{port}">http://localhost:\bnfmeta{port}</a>.
If <var>port</var> is specified, the server is started at the given port
and the browser is
<em>not</em> launched.</dd>
<dt><strong>-tty</strong> <var></var></dt>
<dd class="defbody">
Unix only. Switches controlling the terminal for allowing
single-character commands to the tracer and <a id="idx:getsinglechar1:17"></a><a class="pred" href="chario.html#get_single_char/1">get_single_char/1</a>.
By default, manipulating the terminal is enabled unless the system
detects it is not connected to a terminal or it is running as a
GNU-Emacs inferior process. This flag is sometimes required for smooth
interaction with other applications.</dd>
<dt><strong>--win_app</strong> <var></var></dt>
<dd class="defbody">
This option is available only in <b>swipl-win.exe</b> and is used for
the start-menu item. If causes <b>plwin</b> to start in the folder
<code>...\My Documents\Prolog</code> or local equivalent thereof (see
<a id="idx:winfolder2:18"></a><a class="pred" href="system.html#win_folder/2">win_folder/2</a>).
The <code>Prolog</code> subdirectory is created if it does not exist.</dd>
<dt><strong>-O</strong> <var></var></dt>
<dd class="defbody">
Optimised compilation. See <a id="idx:currentprologflag2:19"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>
flag
<a class="flag" href="flags.html#flag:optimise">optimise</a> for
details.</dd>
<dt><strong>-s</strong> <var>file</var></dt>
<dd class="defbody">
Use <var>file</var> as a script file. The script file is loaded after
the initialisation file specified with the <strong>-f</strong> <var>file</var>
option. Unlike <strong>-f</strong> <var>file</var>, using <strong>-s</strong>
does not stop Prolog from loading the personal initialisation file.</dd>
<dt><strong>-f</strong> <var>file</var></dt>
<dd class="defbody">
Use <var>file</var> as initialisation file instead of the default
<code>.plrc</code> (Unix) or <code>pl.ini</code> (Windows). `<strong>-f</strong> <var>none</var>'
stops SWI-Prolog from searching for a startup file. This option can be
used as an alternative to <strong>-s</strong> <var>file</var> that stops
Prolog from loading the personal initialisation file. See also
<a class="sec" href="initfile.html">section 2.2</a>.</dd>
<dt><strong>-F</strong> <var>script</var></dt>
<dd class="defbody">
Select a startup script from the SWI-Prolog home directory. The script
file is named <code><<var>script</var>>.rc</code>. The default
<var>script</var> name is deduced from the executable, taking the
leading alphanumerical characters (letters, digits and underscore) from
the program name. <strong>-F</strong> <var>none</var> stops looking for
a script. Intended for simple management of slightly different versions.
One could, for example, write a script <code>iso.rc</code> and then
select ISO compatibility mode using <code>pl -F iso</code> or make a
link from <b>iso-pl</b> to
<b>pl</b>.</dd>
<dt><strong>-x</strong> <var>bootfile</var></dt>
<dd class="defbody">
Boot from <var>bootfile</var> instead of the system's default boot file.
A boot file is a file resulting from a Prolog compilation using the
<strong>-b</strong> or <strong>-c</strong> option or a program saved
using
<a id="idx:qsaveprogram12:20"></a><span class="pred-ext">qsave_program/[1,2]</span>.</dd>
<dt><strong>-p</strong> <var>alias=path1[:path2 ... ]</var></dt>
<dd class="defbody">
Define a path alias for file_search_path. <var>alias</var> is the name
of the alias, and arg path1 ... is a list of values for the alias. On
Windows the list separator is <code><code>;</code></code>. On other
systems it is <code><code>:</code></code>. A value is either a term of
the form alias(value) or pathname. The computed aliases are added to <a id="idx:filesearchpath2:21"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
using <a id="idx:asserta1:22"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>,
so they precede predefined values for the alias. See <a id="idx:filesearchpath2:23"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
for details on using this file location mechanism.</dd>
<dt><strong>--</strong> <var></var></dt>
<dd class="defbody">
<a id="idx:commandlinearguments:24"></a>Stops scanning for more
arguments, so you can pass arguments for your application after this
one. See <a id="idx:currentprologflag2:25"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>
using the flag <a class="flag" href="flags.html#flag:argv">argv</a> for
obtaining the command line arguments.
</dd>
</dl>
<p><h3 id="sec:stacksizes"><a id="sec:2.4.3"><span class="sec-nr">2.4.3</span> <span class="sec-title">Controlling
the stack sizes</span></a></h3>
<a id="sec:stacksizes"></a>
<p>The default limit for the Prolog stacks is 128 MB on 32-bit and
256 MB on 64-bit hardware. The 128 MB limit on 32-bit systems
is the highest possible value and the command line options can thus only
be used to lower the limit. On 64-bit systems, the limit can both be
reduced and enlarged. See <a class="sec" href="limits.html">section 2.19</a>.
Below are two examples, the first reducing the local stack limit to
catch unbounded recursion quickly and the second using a big (32 GB)
global limit, which is only possible on 64-bit hardware. Note that
setting the limit using the command line only sets a <em>soft</em>
limit. Stack parameters can be changed (both reduced and enlarged) at
any time using the predicate <a id="idx:setprologstack2:26"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>.
<pre class="code">
$ swipl -L8m
$ swipl -G32g
</pre>
<dl class="latex">
<dt><strong>-G</strong><var>size[kmg]</var></dt>
<dd class="defbody">
Limit for the global stack (sometimes also called <em>term stack</em> or
<em>heap</em>). This is where compound terms and large numbers live.</dd>
<dt><strong>-L</strong><var>size[kmg]</var></dt>
<dd class="defbody">
Limit for the local stack (sometimes also called
<em>environment stack</em>). This is where environments and choice
points live.</dd>
<dt><strong>-T</strong><var>size[kmg]</var></dt>
<dd class="defbody">
Limit for the trail stack. This is where we keep track of assignments,
so we can rollback on backtracking or exceptions.
</dd>
</dl>
<p><h3 id="sec:runoptions"><a id="sec:2.4.4"><span class="sec-nr">2.4.4</span> <span class="sec-title">Running
goals from the command line</span></a></h3>
<a id="sec:runoptions"></a>
<dl class="latex">
<dt><strong>-g</strong> <var>goal</var></dt>
<dd class="defbody">
<var>Goal</var> is executed just before entering the top level. Default
is a predicate which prints the welcome message. The welcome message can
be suppressed with <strong>--quiet</strong>, but also with
<strong>-g</strong> <var>true</var>. <var>goal</var> can be a complex
term. In this case quotes are normally needed to protect it from being
expanded by the shell. A safe way to run a goal non-interactively is
here:
<pre class="code">
% swipl <options> -g go,halt -t 'halt(1)'
</pre>
</dd>
<dt><strong>-t</strong> <var>goal</var></dt>
<dd class="defbody">
Use <var>goal</var> as interactive top level instead of the default goal
<a id="idx:prolog0:27"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>. <var>goal</var>
can be a complex term. If the top-level goal succeeds SWI-Prolog exits
with status 0. If it fails the exit status is 1. If the top level raises
an exception, this is printed as an uncaught error and the top level is
restarted. This flag also determines the goal started by <a id="idx:break0:28"></a><a class="pred" href="toplevel.html#break/0">break/0</a>
and <a id="idx:abort0:29"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
If you want to stop the user from entering interactive mode, start the
application with `<strong>-g</strong> <var>goal</var>' and give `halt'
as top level.
</dd>
</dl>
<p><h3 id="sec:compoptions"><a id="sec:2.4.5"><span class="sec-nr">2.4.5</span> <span class="sec-title">Compilation
options</span></a></h3>
<a id="sec:compoptions"></a>
<dl class="latex">
<dt><strong>-c</strong> <var>file ...</var></dt>
<dd class="defbody">
Compile files into an `intermediate code file'. See <a class="sec" href="compilation.html">section
2.10</a>.</dd>
<dt><strong>-o</strong> <var>output</var></dt>
<dd class="defbody">
Used in combination with <strong>-c</strong> or <strong>-b</strong> to
determine output file for compilation.
</dd>
</dl>
<p><h3 id="sec:maintoptions"><a id="sec:2.4.6"><span class="sec-nr">2.4.6</span> <span class="sec-title">Maintenance
options</span></a></h3>
<a id="sec:maintoptions"></a>
<p>The following options are for system maintenance. They are given for
reference only.
<dl class="latex">
<dt><strong>-b</strong> <var>initfile ...<strong>-c</strong> file ...</var></dt>
<dd class="defbody">
Boot compilation. <var>initfile ...</var> are compiled by the C-written
bootstrap compiler, <var>file ...</var> by the normal Prolog compiler.
System maintenance only.</dd>
<dt><strong>-d</strong> <var>token1,token2,...</var></dt>
<dd class="defbody">
Print debug messages for DEBUG statements tagged with one of the
indicated tokens. Only has effect if the system is compiled with the
<code>-DO_DEBUG</code> flag. System maintenance only.
</dd>
</dl>
<p></body></html>
|