"Fossies" - the Fresh Open Source Software Archive

Member "cook-2.34/cook/os_interface.h" (25 Sep 2010, 3225 Bytes) of package /linux/misc/old/cook-2.34.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "os_interface.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  *      cook - file construction tool
    3  *      Copyright (C) 1993-1995, 1997-1999, 2001, 2004, 2006-2008 Peter Miller
    4  *
    5  *      This program is free software; you can redistribute it and/or modify
    6  *      it under the terms of the GNU General Public License as published by
    7  *      the Free Software Foundation; either version 3 of the License, or
    8  *      (at your option) any later version.
    9  *
   10  *      This program is distributed in the hope that it will be useful,
   11  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13  *      GNU General Public License for more details.
   14  *
   15  *      You should have received a copy of the GNU General Public License
   16  *      along with this program. If not, see
   17  *      <http://www.gnu.org/licenses/>.
   18  *
   19  * This file was originally called cook/os.h, but <os.h> is a system
   20  * include file on some systems, and this caused portability problems.
   21  */
   22 
   23 #ifndef COOK_OS_INTERFACE_H
   24 #define COOK_OS_INTERFACE_H
   25 
   26 #include <common/ac/time.h>
   27 #include <common/str.h>
   28 #include <common/str_list.h>
   29 
   30 time_t os_mtime_oldest(string_ty *);
   31 time_t os_mtime_newest(string_ty *);
   32 int os_mtime_adjust(string_ty *, time_t);
   33 int os_touch(string_ty *);
   34 
   35 /**
   36   * The os_execute_magic_characters function is used to determine if the
   37   * given string contains any characters "magic" to the shell.
   38   *
   39   * \returns
   40   *     zero if there are no magic characters, non-zero if there is at
   41   *     least one magic character
   42   */
   43 int os_execute_magic_characters(string_ty *);
   44 
   45 /**
   46   * The os_execute_magic_characters_list function is used to determine if the
   47   * given list of string contains any characters "magic" to the shell.
   48   *
   49   * \returns
   50   *     zero if there are no magic characters, non-zero if there is at
   51   *     least one magic character
   52   */
   53 int os_execute_magic_characters_list(string_list_ty *);
   54 
   55 int os_execute(string_list_ty *cmd, string_ty *input, int errok);
   56 int os_exists(string_ty *);
   57 int os_exists_symlink(string_ty *);
   58 int os_exists_dir(string_ty *);
   59 
   60 /**
   61   * The os_executable function is used to test if the given path exists
   62   * and is executable.
   63   *
   64   * \param path
   65   *     The path to test for existence and executablity.
   66   * \returns
   67   *     1 if exists and is executable, 0 if noes not exist, -1 on any
   68   *     other error (the error has already been printed).
   69   */
   70 int os_executable(string_ty *path);
   71 
   72 string_ty *os_accdir(void);
   73 string_ty *os_curdir(void);
   74 string_ty *os_dirname(string_ty *);
   75 string_ty *os_dirname_relative(string_ty *);
   76 string_ty *os_entryname(string_ty *);
   77 string_ty *os_pathname(string_ty *);
   78 int os_legal_path(string_ty *);
   79 int os_delete(string_ty *path, int echo);
   80 int os_clear_stat(string_ty *);
   81 int exit_status(char *cmd, int status, int errok);
   82 int os_mkdir(string_ty *path, int echo);
   83 
   84 /**
   85   * The os_symlink function may be used to create symbolic links.
   86   *
   87   * @param from
   88   *     The existing file which is to form the content of the symbolic link
   89   * @param to
   90   *     The new file to be created as a symbolic link.
   91   * @returns
   92   *     zero on success, -1 on failure
   93   */
   94 int os_symlink(string_ty *from, string_ty *to, int echo);
   95 
   96 #endif /* COOK_OS_INTERFACE_H */