]> granicus.if.org Git - fcron/blob - subs.h
refactored suspend handling code into suspend.[ch]
[fcron] / subs.h
1 /*
2  * FCRON - periodic command scheduler 
3  *
4  *  Copyright 2000-2014 Thibault Godouet <fcron@free.fr>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  * 
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  *  The GNU General Public License can also be found in the file
21  *  `LICENSE' that comes with the fcron source distribution.
22  */
23
24
25 #ifndef __SUBS_H__
26 #define __SUBS_H__
27
28
29 /* functions prototypes */
30 extern uid_t get_user_uid_safe(char *username);
31 extern gid_t get_group_gid_safe(char *groupname);
32 extern void seteuid_safe(uid_t euid);
33 extern void setegid_safe(uid_t egid);
34 extern int remove_as_user(const char *pathname, uid_t removeuid,
35                           gid_t removegid);
36 extern int open_as_user(const char *pathname, uid_t openuid, gid_t opengid,
37                         int flags, ...);
38 extern int rename_as_user(const char *oldpath, const char *newpath,
39                           uid_t renameuid, gid_t renamegid);
40
41 extern int remove_blanks(char *str);
42 extern int strcmp_until(const char *left, const char *right, char until);
43 extern int get_word(char **str);
44 extern void my_unsetenv(const char *name);
45 extern void my_setenv_overwrite(const char *name, const char *value);
46
47 extern time_t tmax(time_t x, time_t y);
48 extern time_t tmin(time_t x, time_t y);
49 extern int imax(int x, int y);
50 extern int imin(int x, int y);
51
52 extern time_t my_time(void);
53 #endif                          /* __SUBS_H__ */