pike.git
/
NT
/
tools
/
sprshd
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/NT/tools/sprshd:13:
cmd[e]=io->read(len); } object pi=Stdio.File(); object p2=pi->pipe(); string dir=cmd[0]; cmd=cmd[1..]; write("Doing "+cmd*" "+"\n");
-
switch(cmd[0])
+
switch(
lower_case(
cmd[0])
)
{
-
+
case "mkdir":
+
{
+
io->write(sprintf("%4c",0));
+
mkdir(combine_path(combine_path(getcwd(),dir),cmd[1]));
+
io->write(sprintf("%4c",0));
+
break;
+
}
+
+
case "copy":
+
{
+
string from=combine_path(combine_path(getcwd(),dir),cmd[1]);
+
string to=combine_path(combine_path(getcwd(),dir),cmd[2]);
+
+
if(mixed stat=file_stat(to))
+
if(stat[1]==-2)
+
to=combine_path(to,cmd[1]);
+
+
io->write(sprintf("%4c",0));
+
io->write(sprintf("%4c",!Stdio.cp(from,to)));
+
break;
+
}
case "getenv": { string s=getenv(cmd[1])+"\n"; io->write(sprintf("%4c%s",strlen(s),s)); io->write(sprintf("%4c",0)); io->write(sprintf("%4c",0)); break; } default:
pike.git/NT/tools/sprshd:72:
exit(1); } if(!bind((int)argv[1])) { werror("Failed to bind port.\n"); exit(1); } string *hosts=gethostbyname(argv[2])[1];
+
write("Ready.\n");
while(1) { if(object io=accept()) { sscanf(io->query_address(),"%s ",string ip); if(search(hosts, ip)==-1) { destruct(io); continue; } thread_create(handle_incoming_connection,io); }else{ werror("Accept failed "+errno()+"\n"); } } }