/* extract URLs in a line and hyperlink it */ int PrintLink(line) char *line; { int i, j, k, len; char *ptr; char buf[256]; len = strlen(line); if ( strstr(line, "From: ") || strstr(line, "Reply-To: ") ) { if (ptr = (char *) strstr(line, "@")) { i = 1; while (*(ptr-i) != ' ' && *(ptr-i) != '(' &&\ *(ptr-i) != '[' && *(ptr-i) != '<') { i++; } j = 1; while (*(ptr+j) != ' ' && *(ptr+j) != ')' &&\ *(ptr+j) != ']' && *(ptr+j) != '>' &&\ *(ptr+j) != '\n' && *(ptr+j) != '\0') { j++; } for (k=0; k < i+j-1; k++) { buf[k] = *(ptr-i+1+k); } buf[k] = '\0'; for (k=0; k%s", buf, buf); ptr = (char *) strstr(line, buf); printf("%s", ptr+strlen(buf)); return 1; } else printf("%s", line); return 1; } /* unrefences here */ else if ( !strncmp(line, "References:", 11) ) return 1; else if ( !strncmp(line, "Message-ID:", 11) ) return 1; else if ( !strncmp(line, "Group:", 6) ) return 1; else if ( !strncmp(line, "Id:", 3) ) return 1; else if ( strstr(line, "www.herp-edia.com") ) return 1; /* else if ( strstr(line, "Message-ID: ") ) { len = strlen(line); for (i=0; len; i++) { if (line[i] == '<') printf("<"); else if (line[i] == '>') printf(">"); else printf("%c", line[i]); } return 1; } */ else if ( (ptr = (char *) strstr(line, "http://")) ) { i = 0; while ( *(ptr+i) != '\0' && *(ptr+i) != '\n' && \ *(ptr+i) != ' ' && *(ptr+i) != ')' && \ *(ptr+i) != '\"' && *(ptr+i) != '\'' && \ *(ptr+i) != ']' && *(ptr+i) != '>' ) { buf[i] = *(ptr+i); i++; } buf[i] = '\0'; for (j=0; j%s", buf, buf); ptr = (char *) strstr(line, buf); printf("%s", ptr+strlen(buf)); return 1; } else if ( (ptr = (char *) strstr(line, "ftp://")) ) { i = 0; while ( *(ptr+i) != '\0' && *(ptr+i) != '\n' && \ *(ptr+i) != ' ' && *(ptr+i) != ')' && \ *(ptr+i) != '\"' && *(ptr+i) != '\'' && \ *(ptr+i) != ']' && *(ptr+i) != '>' ) { buf[i] = *(ptr+i); i++; } buf[i] = '\0'; for (j=0; j%s", buf, buf); ptr = (char *) strstr(line, buf); printf("%s", ptr+strlen(buf)); return 1; } else if ( !strncmp(line, "Subject: ", 9) ) { if (len > 65) { for (i = 61, j=0; i < len; i++) { if (line[i] == ' ') { line[i] = '\0'; printf("%s\n %s", line, line+i+1); j = 1; break; } } if (j == 0) printf("%s", line); } else printf("%s", line); } else if ( !strncmp(line, "Newsgroups: ", 12) ) { for (i=0; i < len; i++) { if ( line[i] == ',' ) { putchar(','); printf("\n "); } else putchar(line[i]); } } else printf("%s", line); return 1; }