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
95d08208
Commit
95d08208
authored
26 years ago
by
David Hedbor
Browse files
Options
Downloads
Patches
Plain Diff
Now compiles and works with 0.7 (httpd doesn't exactly work perfectly though).
Rev: bin/httpd.pike:1.3 Rev: bin/rsif:1.2
parent
bb12ba29
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/httpd.pike
+5
-5
5 additions, 5 deletions
bin/httpd.pike
bin/rsif
+13
-14
13 additions, 14 deletions
bin/rsif
with
18 additions
and
19 deletions
bin/httpd.pike
+
5
−
5
View file @
95d08208
#!/usr/local/bin/pike
/* $Id: httpd.pike,v 1.
2
199
7
/0
5/31 22:03:38 grubba
Exp $ */
/* $Id: httpd.pike,v 1.
3
199
9
/0
3/19 19:59:33 neotron
Exp $ */
/* A very small httpd capable of fetching files only.
* Written by Fredrik Hbinette as a demonstration of Pike
...
...
@@ -8,7 +8,7 @@
#include <simulate.h>
inherit
"/precompiled/p
ort
"
;
inherit
Stdio.P
ort;
/* number of bytes to read for each write */
#define BLOCK 16060
...
...
@@ -24,8 +24,8 @@ inherit "/precompiled/port";
program output_class=class
{
inherit
"/precompiled/f
ile
"
: socket;
inherit
"/precompiled/f
ile
"
: file;
inherit
Stdio.F
ile : socket;
inherit
Stdio.F
ile : file;
int offset=0;
...
...
@@ -36,7 +36,7 @@ program output_class=class
file::seek(offset);
data=file::read(BLOCK);
if(strlen(data))
if(
data &&
strlen(data))
{
written=socket::write(data);
if(written >= 0)
...
...
This diff is collapsed.
Click to expand it.
bin/rsif
+
13
−
14
View file @
95d08208
#!/usr/local/bin/pike
#include <simulate.h>
import Stdio;
int main(int argc, string *argv)
{
int i;
string file;
if(argc
<
4)
if(argc
<
4)
{
p
error("Usage: rsif <from> <to> <files>\n");
w
error("Usage: rsif <from> <to> <files>\n");
return 1;
}
for(i
=
3; i
<
argc; i++)
for(i
=
3; i
<
argc; i++)
{
string file_contents;
if(file_contents
=
read_bytes(argv[i]))
if(file_contents
=
read_bytes(argv[i]))
{
if(-1!=
strstr
(file_contents,argv[1]))
if(-1
!=
search
(file_contents,argv[1]))
{
write("Processing
"+
argv[i]
+".\n"
);
file_contents
=
replace(file_contents,argv[1],argv[2]);
write("Processing
%s.\n",
argv[i]);
file_contents
=
replace(file_contents,argv[1],argv[2]);
if( mv(argv[i],argv[i]+"~") )
if( mv(argv[i],
argv[i]+"~") )
{
write_file(argv[i],file_contents);
}else{
write_file(argv[i],
file_contents);
}
else
{
write("Failed to create backup file.\n");
}
}
}
}
return 0;
}
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