~ubuntu-branches/ubuntu/oneiric/eggdrop/oneiric

« back to all changes in this revision

Viewing changes to src/rfc1459.c

  • Committer: Bazaar Package Importer
  • Author(s): Guilherme de S. Pastore
  • Date: 2004-06-17 09:15:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040617091528-64rrw1sa33lkfhmh
Tags: 1.6.16-2
* Fixed typo on README.Debian
* Fixed hyphens in manual page
* Converted debian/rules to CDBS
* Set path to binary on example config file
* Changed LANGDIR on src/eggdrop.h (Closes: #254824)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
 
1
/*
2
2
 * rfc1459.c
3
 
 * 
4
 
 * $Id: rfc1459.c,v 1.5 2002/01/02 08:06:14 tothwolf Exp $
 
3
 *
 
4
 * $Id: rfc1459.c,v 1.10 2004/04/06 06:56:38 wcc Exp $
5
5
 */
6
 
/* 
 
6
/*
7
7
 * Copyright (C) 1990 Jarkko Oikarinen
8
 
 * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
9
 
 * 
 
8
 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Eggheads Development Team
 
9
 *
10
10
 * This code was more or less cloned from the ircd-hybrid 5.3 source.
11
11
 * The original code was written by Otto Harkoonen and even though it
12
12
 * it not entirely in synch with section 2.2 of RFC1459 in that it
13
13
 * additionally defines carat as an uppercase version of tilde, it's
14
14
 * what is in the servers themselves so we're going with it this way.
15
 
 * 
 
15
 *
16
16
 * If for some reason someone who maintains the source for ircd decides
17
17
 * to change the code to be completely RFC compliant, the change here
18
18
 * would be absolutely miniscule.
19
 
 * 
 
19
 *
20
20
 * BTW, since carat characters are allowed in nicknames and tildes are
21
21
 * not, I stronly suggest that people convert to uppercase when doing
22
22
 * comparisons or creation of hash elements (which tcl laughably calls
23
23
 * arrays) to avoid making entries with impossible nicknames in them.
24
 
 * 
 
24
 *
25
25
 * --+ Dagmar
26
26
 */
27
27
 
39
39
    str1++;
40
40
    str2++;
41
41
  }
42
 
  return (res);
 
42
  return res;
43
43
}
44
44
 
45
45
int _rfc_ncasecmp(const char *str1, const char *str2, int n)
55
55
    if (!n || (*s1 == '\0' && *s2 == '\0'))
56
56
      return 0;
57
57
  }
58
 
  return (res);
 
58
  return res;
59
59
}
60
60
 
61
61
unsigned char rfc_tolowertab[];
63
63
 
64
64
int _rfc_tolower(int c)
65
65
{
66
 
  return rfc_tolowertab[(unsigned char)(c)];
 
66
  return rfc_tolowertab[(unsigned char) (c)];
67
67
}
68
68
 
69
69
int _rfc_toupper(int c)
70
70
{
71
 
  return rfc_touppertab[(unsigned char)(c)];
 
71
  return rfc_touppertab[(unsigned char) (c)];
72
72
}
73
73
 
74
74
unsigned char rfc_tolowertab[] =
75
 
{0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
76
 
 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
77
 
 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
78
 
 0x1e, 0x1f,
79
 
 ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
80
 
 '*', '+', ',', '-', '.', '/',
81
 
 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
82
 
 ':', ';', '<', '=', '>', '?',
83
 
 '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
84
 
 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
85
 
 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
86
 
 '_',
87
 
 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
88
 
 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
89
 
 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
90
 
 0x7f,
91
 
 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
92
 
 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
93
 
 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
94
 
 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
95
 
 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
96
 
 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
97
 
 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
98
 
 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
99
 
 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
100
 
 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
101
 
 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
102
 
 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
103
 
 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
104
 
 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
105
 
 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
106
 
 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff};
 
75
  { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
 
76
  0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
 
77
  0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
 
78
  0x1e, 0x1f,
 
79
  ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
 
80
  '*', '+', ',', '-', '.', '/',
 
81
  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
 
82
  ':', ';', '<', '=', '>', '?',
 
83
  '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
 
84
  'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
 
85
  't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
 
86
  '_',
 
87
  '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
 
88
  'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
 
89
  't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
 
90
  0x7f,
 
91
  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
 
92
  0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
 
93
  0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
 
94
  0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
 
95
  0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
 
96
  0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
 
97
  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
 
98
  0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
 
99
  0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
 
100
  0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
 
101
  0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
 
102
  0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
 
103
  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
 
104
  0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
 
105
  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
 
106
  0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 
107
};
107
108
 
108
109
unsigned char rfc_touppertab[] =
109
 
{0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
110
 
 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
111
 
 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
112
 
 0x1e, 0x1f,
113
 
 ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
114
 
 '*', '+', ',', '-', '.', '/',
115
 
 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
116
 
 ':', ';', '<', '=', '>', '?',
117
 
 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
118
 
 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
119
 
 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
120
 
 0x5f,
121
 
 '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
122
 
 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
123
 
 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
124
 
 0x7f,
125
 
 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
126
 
 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
127
 
 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
128
 
 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
129
 
 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
130
 
 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
131
 
 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
132
 
 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
133
 
 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
134
 
 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
135
 
 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
136
 
 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
137
 
 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
138
 
 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
139
 
 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
140
 
 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff};
141
 
 
 
110
  { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
 
111
  0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
 
112
  0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
 
113
  0x1e, 0x1f,
 
114
  ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
 
115
  '*', '+', ',', '-', '.', '/',
 
116
  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
 
117
  ':', ';', '<', '=', '>', '?',
 
118
  '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
 
119
  'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
 
120
  'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
 
121
  0x5f,
 
122
  '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
 
123
  'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
 
124
  'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
 
125
  0x7f,
 
126
  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
 
127
  0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
 
128
  0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
 
129
  0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
 
130
  0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
 
131
  0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
 
132
  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
 
133
  0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
 
134
  0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
 
135
  0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
 
136
  0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
 
137
  0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
 
138
  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
 
139
  0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
 
140
  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
 
141
  0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 
142
};