Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cbourke committed Sep 4, 2023
1 parent b4b7db6 commit e0ca9c3
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 19 deletions.
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ library, you may find the following documentation useful:
- `rss.h`
- `rss.c`
through the handin and verify it compiles and works through the
grader.
and verify it compiles and works through the grader.
2. Even if you worked with a partner, you *both* should turn in all
files.
Expand Down
7 changes: 5 additions & 2 deletions rss/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# makefile for the RSS lab
#
#

# compile with gcc
CC = gcc -std=gnu99 -Wall
Expand All @@ -15,6 +15,9 @@ CURL_LIB = -lcurl
runRss: runRss.c rss_utils.o rss.o curl_utils.o
$(CC) $(XML_INCLUDE) -o runRss runRss.c curl_utils.o rss_utils.o rss.o $(XML_LIB) $(CURL_LIB)

rssTest: rssTest.c rss.o
$(CC) $(XML_INCLUDE) -o rssTest rssTest.c rss.o

rss_utils.o: rss_utils.c rss_utils.h
$(CC) -Wno-pointer-sign $(XML_INCLUDE) -c -o rss_utils.o rss_utils.c $(XML_LIB)

Expand All @@ -27,5 +30,5 @@ curl_utils.o: curl_utils.c curl_utils.h
curlTest: curl_utils.o
$(CC) -o curlTest curl_utils.o curlTest.c $(CURL_LIB)

clean:
clean:
rm -f *.o *~
16 changes: 8 additions & 8 deletions rss/rss.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@

#include "rss.h"

// TODO: implement these functions

Rss * createEmptyRss() {

// TODO: implement this functions
}

Rss * createRss(const char * title, const char * link, const char * date, const char * description) {

// TODO: implement this functions
}

void initRss(Rss *feed, const char* title, const char* link, const char* date,
const char* description) {

void initRss(Rss *feed, const char* title, const char* link, const char* date, const char* description) {
// TODO: implement this functions
}

char *rssToString(const Rss *item) {
// TODO: implement this functions
}

void printRss(const Rss * item) {

// TODO: implement this functions
}
6 changes: 6 additions & 0 deletions rss/rss.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ void initRss(Rss *feed,
const char* date,
const char* description);

/**
* A function to construct a (human-readable) string representation
* of the given RSS item.
*/
char *rssToString(const Rss *item);

/**
* A function that prints the given Rss structure
* to the standard output.
Expand Down
30 changes: 30 additions & 0 deletions rss/rssTest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* A stand alone test utility for your rss functions.
*
*/
#include <stdlib.h>
#include <stdio.h>

#include "rss.h"

int main(int argc, char **argv) {

Rss *empty = createEmptyRss();

Rss test01;
initRss(&test01,
"RSS TEST 001 - Title",
"RSS TEST 001 - Link",
"RSS TEST 001 - Date",
"RSS TEST 001 - Description");
Rss *test02 = createRss(
"RSS TEST 002 - Title",
"RSS TEST 002 - Link",
"RSS TEST 002 - Date",
"RSS TEST 002 - Description");

printRss(&test01);
printRss(test02);

return 0;
}
30 changes: 24 additions & 6 deletions rss/rss_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,39 @@ typedef struct {
Version type;
} RssService;

/**
* RSS feed for the School of Computing's weekly
* Bits and Bytes newsletter
*/
static const RssService cseBitsAndBytes = {
"CSE Bits and Bytes",
"SoC Bits and Bytes",
"https://newsroom.unl.edu/announce/cse/?format=rss",
RSS2};
RSS2
};

/**
* RSS feed for Husker athletics news
*/
static const RssService huskerNews = {
"Husker Sports News",
"https://huskers.com/rss.aspx",
RSS2};
"https://huskers.com/rss.aspx",
RSS2
};

/**
* RSS feed for the University of Nebraska-Omaha
*/
static const RssService unoNews = {
"University of Nebraska-Omaha",
"https://www.unomaha.edu/news/index.rss",
RSS2
};

/**
* An RSS feed of Reddit's front page.
* An RSS feed of Reddit's front page.
*/
static const RssService reddit = {
"Reddit",
"Reddit",
"https://www.reddit.com/.rss",
ATOM1};

Expand Down
4 changes: 3 additions & 1 deletion rss/runRss.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* command line arguments 1 - 3 to connect to different feeds.
*/
int main(int argc, char **argv) {
// default: UNL News
// default: School of Computing News
RssService s = cseBitsAndBytes;

if (argc > 1) {
Expand All @@ -23,6 +23,8 @@ int main(int argc, char **argv) {
s = huskerNews;
} else if (choice == 3) {
s = reddit;
} else if (choice == 4) {
s = unoNews;
}
}

Expand Down

0 comments on commit e0ca9c3

Please sign in to comment.