Skip to content

Commit fb034cc

Browse files
committed
Updated arguments handling.
1 parent be44bbe commit fb034cc

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

srcs/flipclock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,14 +883,14 @@ void flipclock_print_help(struct flipclock *app, char program_name[])
883883
printf("\t%cp <HWND>\t(Windows only) Preview in given window.\n",
884884
OPT_START);
885885
#endif
886-
printf("\t%cS\t\tShow second.\n", OPT_START);
886+
printf("\t%c3\t\tShow second.\n", OPT_START);
887887
printf("\t%cw\t\tRun as a window instead of fullscreen.\n", OPT_START);
888888
printf("\t%ct <12|24>\tToggle 12-hour clock format (AM/PM) "
889889
"or 24-hour clock format.\n",
890890
OPT_START);
891891
printf("\t%cf <font>\tLoad custom font path.\n", OPT_START);
892892
printf("Press Esc or q to exit.\n");
893-
printf("Press s to toggle second display.\n");
893+
printf("Press s to toggle second.\n");
894894
printf("Press f to toggle fullscreen.\n");
895895
printf("Press t to toggle 12/24-hour clock format.\n");
896896
printf("Using configuration file %s.\n", app->conf_path);

srcs/main.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ int main(int argc, char *argv[])
2626
#if !defined(__ANDROID__)
2727
// Android don't need conf and arguments.
2828
flipclock_load_conf(app);
29+
# if defined(__DEBUG__)
30+
for (int i = 0; i < argc; ++i)
31+
LOG_DEBUG("argv[%d]: %s\n", i, argv[i]);
32+
# endif
2933
# if defined(_WIN32)
30-
char OPT_STRING[] = "hvscp:Swt:f:";
34+
char OPT_STRING[] = "hvscp:3wt:f:";
3135
# else
32-
char OPT_STRING[] = "hvSwt:f:";
36+
char OPT_STRING[] = "hv3wt:f:";
3337
# endif
3438
int opt = 0;
3539
bool exit_after_argument = false;
@@ -77,14 +81,21 @@ int main(int argc, char *argv[])
7781
* typedef void *PVOID;
7882
* typedef PVOID HANDLE;
7983
* typedef HANDLE HWND;
80-
* So it's safe to treat it as a unsigned int.
84+
* So it's safe to treat it as a unsigned int, even
85+
* though silly MSVC will complain. If MSVC is unhappy,
86+
* why not tell us how to handle it correctly?
8187
* Seems Windows print HWND as a decimal number,
8288
* so %p with scanf() is not suitable here.
8389
*/
8490
app->preview_window = strtoul(argopt, NULL, 0);
8591
break;
8692
# endif
87-
case 'S':
93+
/**
94+
* Windows taken `/s` for screensaver, and if you run `.scr`
95+
* file from explorer, it will add `/S`! What a silly behavior,
96+
* so we cannot use those chars.
97+
*/
98+
case '3':
8899
app->show_second = true;
89100
break;
90101
case 'w':

0 commit comments

Comments
 (0)