commit 2c7eec83c6d91083326d161be2f054ba3140f10e
parent ee381667162de8734a3a37af8f91567dbe94a9b1
Author: Bakar Chargeishvili <bakar@bcharge.de>
Date: Wed, 18 Dec 2024 17:27:51 +0100
Improve the coding style
Diffstat:
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/welcome.c b/welcome.c
@@ -29,7 +29,8 @@ typedef struct {
int fetch_complete; // Flag to indicate when fetching is done
} FetchData;
-void init_string(string *s) {
+void init_string(string *s)
+{
s->len = 0;
s->ptr = malloc(s->len+1);
if (s->ptr == NULL) {
@@ -79,7 +80,8 @@ int curl(char* input, string* output)
return 0;
}
-int syspipe(char* input, char* output, size_t* max_width) {
+int syspipe(char* input, char* output, size_t* max_width)
+{
//char buf[11500] = {0};
char* buf = output;
@@ -114,7 +116,8 @@ int syspipe(char* input, char* output, size_t* max_width) {
return 0;
}
-int print_greet(WINDOW* frame) {
+int print_greet(WINDOW* frame)
+{
char buf[500] = {0};
const char *cmd = "figlet Welcome Bakar!";
@@ -180,9 +183,9 @@ int main()
print_greet(mainframe);
wattroff(mainframe,A_BLINK);
- /*****************************
- * Extract the information *
- *****************************/
+ /****************************
+ * Extract the information *
+ *****************************/
FetchData data = {0};
init_string(&data.location);
init_string(&data.temperature);
@@ -225,16 +228,15 @@ int main()
while (!data.fetch_complete);
if(data.events[0]=='\0')
- strcpy(data.events,"🎉 Looks like you have not planned anything 🎉\n"
- );
+ strcpy(data.events,"🎉 Looks like you have not planned anything 🎉\n");
// Wait for fetch thread to complete
pthread_join(fetch_thread, NULL);
- /***************************
- * Print the information *
- ***************************/
+ /**************************
+ * Print the information *
+ ***************************/
wprintw(mainframe, "Today is:\t\t%s\n" , data.today);
wprintw(mainframe, "We are in:\t\t%s\n" , data.location.ptr);
wprintw(mainframe, "Temperature:\t\t%s\n" , data.temperature.ptr);