Skip to content
Snippets Groups Projects
Commit 95d08208 authored by David Hedbor's avatar David Hedbor
Browse files

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
#!/usr/local/bin/pike #!/usr/local/bin/pike
/* $Id: httpd.pike,v 1.2 1997/05/31 22:03:38 grubba Exp $ */ /* $Id: httpd.pike,v 1.3 1999/03/19 19:59:33 neotron Exp $ */
/* A very small httpd capable of fetching files only. /* A very small httpd capable of fetching files only.
* Written by Fredrik Hbinette as a demonstration of Pike * Written by Fredrik Hbinette as a demonstration of Pike
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <simulate.h> #include <simulate.h>
inherit "/precompiled/port"; inherit Stdio.Port;
/* number of bytes to read for each write */ /* number of bytes to read for each write */
#define BLOCK 16060 #define BLOCK 16060
...@@ -24,8 +24,8 @@ inherit "/precompiled/port"; ...@@ -24,8 +24,8 @@ inherit "/precompiled/port";
program output_class=class program output_class=class
{ {
inherit "/precompiled/file" : socket; inherit Stdio.File : socket;
inherit "/precompiled/file" : file; inherit Stdio.File : file;
int offset=0; int offset=0;
...@@ -36,7 +36,7 @@ program output_class=class ...@@ -36,7 +36,7 @@ program output_class=class
file::seek(offset); file::seek(offset);
data=file::read(BLOCK); data=file::read(BLOCK);
if(strlen(data)) if(data && strlen(data))
{ {
written=socket::write(data); written=socket::write(data);
if(written >= 0) if(written >= 0)
......
#!/usr/local/bin/pike #!/usr/local/bin/pike
import Stdio;
#include <simulate.h>
int main(int argc, string *argv) int main(int argc, string *argv)
{ {
...@@ -9,7 +8,7 @@ int main(int argc, string *argv) ...@@ -9,7 +8,7 @@ int main(int argc, string *argv)
if(argc < 4) if(argc < 4)
{ {
perror("Usage: rsif <from> <to> <files>\n"); werror("Usage: rsif <from> <to> <files>\n");
return 1; return 1;
} }
...@@ -18,9 +17,9 @@ int main(int argc, string *argv) ...@@ -18,9 +17,9 @@ int main(int argc, string *argv)
string file_contents; 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"); write("Processing %s.\n", argv[i]);
file_contents = replace(file_contents,argv[1],argv[2]); file_contents = replace(file_contents,argv[1],argv[2]);
if( mv(argv[i], argv[i]+"~") ) if( mv(argv[i], argv[i]+"~") )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment