[Top] [Prev] [Next]

Environment Variables


Each operating system and shell uses its own syntax for setting environment variables. This table shows how each OS and shell would set the P4CLIENT environment variable.

OS & Shell

Environment Variable Example

UNIX: csh, sh, bash export P4CLIENT=value
UNIX: ksh setenv P4CLIENT value
DOS set P4CLIENT=value
VMS def/j P4CLIENT "value"
Mac MPW set P4CLIENT value

The two tables on the next four pages describe the environment variables used by Perforce. The most important of the variables are described in the first table, and the second table describes the more esoteric variables.

Table 1: Basic Perforce Environment Variables (page 1 of 2)

Environment
Variable

P4CLIENT P4JOURNAL P4LOG

Description

Name of client workspace Database journal file File to write errors to

Command-Line
Alternative

-c -J -L

Used by p4?

Yes No No

Used by p4d?

No Yes Yes

Examples

eds_elm manual journal /disk2/perf/journal log /disk2/perf/log

Value if not Explicitly Set

UNIX:
name of p4 host
NT:
value of
COMPUTERNAME
environment variable
P4ROOT/journal standard error

Notes

File is specified relative to p4d server root, or as an absolute path. Setting this variable, or
using the command-line
alternative, enables
journaling.
File is specified relative to p4d server root, or as an
absolute path.

Table 1: Basic Perforce Environment Variables (page 2 of 2)

Environment
Variable

P4PORT P4ROOT P4USER

Description

For p4d server,
port # to listen on.
For p4 client,
p4d host and its port
Directory in which p4d stores its files and subdirectories Perforce client username

Command-Line
Alternative

-p -r -u

Used by p4?

Yes No Yes

Used by p4d?

Yes Yes No

Examples

p4d server example: 1515 p4 client example: squid:1666
it.com:1308
/usr/lcl/p4root edk lisag

Value if not Explicitly Set

For p4d server: 1666 For p4 client: perforce:1666 <none> UNIX:
the value of the USER environment variable
NT:
the value of the USERNAME environment variable

Notes

Format on p4 client is host:port#, or port# by itself if the p4 client and the p4d server run on the same host. To use the default value with p4d, define perforce as a alias to the host in
/etc/hosts, or use the domain name services.
Port numbers must be in the range
1024 - 31767.
Create this directory before starting p4d. Only the account running p4d needs read/write permissions in this directory. By default, the Perforce username is the same as the OS username, but this can be set to any other Perforce user.

Table 2: Esoteric Perforce Environment Variables (page 1 of 2)

Environment
Variable

DIFF EDITOR MERGE

Description

Name and location of the `diff' program used by
p4 resolve and
p4 diff.
Editor used by p4 commands that bring up forms, such as p4 client and p4 user MERGE program used by p4 resolve's merge command

Command-Line
Alternative

Used by p4?

Yes Yes Yes

Used by p4d?

No No No

Examples

diff diff -b windiff compare vi emacs SimpleText Prescient Software's
MergeRight

Value if not Explicitly Set

UNIX:
diff
NT:
If SHELL set, diff;
otherwise, windiff.
UNIX: vi NT: if SHELL is set, vi; otherwise, notepad VMS: if POSIX$SHELL is set, vi; otherwise, edit Mac:
if EDITOR_SIGNATURE is set, the program with that four-character creator; otherwise, SimpleText.
<none>

Notes

p4 describe,
p4 diff2, and
p4 submit use the server diff, which is usually GNU diff.
This EV can contain flags to diff, such as diff -b.
This program is used only by p4 resolve's merge command. It takes four arguments, representing yours, theirs, base, and the resulting merge file.

Environment
Variable

P4CASE PAGER PWD TMP, TEMP

Description

[NT only].
Determines whether or not the current directory is not lowercased before use.
Program used to page output from p4 resolve's diff. The working directory when p4 commands are run. Directory in which temporary files are written

Command-Line
Alternative

-d

Used by p4?

Yes Yes Yes Yes

Used by p4d?

No No No No

Examples

more /u1/doug/prog /tmp

Value if not Explicitly Set

If the variable doesn't exist,
current directory is automatically
lowercased.
<none> UNIX:
Value of PWD as set by shell; if not set by shell, getwd() is used.

VMS, NT,
Mac/MPW:
Actual current working directory
UNIX, NT:
/tmp
VMS,
Mac/MPW:
current directory

Notes

The value of the variable doesn't matter. Only its existence determines whether case is forcibly set. It is recommended that this variable NOT be set. This forces lowercasing of the current directory. Used only by
p4 resolve.
If this variable is not set, the output of diff will not be paged.
If the TEMP environment variable is set, this is used; otherwise, if TMP is set, this is used; otherwise, defaults to the values above.
Table 2: Esoteric Perforce Environment Variables (page 2 of 2)



[Top] [Prev] [Next]

[email protected]
Copyright © 1997, Perforce Software. All rights reserved.