-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mehmetmertguduz
committed
May 28, 2024
1 parent
d766fdd
commit 920d7d3
Showing
9 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @file post_error_msg.c | ||
* | ||
* @brief This file is used to output the error when the parsing is faced with an error in the post section. | ||
* | ||
* @author Mehmet Mert Gunduz ([email protected]) | ||
* | ||
* @date 28/05/2024 | ||
*/ | ||
|
||
#include "yiffy_messages.h" | ||
|
||
/** | ||
* @brief Outputs the error when the parsing is faced with an error in the post section. | ||
*/ | ||
void post_error_msg() | ||
{ | ||
fprintf(stderr, "yiffy: post data is not in correct format, not able to parse JSON.\n"); | ||
fprintf(stderr, "yiffy: please try giving different tags.\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @file posts_not_array_error_msg.c | ||
* | ||
* @brief This file is used to output the error when the parsing is faced with an error in the posts section. | ||
* | ||
* @author Mehmet Mert Gunduz ([email protected]) | ||
* | ||
* @date 28/05/2024 | ||
*/ | ||
|
||
#include "yiffy_messages.h" | ||
|
||
/** | ||
* @brief Outputs the error when the parsing is faced with an error in the posts section. | ||
*/ | ||
void posts_not_array_error_msg() | ||
{ | ||
fprintf(stderr, "yiffy: format is not in array type, not able to parse JSON.\n"); | ||
fprintf(stderr, "yiffy: please try giving different tags.\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* @file write_post.c | ||
* | ||
* @brief This file is used to write posts to the posts window. | ||
* | ||
* @author Mehmet Mert Gunduz ([email protected]) | ||
* | ||
* @date 28/05/2024 | ||
*/ | ||
|
||
#include "yiffy_search.h" | ||
|
||
/// @brief Writes posts to the posts window. | ||
/// @param window Posts window. | ||
/// @param post_i The index of the post. | ||
/// @param url The url of the post with specified index. | ||
void write_post(WINDOW *window, size_t post_i, cJSON *url) | ||
{ | ||
/* Make the first post blinking. */ | ||
if (post_i == 0) | ||
{ | ||
wattron(window, A_STANDOUT); | ||
} | ||
|
||
/* Write the post URL. */ | ||
mvwprintw(window, post_i + 1, 1, "%s", url->valuestring); | ||
|
||
/* Close the post blinking. */ | ||
if (post_i == 0) | ||
{ | ||
wattroff(window, A_STANDOUT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters