~ubuntu-branches/ubuntu/precise/openwalnut/precise

« back to all changes in this revision

Viewing changes to src/modules/data/ext/libeep/libeep/eepmisc.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Eichelbaum
  • Date: 2011-06-21 10:26:54 UTC
  • Revision ID: james.westby@ubuntu.com-20110621102654-rq0zf436q949biih
Tags: upstream-1.2.5
ImportĀ upstreamĀ versionĀ 1.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  ------------------------------------------------------------------------
 
3
  EEP - ERP Evaluation Package
 
4
  
 
5
  very basic stuff
 
6
 
 
7
  Max-Planck-Institute of Cognitive Neuroscience Leipzig
 
8
  R. Nowagk 1997
 
9
 
 
10
  (Id: eepmisc.c,v 1.3 1999/07/05 06:51:32 nowagk Exp nowag)
 
11
 
 
12
 
 
13
  fixed RCS log strings
 
14
  2000/08/08 - MG
 
15
  
 
16
 
 
17
  ------------------------------------------------------------------------
 
18
  $Id: eepmisc.c 1762 2008-03-14 13:15:30Z rsmies $
 
19
  ------------------------------------------------------------------------
 
20
*/
 
21
 
 
22
#include <string.h>                                                        
 
23
#include <stdlib.h>                                                        
 
24
#include <ctype.h>  
 
25
 
 
26
#include <eep/eepmisc.h>
 
27
 
 
28
#ifdef COMPILE_RCS
 
29
char RCS_eepmisc_h[] = RCS_EEPMISC_H;
 
30
char RCS_eepmisc_c[] = "$RCSfile: eepmisc.c,v $ $Revision: 1762 $";
 
31
#endif
 
32
 
 
33
#if defined(__EMX__)
 
34
int strcasecmp(const char *s1, const char *s2)
 
35
{
 
36
  int i, r;
 
37
  char *buf1 = malloc(strlen(s1) + 1);
 
38
  char *buf2 = malloc(strlen(s2) + 1);
 
39
  
 
40
  i = 0;
 
41
  do {
 
42
    buf1[i] = tolower(s1[i]);
 
43
    i++;
 
44
  } while(s1[i-1]);
 
45
  
 
46
  i = 0;
 
47
  do {
 
48
    buf2[i] = tolower(s2[i]);
 
49
    i++;
 
50
  } while(s2[i-1]);
 
51
  
 
52
  r = strcmp(buf1, buf2);
 
53
  
 
54
  free(buf1); free(buf2);
 
55
  return r;
 
56
}
 
57
#endif
 
58
 
 
59
int strend(char *s, char *m)
 
60
{
 
61
  int l1, l2;
 
62
  int x;
 
63
  
 
64
  l1 = strlen(s);
 
65
  l2 = strlen(m);
 
66
  if (l2 > l1)
 
67
    x = 1;
 
68
  else 
 
69
    x = strcmp(s + l1 - l2, m);
 
70
  
 
71
  if (x)
 
72
    return 0;
 
73
  else
 
74
    return 1;
 
75
}
 
76
 
 
77
int asciiwrite(FILE *f, char *line)
 
78
{
 
79
  /* return nonzero on success */
 
80
  return (fputs(line, f) != EOF);
 
81
}
 
82
 
 
83
char *asciiread(FILE *f, char *line)
 
84
{
 
85
  return fgets(line, EEPIOMAX, f);
 
86
}