#include <pwd.h>
#include <errno.h>
#include <sys/types.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
-
+#include <time.h>
#include <sys/wait.h>
#include <string.h>
#include <limits.h>
}
else if (!strcasecmp(encoding, "Q")) { /**< quoted-printable */
size_t len;
- long pos;
+ unsigned long pos;
len = strlen(istr);
pos = 0;
*/
int CtdlIsMe(char *addr, int addr_buf_len)
{
- struct recptypes *recp;
+ recptypes *recp;
int i;
recp = validate_recipients(addr, NULL, 0);
*/
void remove_any_whitespace_to_the_left_or_right_of_at_symbol(char *name)
{
- int i;
+ unsigned int i;
for (i = 0; i < strlen(name); ++i) {
if (name[i] == '@') {
strcpy(name, &name[1]);
aaa[strlen(aaa) - 1] = 0;
strcpy(bbb, "");
- for (a = 0; a < strlen(aaa); ++a) {
+ for (a = 0; aaa[a] != '\0'; ++a) {
if (aaa[a] == ',') {
strcpy(bbb, &aaa[a + 1]);
aaa[a] = 0;
+ break;
}
}
if (!strcasecmp(name, aaa))
}
/* Change "user @ xxx" to "user" if xxx is an alias for this host */
- for (a=0; a<strlen(name); ++a) {
+ for (a=0; name[a] != '\0'; ++a) {
if (name[a] == '@') {
if (CtdlHostAlias(&name[a+1]) == hostalias_localhost) {
name[a] = 0;
MSG_syslog(LOG_INFO, "Changed to <%s>\n", name);
+ break;
}
}
}
*
* Caller needs to free the result using free_recipients()
*/
-struct recptypes *validate_recipients(const char *supplied_recipients,
- const char *RemoteIdentifier,
- int Flags) {
+recptypes *validate_recipients(const char *supplied_recipients,
+ const char *RemoteIdentifier,
+ int Flags) {
struct CitContext *CCC = CC;
- struct recptypes *ret;
+ recptypes *ret;
char *recipients = NULL;
char *org_recp;
char this_recp[256];
int in_quotes = 0;
/* Initialize */
- ret = (struct recptypes *) malloc(sizeof(struct recptypes));
+ ret = (recptypes *) malloc(sizeof(recptypes));
if (ret == NULL) return(NULL);
/* Set all strings to null and numeric values to zero */
- memset(ret, 0, sizeof(struct recptypes));
+ memset(ret, 0, sizeof(recptypes));
if (supplied_recipients == NULL) {
recipients = strdup("");
/*
- * Destructor for struct recptypes
+ * Destructor for recptypes
*/
-void free_recipients(struct recptypes *valid) {
+void free_recipients(recptypes *valid) {
if (valid == NULL) {
return;
sField < pFieldEnd;
pField++, sField++)
{
- if ((*sField=='\r') || (*sField=='\n')) {
- sField++;
- if (*sField == '\n')
- sField++;
- *pField = *sField;
+ if ((*sField=='\r') || (*sField=='\n'))
+ {
+ int Offset = 1;
+ while (((*(sField + Offset) == '\r') ||
+ (*(sField + Offset) == '\n') ||
+ (isspace(*(sField + Offset)))) &&
+ (sField + Offset < pFieldEnd))
+ Offset ++;
+ sField += Offset;
+ *pField = *sField;
}
else {
if (*sField=='\"') quote = 1 - quote;
strcpy(name, &name[1]);
/* and anything to the right of a @ or % */
- for (a = 0; a < strlen(name); ++a) {
- if (name[a] == '@')
+ for (a = 0; name[a] != '\0'; ++a) {
+ if (name[a] == '@') {
name[a] = 0;
- if (name[a] == '%')
+ break;
+ }
+ if (name[a] == '%') {
name[a] = 0;
+ break;
+ }
}
/* but if there are parentheses, that changes the rules... */
strcpy(&name[0], &name[1]);
}
strcpy(&name[0], &name[1]);
- for (a = 0; a < strlen(name); ++a)
- if (name[a] == 34)
+ for (a = 0; name[a] != '\0'; ++a)
+ if (name[a] == 34) {
name[a] = 0;
+ break;
+ }
}
/* extract user id */
strcpy(user, rfc822);
strcpy(user, &user[1]);
/* and anything to the right of a @ or % */
- for (a = 0; a < strlen(user); ++a) {
- if (user[a] == '@')
+ for (a = 0; user[a] != '\0'; ++a) {
+ if (user[a] == '@') {
user[a] = 0;
- if (user[a] == '%')
+ break;
+ }
+ if (user[a] == '%') {
user[a] = 0;
+ break;
+ }
}
strcpy(node, &node[1]);
/* now get rid of the user portion of a node!user string */
- for (a = 0; a < strlen(node); ++a)
- if (node[a] == '!')
+ for (a = 0; node[a] != '\0'; ++a)
+ if (node[a] == '!') {
node[a] = 0;
+ break;
+ }
}
/* strip leading and trailing spaces in all strings */