File: dic_dummy.c

package info (click to toggle)
skksearch 0.0-25
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 228 kB
  • sloc: ansic: 1,079; makefile: 23; sh: 18
file content (48 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (c) 1999 Hideki Sakurada
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "config.h"
#include "err.h"
#include "dic.h"
#include "dic_dummy.h"

/* Dummy dictionary type is just a trivial example. */


struct dic *dic_dummy_open(struct dic *d, char *path) {
  struct dic_dummy_internal *internal;
  if ((internal = malloc(sizeof(struct dic_dummy_internal))) == NULL) {
    err(LOG_ERR, "dic_dummy_open: %s\n", strerror(errno));
    exit(1);
  }
  d->internal = (void *)internal;
  d->search = dic_dummy_search;
  d->close = dic_dummy_close;
  return d;
}


int dic_dummy_close(struct dic *d) {
  free(d->internal);
  free(d);
  return 0;
}


char *dic_dummy_search(struct dic *d, char *key, int keylen) {
  return NULL;
}