-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedna2.c
More file actions
executable file
·58 lines (47 loc) · 1.14 KB
/
edna2.c
File metadata and controls
executable file
·58 lines (47 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ed by Gudu 4/2/93
// slight modifications - Artagel 11-11-93
// Llel 10/96 - fixed for "ed here"
// Slider 8-26-2002 - Added logging.
#define LOG_NAME "ZZ_EDIT"
int main( string file) {
object user;
object env;
string err;
int test;
user = this_player();
if( !wizardp( user))
return 0;
seteuid( getuid( previous_object()));
if (file=="here") {
env=environment(user);
if (!env)
return 0;
file=file_name(env)+".c";
}
else
file = resolv_path( user->query_current_path(), file);
#ifdef MUDOS
test = (int)master()->valid_write(file, user, "ed");
write("Editing: " + file);
if(test)
write("\n");
else
write(" [read only]\n");
#endif
// large files are crashing the mud, thus this fix
if(file_size(file)>1000000) {
write("File size too large.\n");
return 1;
}
user->set_edit(1);
ed(file,"exit_fn",0);
user->set_last_file(file);
log_file(LOG_NAME,ctime()+" "+capitalize(this_player()->query_real_name())+
" edited file " + file + "\n");
return 1;
}
void exit_fn()
{
write("Resetting edit flag...\n");
this_player()->set_edit(0);
}