ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/secret.c
Revision: 562
Committed: 2005-08-27T21:46:39-07:00 (19 years, 10 months ago) by douglas
Content type: text/x-c
File size: 631 byte(s)
Log Message:
Moo!

File Contents

# Content
1 // Douglas Thrift
2 //
3 // CCS Computer Science
4 //
5 // Secret Password
6
7 #include <fcntl.h>
8
9 #include "common.h"
10
11 int main(int argc, char *argv[])
12 {
13 int exception;
14 jmp_buf environment;
15
16 switch (exception = setjmp(environment))
17 {
18 case 0:
19 break;
20 case 1:
21 perror(argv[0]);
22
23 return 1;
24 default:
25 fprintf(stderr, "%s: %s\n", argv[0], (char *)exception);
26
27 return 1;
28 }
29
30 char password[_PASSWORD_LEN];
31
32 getpassword(password, environment);
33
34 int file = check(open("/ccs/etc/secret", O_WRONLY | O_TRUNC), environment);
35
36 check(write(file, password, strlen(password)), environment);
37 check(close(file), environment);
38
39 return 0;
40 }