### rpmatch -- Test for Yes/No Response Match

Format

>     #include <stdlib.h>
>     int rpmatch(const char *response);

Language Level: POSIX, Extension
rpmatch tests whether the string pointed to by response matches either the affirmative or the negative response set by LC_MESSAGES category in the current locale.

Return Value
rpmatch returns:

1 | If the response string matches the affirmative expression.
0 | If the response string matches the negative expression.
-1 | If the response string does not match either the affirmative or the negative expression.

Example
This example asks for a reply, and checks the response.

    #include <stdlib.h>
    #include <stdio.h>
    #include <locale.h>

    int main(void)
    {
       char  *response;
       char  buffer[100];
       int   rc;

       setlocale(LC_ALL, "");

       printf("Enter reply:\n");
       response = fgets(buffer, 100, stdin);
       rc = rpmatch(response);
       if (rc > 0)
          printf("Response was affirmative\n");
       else if (rc == 0)
          printf("Response was negative\n");
       else
          printf("Response was neither negative or affirmative\n");

       return 0;

       /***********************************************************
          Assuming you enter: No

          The output should be:

          Response was negative
       ***********************************************************/
    }

setlocale -- Set Locale
<stdlib.h>