/**************************************************************************/
/* Soundex Code Generator */
/* Generates the soundex equivalent of input name */
/* */
/* M\Cooper */
/* PO Box 237 */
/* St. David, AZ 85630-0237 */
/* thegrendel@theriver.com */
/* */
/* Will build on a generic UNIX system. */
/* */
/* Source code placed in the Public Domain */
/* Used with Permission */
/**************************************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define ARGCOUNT 2
#define SXLENGTH 4
#define NIL 0
typedef enum Boolean { FALSE, TRUE } boolean;
void usage( char* );
void strlwr( char* );
char* soundex( char* );
char xletter( char );
boolean prune_str( char*, char );
/**********************************************/
/* Usage Message */
/**********************************************/
void usage( char *prog_name )
{
printf( "Usage: %s name\n", prog_name );
return;
}
/*************************************/
/* Convert string to lowercase */
/*************************************/
void strlwr( char *strng )
{
while ( *strng )
*strng++ = tolower( *strng );
return;
}
/*************************************************************************/
/* Deletes Char pr_char from String str & returns TRUE (1) if successful */
/*************************************************************************/
boolean prune_str( char* str, char pr_char )
{
char* ptr;
if( !( ptr = strchr( str, pr_char ) ) )
return (FALSE);
*ptr = NIL; /* Truncate string, */
strcat( str, ++ptr ); /* and splice together */
/* with stub.
|