[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: ksh, sh, bash


export P4CLIENT=value

UNIX: csh


setenv P4CLIENT value

VMS


def/j P4CLIENT "value"

Mac MPW


set -e P4CLIENT value

Windows 95/NT


Environment variables can be set with

    set P4CLIENT=value
but if registry variables are set, they will override the environment variable values. The registry variables can be set in the user-specific part of the registry through the p4 client program with

    p4 set P4VAR=value
and can be set in the system registry with
    p4 set -s P4VAR=value
The use of registry variables is recommended.

The two tables on this page describe the environment variables used by Perforce. The most important of the variables are described in the first tableThe second table describes the more esoteric variables.

Basic Perforce Environment Variables


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.


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 an 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.


Esoteric Perforce Environment Variables


Environment
Variable


P4DIFF


P4EDITOR


P4MERGE


Description


Name and location of the `diff' program used by p4 resolve and p4 diff.


Editor used by p4 commands, like p4 client, that bring up forms


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

vi emacs SimpleText

Prescient Software's
MergeRight


Value if not Explicitly Set


UNIX:
If DIFF is set, then value of DIFF; otherwise p4's internal diff

NT:
If DIFF is set, then value of DIFF; else if SHELL set, diff; otherwise, p4diff.exe


If EDITOR environment variable is set, its value; otherwise:

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.


If MERGE environment variable is set, its value; otherwise, nothing.


Notes


This EV can contain flags to diff, such as diff -u.

p4 describe,
p4 diff2, and
p4 submit use the diff built into p4d; this cannot be changed.



This program is used only by p4 resolve's merge command. It takes four arguments, representing base, theirs, yours, and the resulting merge file. Please see page 42 for more details.


Environment
Variable


P4PAGER


PWD


TMP, TEMP


Description


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


Used by p4d?


No


No


No


Examples


more

/u1/doug/prog

/tmp

Value if not Explicitly Set


If PAGER environment variable is set, then the value of PAGER; otherwise, 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:
/tmp

VMS, Mac/MPW, NT:
on client: current directory;
on server: $P4ROOT


Notes


Used only by
p4 resolve.

If this variable is not set, the output of p4 resolve's 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.



[Top] [Prev] [Next]

Command Line User's Guide for PERFORCE
Copyright 1997 Perforce Software. Comments to [email protected].
Last updated: November 20, 1997