~ubuntu-branches/ubuntu/saucy/di/saucy

« back to all changes in this revision

Viewing changes to strstr.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Ablassmeier
  • Date: 2011-02-23 21:52:32 UTC
  • mfrom: (1.1.12 upstream) (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110223215232-01vg7m0try2on4cy
Tags: 4.27-2
Do not ship "mi" (Closes: #614745)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id: strstr.c,v 1.5 2010-07-14 01:55:05-07 bll Exp $
3
 
 * $Source: /home/bll/DI/di/RCS/strstr.c,v $
4
 
 * Copyright 1994-2010 Brad Lanam, Walnut Creek, CA
5
 
 */
6
 
 
7
 
#include "config.h"
8
 
 
9
 
#if ! _lib_strstr
10
 
 
11
 
# include "di.h"
12
 
 
13
 
#if _hdr_stdio
14
 
#  include <stdio.h>
15
 
#endif
16
 
# if _hdr_stdlib
17
 
#  include <stdlib.h>
18
 
# endif
19
 
# if _hdr_string
20
 
#  include <string.h>
21
 
# endif
22
 
# if _hdr_strings
23
 
#  include <strings.h>
24
 
# endif
25
 
 
26
 
char *
27
 
# if _proto_stdc
28
 
strstr (const char *buff, const char *srch)
29
 
# else
30
 
strstr (buff, srch)
31
 
  const char *buff;
32
 
  const char *srch;
33
 
# endif
34
 
{
35
 
  Size_t    len;
36
 
  char *    p;
37
 
 
38
 
  p = (char *) buff;
39
 
  if (srch == (char *) NULL) { return p; }
40
 
 
41
 
  len = strlen (srch);
42
 
  for (; (p = strchr (p, *srch)) != (char *) NULL; p++)
43
 
  {
44
 
    if (strncmp (p, srch, len) == 0)
45
 
    {
46
 
      return (p);
47
 
    }
48
 
  }
49
 
 
50
 
  return (char *) NULL;
51
 
}
52
 
 
53
 
#else
54
 
 
55
 
extern int debug;
56
 
 
57
 
#endif