Public feed
#529017
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#define PORT 80
#define MAXDATASIZE 100
int main(int argc, char *argv[]){
char mylink[100], mydomain[100], mydomainf[100];
char *p, *p2;
if(argc < 2){
printf("usage: ./rss-get feed-url\n");
exit(1);
}
strcpy(mydomain, argv[1]);
p = strchr(mydomain, '.'); // get addr of first '.'
if (!p) error(); // empty p?
p2 = strchr(p, '/'); // get addr of following '/'
if (p2 != NULL) *p2 = 0; // empty? no, end string there
if ( !strncmp( mydomain, "http://", 7 )){ // find string
mydomainf = mydomain + 7; // set new start addr
} else { // or
mydomainf = mydomain; // leave the same
}
printf("Domain: %s\n", mydomain);
printf("Feed URL: %s\n", argv[1]);
} // MAIN