ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/common.h
Revision: 572
Committed: 2005-09-25T17:43:17-07:00 (19 years, 8 months ago) by douglas
Content type: text/x-c
File size: 1198 byte(s)
Log Message:
W00t!

File Contents

# Content
1 // Douglas Thrift
2 //
3 // CCS Computer Science
4 //
5 // Common Functions
6
7 #ifndef _common_h_
8 #define _common_h_
9
10 #ifndef __FreeBSD__
11 #define _BSD_SOURCE
12 #define _POSIX_SOURCE
13 #define _GNU_SOURCE
14 #endif
15
16 #include <pwd.h>
17 #include <regex.h>
18 #include <setjmp.h>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <sys/param.h>
23 #include <sys/stat.h>
24 #include <sys/wait.h>
25 #include <unistd.h>
26
27 #ifndef _PASSWORD_LEN
28 #define _PASSWORD_LEN BUFSIZ
29 #endif
30
31 #ifndef MAXLOGNAME
32 #define MAXLOGNAME 17
33 #endif
34
35 int check(int value, jmp_buf environment);
36 int regcheck(int value, const regex_t *regex, jmp_buf environment);
37 char *fcheck(char *value, FILE *stream, jmp_buf environment);
38 void authenticate(const char *program, jmp_buf environment);
39 void getpassword(char password[_PASSWORD_LEN], jmp_buf environment);
40 void putpassword(char password[_PASSWORD_LEN], char *name, jmp_buf environment);
41 void get(const char *prompt, regex_t *regex, char **string, jmp_buf environment);
42
43 #ifndef __FreeBSD__
44 size_t strlcpy(char *dst, const char *src, size_t size);
45 size_t strlcat(char *dst, const char *src, size_t size);
46 char *fgetln(FILE * restrict stream, size_t * restrict len);
47 #endif
48
49 #endif//_common_h_