Unix Review > Archives > 2002 > July 2002
/**************************************************************************/
/*                        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. 

				  

Sys Admin Spotlight

CMP DevNet Spotlight

Programming for Reliability
Lessons learned from static analysis of millions of lines of code

In the News

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 11.0

Version 11.0 delivers every issue of Sys Admin from 1992 through 2005 and every issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!




MarketPlace

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.

Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.

BugSplat - Automatic Crash Analysis
Fast online exception analysis. Capture customer crash data online.

Flowcharts from C/C++ code -- Free trial download
Understand C/C++ code in less time. A new team member ? Inherited legacy code ? Get up to speed faster with Crystal Flow for C/C++. Code-formatting improves readability. Flowcharts are integrated with code browser. Export flowcharts to Visio.

Wanna see your ad here?