Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
facd31fa
Commit
facd31fa
authored
26 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
bug-compatibility with really old NT-pikes
Rev: NT/tools/sprshd:1.11
parent
6b48a2e6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NT/tools/sprshd
+58
-2
58 additions, 2 deletions
NT/tools/sprshd
with
58 additions
and
2 deletions
NT/tools/sprshd
+
58
−
2
View file @
facd31fa
...
@@ -2,6 +2,62 @@
...
@@ -2,6 +2,62 @@
inherit Stdio.Port;
inherit Stdio.Port;
// Bugfix for some older versions of Pike..
string combine_path(string s, string ... rest)
{
for(int e=0;e<sizeof(rest);e++)
{
if(sscanf(rest[e],"%*[a-zA-Z]:%*s")==2)
{
s=rest[e];
}else{
s=predef::combine_path(s,rest[e]);
}
}
return s;
}
// Bugfix for some older versions of Pike..
#define BLOCK 65536
int cp(string from, string to)
{
if(!Stdio.cp(from,to))
{
werror("Backup cp function in effect.\n");
string data;
object tmp=Stdio.File();
if(!tmp->open(from,"r"))
{
werror(sprintf("Open %s failed.\n",from));
return 0;
}
function r=tmp->read;
tmp=Stdio.File();
if(!tmp->open(to,"wct"))
{
werror(sprintf("Open %s failed.\n",to));
return 0;
}
function w=tmp->write;
do
{
data=r(BLOCK);
if(!data)
{
werror("Read failed.\n");
return 0;
}
if(w(data)!=strlen(data))
{
werror("Write failed.\n");
return 0;
}
}while(strlen(data) == BLOCK);
}
return 1;
}
void monitor(object(Stdio.File) io, object proc)
void monitor(object(Stdio.File) io, object proc)
{
{
proc->wait();
proc->wait();
...
@@ -59,7 +115,7 @@ void handle_incoming_connection(object(Stdio.File) io)
...
@@ -59,7 +115,7 @@ void handle_incoming_connection(object(Stdio.File) io)
}
}
int ret=
Stdio.
cp(from,to);
int ret=cp(from,to);
if(!ret)
if(!ret)
{
{
string x=sprintf("Errno is %d\n"
string x=sprintf("Errno is %d\n"
...
@@ -152,7 +208,7 @@ int main(int argc, string *argv)
...
@@ -152,7 +208,7 @@ int main(int argc, string *argv)
hosts+=tmp[1];
hosts+=tmp[1];
}
}
write("Ready.\n");
write("Ready
("+version()+")
.\n");
while(1)
while(1)
{
{
if(object io=accept())
if(object io=accept())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment