Aegis  4.25.D505
/home/archives/aegis/branch.4/branch.25/delta28933.505/libaegis/glue.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 1993, 1994, 1999, 2002, 2004-2008, 2012 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef AEGIS_GLUE_H
00021 #define AEGIS_GLUE_H
00022 
00023 #include <common/ac/stdio.h>
00024 #include <common/ac/sys/types.h>
00025 
00026 #include <common/config.h>
00027 
00028 struct stat;
00029 struct utimbuf;
00030 struct flock;
00031 struct string_list_ty; // forward
00032 class nstring; // forward
00033 class nstring_list; // forward
00034 
00035 int copyfile(const char *src, const char *dst);
00036 int catfile(const char *path);
00037 int read_whole_dir(const char *path, char **data, long *datalen);
00038 
00053 int read_whole_dir__wl(const char *path, struct string_list_ty *wl);
00054 
00067 int read_whole_dir__wl(const nstring &path, nstring_list &wl);
00068 
00082 int read_whole_dir__wla(const char *path, struct string_list_ty *wl);
00083 
00097 int read_whole_dir__wla(const nstring &path, nstring_list &wl);
00098 
00099 int file_compare(const char *, const char *);
00100 int file_fingerprint(const char *path, char *buf, int max);
00101 int rmdir_bg(const char *path);
00102 int rmdir_tree(const char *path);
00103 
00104 int glue_access(const char *path, int mode);
00105 int glue_catfile(const char *path);
00106 int glue_chmod(const char *path, int mode);
00107 int glue_chown(const char *path, int uid, int gid);
00108 int glue_close(int fd);
00109 int glue_creat(const char *path, int mode);
00110 int glue_copyfile(const char *src, const char *dst);
00111 int glue_fclose(FILE *);
00112 int glue_file_compare(const char *, const char *);
00113 int glue_file_fingerprint(const char *path, char *buf, int max);
00114 int glue_fcntl(int fd, int cmd, struct flock *);
00115 int glue_ferror(FILE *);
00116 int glue_fflush(FILE *);
00117 int glue_fgetc(FILE *);
00118 FILE *glue_fopen(const char *path, const char *mode);
00119 int glue_fputc(int, FILE *);
00120 char *glue_getcwd(char *buf, int max);
00121 int glue_link(const char *p1, const char *p2);
00122 int glue_lstat(const char *path, struct stat *st);
00123 int glue_mkdir(const char *path, int mode);
00124 int glue_open(const char *path, int mode, int perm);
00125 long glue_pathconf(const char *path, int mode);
00126 ssize_t glue_read(int fd, void *data, size_t len);
00127 int glue_readlink(const char *path, char *buf, int max);
00128 int glue_read_whole_dir(const char *path, char **data, long *datalen);
00129 int glue_rename(const char *p1, const char *p2);
00130 int glue_rmdir(const char *path);
00131 
00132 int glue_rmdir_bg(const char *path);
00133 
00134 int glue_rmdir_tree(const char *path);
00135 
00136 int glue_stat(const char *path, struct stat *st);
00137 int glue_symlink(const char *name1, const char *name2);
00138 int glue_ungetc(int, FILE *);
00139 int glue_unlink(const char *path);
00140 int glue_utime(const char *path, struct utimbuf *);
00141 int glue_lutime(const char *path, struct utimbuf *);
00142 int glue_write(int fd, const void *data, long len);
00143 int glue_fwrite(char *, long, long, FILE *);
00144 
00145 
00146 #ifndef CONF_NO_seteuid
00147 #ifndef aegis_glue_disable
00148 
00149 //
00150 // when seteuid works,
00151 // use the functions directly,
00152 // not the glue functions
00153 //
00154 #define glue_access     access
00155 #define glue_catfile    catfile
00156 #define glue_chmod      chmod
00157 #define glue_chown      chown
00158 #define glue_close      ::close
00159 #define glue_creat      creat
00160 #define glue_copyfile   copyfile
00161 #define glue_fclose     fclose
00162 #define glue_fcntl      fcntl
00163 #define glue_ferror     ferror
00164 #define glue_fflush     fflush
00165 #define glue_fgetc      getc
00166 #define glue_file_compare file_compare
00167 #define glue_file_fingerprint file_fingerprint
00168 #define glue_fopen      fopen
00169 #define glue_fputc      putc
00170 #define glue_getcwd     getcwd
00171 #define glue_link       link
00172 #define glue_lstat      lstat
00173 #define glue_mkdir      mkdir
00174 #define glue_open       ::open
00175 #define glue_pathconf   pathconf
00176 #define glue_read       ::read
00177 #define glue_readlink   readlink
00178 #define glue_read_whole_dir     read_whole_dir
00179 #define glue_rename     rename
00180 #define glue_rmdir      rmdir
00181 #define glue_rmdir_bg   rmdir_bg
00182 #define glue_rmdir_tree rmdir_tree
00183 #define glue_stat       stat
00184 #define glue_symlink    symlink
00185 #define glue_ungetc     ungetc
00186 #define glue_unlink     unlink
00187 #define glue_utime      utime
00188 #define glue_lutime     lutime
00189 #define glue_write      ::write
00190 #define glue_fwrite     fwrite
00191 
00192 #endif // aegis_glue_disable
00193 #endif // CONF_NO_seteuid
00194 
00195 #endif // AEGIS_GLUE_H
00196 // vim: set ts=8 sw=4 et :