First commit 07/04/1999

This commit is contained in:
2021-09-12 22:16:33 +02:00
commit fb545e51a6
4 changed files with 205 additions and 0 deletions

32
snr.cpp Normal file
View File

@ -0,0 +1,32 @@
#pragma hdrstop
#include <condefs.h>
#include <string.h>
#include <stdio.h>
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char **argv)
{
char string[500], *ptr;
int lengSRC;
if ( argc < 3 )
{
puts( "Search'n'Replace v1.0 | Jos<6F> David Guill<6C>n\n" );
puts( "snr [search] [replace]\n" );
} else {
lengSRC = strlen( argv[1] );
while ( gets( string ) != NULL )
{
if ( ( ptr = strstr( string, argv[1] ) ) == NULL )
{
puts( string );
} else {
ptr[0] = '\0';
printf("%s%s%s\n", string, argv[2], ptr + lengSRC );
}
}
}
return 0;
}