~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/common_test/priv/rx-1.5/rgx-tests/backrefs/backref.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-07 15:07:37 UTC
  • mfrom: (1.2.1 upstream) (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090507150737-i4yb5elwinm7r0hc
Tags: 1:13.b-dfsg1-1
* Removed another bunch of non-free RFCs from original tarball
  (closes: #527053).
* Fixed build-dependencies list by adding missing comma. This requires
  libsctp-dev again. Also, added libsctp1 dependency to erlang-base and
  erlang-base-hipe packages because the shared library is loaded via
  dlopen now and cannot be added using dh_slibdeps (closes: #526682).
* Weakened dependency of erlang-webtool on erlang-observer to recommends
  to avoid circular dependencies (closes: #526627).
* Added solaris-i386 to HiPE enabled architectures.
* Made script sources in /usr/lib/erlang/erts-*/bin directory executable,
  which is more convenient if a user wants to create a target Erlang system.
* Shortened extended description line for erlang-dev package to make it
  fit 80x25 terminals.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      Copyright (C) 1996 Tom Lord
2
 
 * 
3
 
 * This program is free software; you can redistribute it and/or modify
4
 
 * it under the terms of the GNU Library General Public License as published by
5
 
 * the Free Software Foundation; either version 2, or (at your option)
6
 
 * any later version.
7
 
 * 
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU Library General Public License for more details.
12
 
 * 
13
 
 * You should have received a copy of the GNU Library General Public License
14
 
 * along with this software; see the file COPYING.  If not, write to
15
 
 * the Free Software Foundation, 59 Temple Place - Suite 330, 
16
 
 * Boston, MA 02111-1307, USA. 
17
 
 */
18
 
 
19
 
 
20
 
 
21
 
#include <stdio.h>
22
 
#include "regex.h"
23
 
 
24
 
 
25
 
 
26
 
#ifdef __STDC__
27
 
int
28
 
main(int argc, char * argv[])
29
 
#else
30
 
int
31
 
main(argc, argv)
32
 
     int argc;
33
 
     char * argv[];
34
 
#endif
35
 
{
36
 
  regex_t r;
37
 
  regmatch_t regs[10];
38
 
 
39
 
  if (regcomp (&r, "(abc|abcd)(d|)", REG_EXTENDED))
40
 
    {
41
 
      printf ("### unexpected compilation error\n");
42
 
      exit (1);
43
 
    }
44
 
 
45
 
  if (regexec (&r, "abcd", 10, regs, 0))
46
 
    {
47
 
      printf ("### unexpected regexec error\n");
48
 
      exit (1);
49
 
    }
50
 
 
51
 
  {
52
 
    int x;
53
 
 
54
 
    printf ("regexp is (abc|abcd)(d|)\n");
55
 
 
56
 
    for (x = 0; x < 3; ++x)
57
 
      printf ("reg %d == (%d, %d) %.*s\n",
58
 
              x,
59
 
              regs[x].rm_so,
60
 
              regs[x].rm_eo,
61
 
              regs[x].rm_eo - regs[x].rm_so,
62
 
              "abcd" + regs[x].rm_so);
63
 
 
64
 
    if ((regs[1].rm_eo - regs[1].rm_so) != 4)
65
 
      {
66
 
        printf ("### regexec returned a match which is not leftmost longest for subexpression 1\n");
67
 
        exit (1);
68
 
      }
69
 
  }
70
 
  exit (0);
71
 
}
72