diff --git a/bin/httpd.pike b/bin/httpd.pike index 35cffafae1b6ae92c2d7aa461c0f83e1d2ed8fe4..15a350983cf2e080ccb22177621188108d16e2c0 100755 --- a/bin/httpd.pike +++ b/bin/httpd.pike @@ -1,6 +1,6 @@ #!/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. * Written by Fredrik H�binette as a demonstration of Pike @@ -8,7 +8,7 @@ #include <simulate.h> -inherit "/precompiled/port"; +inherit Stdio.Port; /* number of bytes to read for each write */ #define BLOCK 16060 @@ -24,8 +24,8 @@ inherit "/precompiled/port"; program output_class=class { - inherit "/precompiled/file" : socket; - inherit "/precompiled/file" : file; + inherit Stdio.File : socket; + inherit Stdio.File : 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) diff --git a/bin/rsif b/bin/rsif index c0c2cd9d70b2597e1077cd64843f2f57c1dccbe1..8360b60a861539f5f609d15bdce7a224ca06795d 100755 --- a/bin/rsif +++ b/bin/rsif @@ -1,37 +1,36 @@ #!/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) { - perror("Usage: rsif <from> <to> <files>\n"); + werror("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; }