File: reftypes.c

package info (click to toggle)
referencer 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,028 kB
  • ctags: 2,265
  • sloc: ansic: 32,973; cpp: 12,149; python: 1,314; xml: 1,258; sh: 1,154; makefile: 252
file content (46 lines) | stat: -rw-r--r-- 1,056 bytes parent folder | download | duplicates (6)
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
/*
 * reftypes.c
 *
 * Copyright (c) Chris Putnam 2003-7
 *
 * Program and source code released under the GPL
 *
 */

#include <stdio.h>
#include <string.h>
#include "is_ws.h"
#include "fields.h"
#include "reftypes.h"

extern char progname[];

int
get_reftype( char *p, long refnum, variants *all, int nall, char *tag )
{
	int i;
	while ( is_ws( *p ) ) p++;
	for ( i=0; i<nall; ++i )
		if ( !strncasecmp( all[i].type, p, strlen(all[i].type) ) ) 
			return i;
	fprintf( stderr, "%s warning: "
		"Did not recognize type '%s' of refnum %ld (%s).\n"
		"\tDefaulting to article.\n", progname, p, refnum, tag );
	return 0;
}

int
process_findoldtag( char *oldtag, int reftype, variants all[], int nall )
{
        variants *v;
        int i;
        v = &(all[reftype]);
/*      for ( i=0; i<(all[reftype]).ntags; ++i )*/
        for ( i=0; i<v->ntags; ++i )
/*              if ( !strcasecmp( ((all[reftype]).tags[i]).oldstr, oldtag ) )*/
                if ( !strcasecmp( (v->tags[i]).oldstr, oldtag ) )
                        return i;
        return -1;
}