Additional operating system utilities

Author(s): Manuel Hermenegildo.

This is a (temporary) extension to library system (which it reexports). Much of this should probably end up eventually in system, but once we have worked out the best interface and, in some cases, the proper implementation (the implementations in here are in some cases just calls to Un*x shell primitives or commands).

Documentation on exports

PREDICATE
No further documentation available for this predicate.

PREDICATE

Usage 1:move_files(Files,Dir)

Move Files to directory Dir (note that to move only one file to a directory, rename_file/2 can be used).

    (True) Usage 2:

    • The following properties should hold at call time:
      (basic_props:list/2)Arg1 is a list of atms.
      (basic_props:atm/1)Arg2 is an atom.

    PREDICATE

    Usage:move_file(File,Dir)

    Move File to directory Dir

      PREDICATE

      Usage 1:copy_files(Files,Dir)

      Like copy_files/3, with empty options list.

        (True) Usage 2:

        • The following properties should hold at call time:
          (basic_props:list/2)Arg1 is a list of atms.
          (basic_props:atm/1)Arg2 is an atom.

        PREDICATE

        Usage:copy_files(Files,Dir,Opts)

        Copy Files to directory Dir, using Opts as the option list for copy. See copy_file/3 for the list of options. Note that to move only one file to a directory, rename_file/2 can be used.

          PREDICATE

          Usage:copy_files_nofail(Files,Dir,Opts)

          Like copy_files/3, but do not fail in case of errors.

            PREDICATE

            Usage:symbolic_link(Source,Dir)

            Create a symbolic link in Dir pointing to file or directory Source (performs a copy in Windows).

              PREDICATE

              Usage:symbolic_link(Source,Dir,NewName)

              Create a symbolic link in Dir pointing to file or directory Source and give it name NewName (performs a copy in Windows).

                PREDICATE

                Usage 1:ls(Directory,Pattern,FileList)

                FileList is the unordered list of entries (files, directories, etc.) in Directory whose names match Pattern.If Directory does not exist FileList is empty.

                  (True) Usage 2:

                  • The following properties should hold at call time:
                    (basic_props:atm/1)Arg1 is an atom.
                    (system_extra:pattern/1)system_extra:pattern(Arg2)
                    (term_typing:var/1)Arg3 is a free variable.
                  • The following properties hold upon exit:
                    (basic_props:list/2)Arg3 is a list of atms.

                  REGTYPE
                  A regular type, defined as follows:
                  pattern(A) :-
                          atom(A).
                  

                  PREDICATE

                  Usage 1:ls(Pattern,FileList)

                  FileList is the unordered list of entries (files, directories, etc.) in the current directory whose names match Pattern (same as ls('.',Pattern,FileList)).

                    (True) Usage 2:

                    • The following properties should hold at call time:
                      (system_extra:pattern/1)system_extra:pattern(Arg1)
                      (term_typing:var/1)Arg2 is a free variable.
                    • The following properties hold upon exit:
                      (basic_props:list/2)Arg2 is a list of atms.

                    PREDICATE
                    No further documentation available for this predicate.

                    PREDICATE
                    No further documentation available for this predicate.

                    PREDICATE
                    No further documentation available for this predicate.

                    PREDICATE

                    Usage 1:filter_alist_pattern(UnFiltered,Pattern,Filtered)

                    Filtered contains the elements of UnFiltered which match with Pattern.

                      (True) Usage 2:

                      • The following properties should hold at call time:
                        (basic_props:list/2)Arg1 is a list of atms.
                        (system_extra:pattern/1)system_extra:pattern(Arg2)
                        (term_typing:var/1)Arg3 is a free variable.
                      • The following properties hold upon exit:
                        (basic_props:list/2)Arg3 is a list of atms.

                      PREDICATE
                      No further documentation available for this predicate. Meta-predicate with arguments: -goal.

                      PREDICATE
                      No further documentation available for this predicate. Meta-predicate with arguments: --goal.

                      PREDICATE

                      Usage:try_finally(Start,Goal,End)

                      Calls initialization goal Start and then calls Goal Goal, but always continues with the evaluation of End. If Goal is non-deterministic, in case of backtracking Start is called again before redoing Goal.

                        Meta-predicate with arguments: try_finally(goal,goal,goal).

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE

                        Usage:do(Command,OutputFile,ErrorFile,Action,ReturnCode)

                        Executes Command redirecting standard output to OutputFile and standard error to ErrorFile. ReturnCode is the code returned by the execution of Command. Action is a list of atoms that specify the actions to be completed in case the Command fails. Three of these options: fail, exception, and nofail are mutually exclusive. The rest of the options are flags that mean (type do_options/1):

                      • inform_nofail: informs about the error code returned by the execution of the command.

                      • show_output_on_error: shows the content of OutputFile in case of error.

                      • show_error: shows the content of ErrorFile in case of error.

                      • silent: do not print any error message. The option inform_nofail overrides this option in case of fail.

                      • verbose_command: shows the command before being executed. Useful for tracing.

                      • verbose: verbose_command plus overrides the error and output file settings and outputs everything to user_output and user_error.

                        • The following properties should hold at call time:
                          (basic_props:list/2)Command is a list of atms.
                          (basic_props:atm/1)OutputFile is an atom.
                          (basic_props:atm/1)ErrorFile is an atom.
                          (basic_props:list/2)Action is a list of do_optionss.
                        • The following properties should hold upon exit:
                          (basic_props:num/1)ReturnCode is a number.

                        REGTYPE
                        A regular type, defined as follows:
                        do_options(fail).
                        do_options(nofail).
                        do_options(silent).
                        do_options(exception).
                        do_options(halt).
                        do_options(inform_nofail).
                        do_options(show_output_on_error).
                        do_options(show_error_on_error).
                        do_options(verbose).
                        do_options(verbose_command).
                        

                        PREDICATE

                        Usage:do(Command,OutputFile,ErrorFile,Action)

                        Same as do/5 but omitting the returned code.

                        • The following properties should hold at call time:
                          (basic_props:list/2)Command is a list of atms.
                          (basic_props:atm/1)OutputFile is an atom.
                          (basic_props:atm/1)ErrorFile is an atom.
                          (basic_props:list/2)Action is a list of do_optionss.

                        PREDICATE

                        Usage:do(Command,Action)

                        Same as do/3 but omitting the return code.

                        • The following properties should hold at call time:
                          (basic_props:list/2)Command is a list of atms.
                          (basic_props:list/2)Action is a list of do_optionss.

                        PREDICATE

                        Usage:do(Command,Action,ReturnCode)

                        Same as do/5 but omitting the files.

                        • The following properties should hold at call time:
                          (basic_props:list/2)Command is a list of atms.
                          (basic_props:list/2)Action is a list of do_optionss.
                        • The following properties should hold upon exit:
                          (basic_props:num/1)ReturnCode is a number.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE
                        No further documentation available for this predicate.

                        PREDICATE

                        Usage:replace_params(Subst,Str,Str2)

                        Replace <v>Key</v> strings from the input Str string by values input by values stored in Subst

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE
                          No further documentation available for this predicate.

                          PREDICATE

                          Usage:backup_file(FileName)

                          Save a backup copy of file FileName

                            PREDICATE

                            Usage:

                            The standard input is an interactive terminal.

                              (UNDOC_REEXPORT)
                              system_error_report/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              replace_characters/4:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              no_swapslash/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              cyg2win/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              winpath_c/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              winpath/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              winpath/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              using_windows/0:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              rename_file/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              delete_directory/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              delete_file/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              set_exec_mode/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              chmod/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              chmod/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              fmode/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              touch/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              modif_time0/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              modif_time/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              file_properties/6:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              file_property/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              file_exists/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              file_exists/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              mktemp_in_tmp/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              mktemp/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              directory_files/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              wait/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              exec/8:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              exec/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              exec/4:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              popen_mode/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              popen/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              system/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              system/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              shell/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              shell/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              shell/0:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              cd/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              working_directory/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              make_dirpath/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              make_dirpath/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              make_directory/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              make_directory/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              umask/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              current_executable/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              current_host/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_address/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_tmp_dir/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_grnam/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_pwnam/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_gid/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_uid/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              get_pid/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              file_dir_name/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              extract_paths/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              dir_path/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              copy_file/3:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              copy_file/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              c_errno/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              del_env/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              set_env/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              current_env/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              setenvstr/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              getenvstr/2:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              datime_struct/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              datime/9:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              datime/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              time/1:
                              Imported from system (see the corresponding documentation for details).

                              (UNDOC_REEXPORT)
                              pause/1:
                              Imported from system (see the corresponding documentation for details).