Back to index

glibc  2.9
Defines | Functions
tst-inlcall.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>

Go to the source code of this file.

Defines

#define _GNU_SOURCE
#define __USE_STRING_INLINES   1

Functions

int main (void)

Define Documentation

#define __USE_STRING_INLINES   1

Definition at line 25 of file tst-inlcall.c.

#define _GNU_SOURCE

Definition at line 21 of file tst-inlcall.c.


Function Documentation

int main ( void  )

Definition at line 36 of file tst-inlcall.c.

{
  int status;
  int errors = 0;
  char buf1[1000];
  char *cp;
  char ch;

  cp = strcpy (buf1, "hello world");
  if (strcmp ("hello world", cp++) != 0)
    {
      puts ("strcmp test 1 failed");
      ++errors;
    }

  cp = buf1;
  if (strcmp (cp++, "hello world") != 0)
    {
      puts ("strcmp test 2 failed");
      ++errors;
    }

  ch = 'h';
  if (strchr ("hello world", ch++) == NULL)
    {
      puts ("strchr test 1 failed");
      ++errors;
    }

  const char * const hw = "hello world";
  if (strpbrk (hw, "o") - hw != 4)
    {
      puts ("strpbrk test 1 failed");
      ++errors;
    }

  if (errors == 0)
    {
      status = EXIT_SUCCESS;
      puts ("No errors.");
    }
  else
    {
      status = EXIT_FAILURE;
      printf ("%d errors.\n", errors);
    }
  return status;
}

Here is the call graph for this function: