summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <me@armaanb.net>2021-05-09 16:31:17 -0400
committerArmaan Bhojwani <me@armaanb.net>2021-05-09 16:49:46 -0400
commitbb708b3691abc66edeb976ca3279481e11177450 (patch)
treeb1199948d745fee03793c16e54bb2842cc2ee934
parent1c32b10c0c5e3cb5c7c622b1ff0249889d81175e (diff)
downloadmmenu-bb708b3691abc66edeb976ca3279481e11177450.tar.gz
Fix style
-rw-r--r--mmenu.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/mmenu.c b/mmenu.c
index 01a8963..8691b45 100644
--- a/mmenu.c
+++ b/mmenu.c
@@ -58,7 +58,7 @@ getmenu(char *date)
const char *baseurl =
"https://nobilis.nobles.edu/skyworld/castlemenu.php?Date=";
int len = strlen(baseurl) + strlen(date) + 1;
- char *url = (char *)malloc(len);
+ char *url = (char *) malloc(len);
snprintf(url, len, "%s%s", baseurl, date);
printf("INFO: Using URL %s\n", url);
curl_easy_setopt(curl, CURLOPT_URL, url);
@@ -71,7 +71,7 @@ getmenu(char *date)
free(url);
if (res != CURLE_OK) {
- fprintf(stderr,"ERROR: Could not fetch webpage\n%s\n",
+ fprintf(stderr,"ERROR: Could not fetch webpage:\n%s\n",
curl_easy_strerror(res));
exit(1);
}
@@ -136,17 +136,20 @@ dayback(Widget unused, XtPointer client_data, XtPointer call_data)
free(oldtext);
}
-// Convert an array of string to an array of compound strings
-XmStringTable ArgvToXmStringTable (int argc, char **argv)
+// Convert an array of strings to an array of compound strings
+XmStringTable
+ArgvToXmStringTable (int argc, char **argv)
{
XmStringTable new =
- (XmStringTable) XtMalloc ((argc+1) * sizeof (XmString));
- if (!new)
- return (XmStringTable) 0;
+ (XmStringTable) XtMalloc((argc+1) * sizeof (XmString));
+ if (!new) return (XmStringTable) 0;
+
new[argc] = (XmString) 0;
- while (--argc >= 0)
+ while (--argc >= 0) {
new[argc] = XmStringGenerate ((XtPointer) argv[argc], "tag2",
- XmCHARSET_TEXT, NULL);
+ XmCHARSET_TEXT, NULL);
+ }
+
return new;
}
@@ -162,14 +165,14 @@ main(int argc, char *argv[])
Widget toplevel, rowcol, daysel, disp;
XmStringTable strs;
XtAppContext app;
- Arg args[5];
+ Arg args[0];
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaOpenApplication(&app, "Castle Menu", NULL, 0, &argc, argv,
NULL, sessionShellWidgetClass, NULL);
int n = 0;
- XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++;
+ XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
rowcol = XmCreateRowColumn(toplevel, "rowcol", args, n);
XtManageChild(rowcol);
@@ -180,14 +183,14 @@ main(int argc, char *argv[])
XtSetArg(args[n], XmNeditable, False); n++;
XtSetArg(args[n], XmNcolumns, 80); n++;
XtSetArg(args[n], XmNrows, 20); n++;
- XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
+ XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
XtSetArg(args[n], XmNcursorPositionVisible, False); n++;
disp = XmCreateScrolledText(rowcol, "text", args, n);
XtManageChild(disp);
free(nl);
// Create day selector
- strs = ArgvToXmStringTable (XtNumber(days), days);
+ strs = ArgvToXmStringTable(XtNumber(days), days);
daysel = XmCreateScrolledList(rowcol, "list", NULL, 0);
XtVaSetValues(daysel, XmNitems, strs, XmNitemCount, XtNumber(days), NULL);
XtAddCallback(daysel, XmNbrowseSelectionCallback, dayback, (XtPointer) disp);