rpmatch man page on OSF1

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
OSF1 logo
[printable version]

rpmatch(3)							    rpmatch(3)

NAME
       rpmatch - Determine whether a response is affirmative or negative

SYNOPSIS
       #include <stdlib.h>

       int rpmatch(
	       const char *response );

LIBRARY
       Standard C Library (libc)

PARAMETERS
       User  input entered in response to a question that requires an affirma‐
       tive or negative answer.

DESCRIPTION
       The rpmatch() function determines  whether  the	string	value  of  the
       response parameter matches the affirmative or negative response expres‐
       sion as specified by the LC_MESSAGES category in the program's  current
       locale.	Both  response	expressions,  defined  in  the	locale, may be
       extended regular expressions.

       A possible value of the affirmative expression, yesexpr, for a English-
       language	 locale is "^([yY]|[yY][eE][sS])".  This expression will match
       any value of the response parameter that has consists of the  letter  Y
       (in  uppercase  or  lowercase)  or  the	letters YES (in any mixture of
       uppercase and lowercase letters).

RETURN VALUES
       A value of 1 is returned if the string value of the response  parameter
       is  matched  by	the  affirmative  expression;  a  value of 0 (zero) is
       returned if the string value of the response parameter  is  matched  by
       the negative expression. If neither expression matches the string value
       of the response parameter, a value of -1 is returned.

EXAMPLES
       The following example requests a response from the user	and  uses  the
       rpmatch() function to determine if the response is affirmative or nega‐
       tive.

       #include <stdlib.h> #include  <stdio.h>	#include  <locale.h>  #include
       <string.h> #define SLENGTH 80

       main() {

	   char	   str[SLENGTH], *eol;
	   int	  ans;

	   (void)setlocale(LC_ALL, " " );

	   printf("Do you want to perform this operation: ");
	   fgets(str, SLENGTH, stdin);
	   if ((eol = strchr(str, '\n')) != NULL)
	       *eol = '\0';  /* Replace newline with null */
	   else
	       return;	/* Line entered too long */

	   ans = rpmatch(str);
	   if (ans == 1)
	       printf("You responded affirmatively\n");
	   else if (ans == 0)
	       printf("You responded negatively\n");
	   else
	    printf("Your answer did not match\n"); }

SEE ALSO
       Commands: grep(1).

       Functions: regcomp(3), regexec(3), setlocale(3).

       Files: locale(4).

								    rpmatch(3)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server OSF1

List of man pages available for OSF1

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net