10 faim_export faim_shortfunc int aimutil_putstr(u_char *dest, const char *src, int len)
12 memcpy(dest, src, len);
17 * Tokenizing functions. Used to portably replace strtok/sep.
21 faim_export int aimutil_tokslen(char *toSearch, int index, char dl)
29 next = strchr(toSearch, dl);
31 while(curCount < index && next != NULL) {
34 next = strchr(last, dl);
37 if ((curCount < index) || (next == NULL))
38 toReturn = strlen(toSearch) - (curCount - 1);
40 toReturn = next - toSearch - (curCount - 1);
45 faim_export int aimutil_itemcnt(char *toSearch, char dl)
52 next = strchr(toSearch, dl);
56 next = strchr(next + 1, dl);
62 faim_export char *aimutil_itemidx(char *toSearch, int index, char dl)
72 next = strchr(toSearch, dl);
74 while (curCount < index && next != NULL) {
77 next = strchr(last, dl);
80 if (curCount < index) {
81 toReturn = malloc(sizeof(char));
84 next = strchr(last, dl);
86 if (curCount < index) {
87 toReturn = malloc(sizeof(char));
91 toReturn = malloc((strlen(last) + 1) * sizeof(char));
92 strcpy(toReturn, last);
94 toReturn = malloc((next - last + 1) * sizeof(char));
95 memcpy(toReturn, last, (next - last));
96 toReturn[next - last] = '\0';
103 * int snlen(const char *)
105 * This takes a screen name and returns its length without
106 * spaces. If there are no spaces in the SN, then the
107 * return is equal to that of strlen().
110 faim_export int aim_snlen(const char *sn)
113 const char *curPtr = NULL;
119 while ( (*curPtr) != (char) NULL) {
120 if ((*curPtr) != ' ')
129 * int sncmp(const char *, const char *)
131 * This takes two screen names and compares them using the rules
132 * on screen names for AIM/AOL. Mainly, this means case and space
133 * insensitivity (all case differences and spacing differences are
141 faim_export int aim_sncmp(const char *sn1, const char *sn2)
143 const char *curPtr1 = NULL, *curPtr2 = NULL;
145 if (aim_snlen(sn1) != aim_snlen(sn2))
150 while ( (*curPtr1 != (char) NULL) && (*curPtr2 != (char) NULL) ) {
151 if ( (*curPtr1 == ' ') || (*curPtr2 == ' ') ) {
157 if ( toupper(*curPtr1) != toupper(*curPtr2))
167 /* strsep Copyright (C) 1992, 1993 Free Software Foundation, Inc.
168 strsep is part of the GNU C Library.
170 The GNU C Library is free software; you can redistribute it and/or
171 modify it under the terms of the GNU Library General Public License as
172 published by the Free Software Foundation; either version 2 of the
173 License, or (at your option) any later version.
175 The GNU C Library is distributed in the hope that it will be useful,
176 but WITHOUT ANY WARRANTY; without even the implied warranty of
177 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
178 Library General Public License for more details.
180 You should have received a copy of the GNU Library General Public
181 License along with the GNU C Library; see the file COPYING.LIB. If
182 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
183 Cambridge, MA 02139, USA. */
185 /* Minor changes by and1000 on 15/1/97 to make it go under Nemesis */
187 faim_export char *aim_strsep(char **pp, const char *delim)
194 if ((q = strpbrk (p, delim))) {