summaryrefslogtreecommitdiff
path: root/support/texlab/crates/bibutils_sys/src/bu_auth.c
blob: f0c9194ca6dd58ccd96c35892e145c69933a2401 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * bu_auth.c
 *
 * Copyright (c) Chris Putnam 2017-2019
 *
 * Source code released under the GPL version 2
 */
#include <string.h>
#include "bu_auth.h"
#include "msvc_fix.h"

const char *bu_genre[] = {
	"academic journal",
	"airtel",
	"collection",
	"communication",
	"Diploma thesis",
	"Doctoral thesis",
	"electronic",
	"e-mail communication"
	"Habilitation thesis",
	"handwritten note",
	"hearing",
	"journal article",
	"Licentiate thesis",
	"magazine",
	"magazine article",
	"manuscript",
	"Masters thesis",
	"memo",
	"miscellaneous",
	"newspaper article",
	"pamphlet",
	"Ph.D. thesis",
	"press release",
	"teletype",
	"television broadcast",
	"unpublished"
};
int nbu_genre = sizeof( bu_genre ) / sizeof( const char *);

static int
position_in_list( const char *list[], int nlist, const char *query )
{
	int i;
	for ( i=0; i<nlist; ++i ) {
		if ( !strcasecmp( query, list[i] ) ) return i;
	}
	return -1;
}

int
bu_findgenre( const char *query )
{
	return position_in_list( bu_genre, nbu_genre, query );
}

int
is_bu_genre( const char *query )
{
	if ( bu_findgenre( query ) != -1 ) return 1;
	return 0;
}