protocol

# osp

> Portable operating-system access protocol.

author:
  `Paulo Moura`
version:
  `1.13`
date:
  `2015/10/16`

compilation flags:
  `static`

(no dependencies on other files)

## Public interface

### pid/1

> Returns the process identifier of the running process.

compilation flags:
  `static`
template:
  `pid(PID)`
mode – number of proofs:
  `pid(-integer) – one`

### shell/2

> Runs an operating-system shell command and returns its exit status.

compilation flags:
  `static`
template:
  `shell(Command,Status)`
mode – number of proofs:
  `shell(+atom,-integer) – one`

### shell/1

> Runs an operating-system shell command.

compilation flags:
  `static`
template:
  `shell(Command)`
mode – number of proofs:
  `shell(+atom) – zero_or_one`

### expand_path/2

> Expands a file path to an absolute file path.

compilation flags:
  `static`
template:
  `expand_path(Path,ExpandedPath)`
mode – number of proofs:
  `expand_path(+atom,-atom) – one`

### decompose_file_name/4

> Decomposes a file path into its directory (which always ends with a slash), name (that can be the empty atom), and extension (which starts with a "." when defined; the empty atom otherwise).

compilation flags:
  `static`
template:
  `decompose_file_name(Path,Directory,Name,Extension)`
mode – number of proofs:
  `decompose_file_name(+atom,?atom,?atom,?atom) – one`

### make_directory/1

> Makes a new directory. Succeeds if the directory already exists.

compilation flags:
  `static`
template:
  `make_directory(Directory)`
mode – number of proofs:
  `make_directory(+atom) – one`

### delete_directory/1

> Deletes an empty directory.

compilation flags:
  `static`
template:
  `delete_directory(Directory)`
mode – number of proofs:
  `delete_directory(+atom) – one`

### change_directory/1

> Changes current working directory.

compilation flags:
  `static`
template:
  `change_directory(Directory)`
mode – number of proofs:
  `change_directory(+atom) – one`

### working_directory/1

> Current working directory.

compilation flags:
  `static`
template:
  `working_directory(Directory)`
mode – number of proofs:
  `working_directory(?atom) – zero_or_one`

### directory_files/2

> Returns a list of all the files (including directories and regular files) in the given directory.

compilation flags:
  `static`
template:
  `directory_files(Directory,Files)`
mode – number of proofs:
  `directory_files(+atom,-list(atom)) – one`

### directory_exists/1

> True if the specified directory exists (irrespective of directory permissions).

compilation flags:
  `static`
template:
  `directory_exists(Directory)`
mode – number of proofs:
  `directory_exists(+atom) – zero_or_one`

### file_exists/1

> True if the specified file exists (irrespective of type and file permissions).

compilation flags:
  `static`
template:
  `file_exists(File)`
mode – number of proofs:
  `file_exists(+atom) – zero_or_one`

### file_modification_time/2

> File modification time (which can be used for comparison).

compilation flags:
  `static`
template:
  `file_modification_time(File,Time)`
mode – number of proofs:
  `file_modification_time(+atom,-integer) – zero_or_one`

### file_size/2

> File size (in bytes).

compilation flags:
  `static`
template:
  `file_size(File,Size)`
mode – number of proofs:
  `file_size(+atom,-integer) – zero_or_one`

### file_permission/2

> True if the specified file has the specified permission (read, write, or execute).

compilation flags:
  `static`
template:
  `file_permission(File,Permission)`
mode – number of proofs:
  `file_permission(+atom,?atom) – zero_or_one`

### rename_file/2

> Renames a file or a directory.

compilation flags:
  `static`
template:
  `rename_file(Old,New)`
mode – number of proofs:
  `rename_file(+atom,+atom) – zero_or_one`

### delete_file/1

> Deletes a file.

compilation flags:
  `static`
template:
  `delete_file(File)`
mode – number of proofs:
  `delete_file(+atom) – one`

### environment_variable/2

> Returns an environment variable value. Fails if the variable does not exists.

compilation flags:
  `static`
template:
  `environment_variable(Variable,Value)`
mode – number of proofs:
  `environment_variable(+atom,?atom) – zero_or_one`

### time_stamp/1

> Returns a system-dependent time stamp (which can be used for sorting).

compilation flags:
  `static`
template:
  `time_stamp(Time)`
mode – number of proofs:
  `time_stamp(-number) – one`

### date_time/7

> Returns the current date and time.

compilation flags:
  `static`
template:
  `date_time(Year,Month,Day,Hours,Mins,Seconds,Miliseconds)`
mode – number of proofs:
  `date_time(-integer,-integer,-integer,-integer,-integer,-integer,-integer) – one`

### cpu_time/1

> System cpu time in seconds.

compilation flags:
  `static`
template:
  `cpu_time(Seconds)`
mode – number of proofs:
  `cpu_time(-number) – one`

### wall_time/1

> Wall time in seconds.

compilation flags:
  `static`
template:
  `wall_time(Seconds)`
mode – number of proofs:
  `wall_time(-number) – one`

### operating_system_type/1

> Operating system type. Possible values are "unix", "windows", and "unknown".

compilation flags:
  `static`
template:
  `operating_system_type(Type)`
mode – number of proofs:
  `operating_system_type(?atom) – one`

### command_line_arguments/1

> Returns a list with the command line arguments that occur after "--".

compilation flags:
  `static`
template:
  `command_line_arguments(Arguments)`
mode – number of proofs:
  `command_line_arguments(-list(atom)) – one`

## Protected interface

(none)

## Private predicates

(none)

## Operators

### (none)

## Remarks

### (none)

## See also

### (none)