File: matchtest.c

package info (click to toggle)
daemontools 1:0.76-13
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,296 kB
  • sloc: ansic: 3,800; sh: 464; makefile: 391
file content (24 lines) | stat: -rw-r--r-- 478 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <unistd.h>
#include "match.h"
#include "buffer.h"
#include "str.h"

int main(int argc,char **argv)
{
  const char *pattern = "";
  const char *buf = "";

  if (argv[1]) {
    pattern = argv[1];
    if (argv[2])
      buf = argv[2];
  }

  buffer_puts(buffer_1,match(pattern,buf,str_len(buf)) ? " " : "-");
  buffer_puts(buffer_1,pattern);
  buffer_puts(buffer_1," (");
  buffer_puts(buffer_1,buf);
  buffer_puts(buffer_1,")\n");
  buffer_flush(buffer_1);
  _exit(0);
}