aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-03-23 19:25:39 +0100
committerMattias Andrée <m@maandree.se>2025-03-23 19:25:39 +0100
commit0644dfde1f691df65851940738aad522857b71aa (patch)
tree21c3e7756d9acb1a67884cb1fce14d2e2319f185
parentAdd ability to select multiple screens (diff)
downloadredshift-ng-0644dfde1f691df65851940738aad522857b71aa.tar.gz
redshift-ng-0644dfde1f691df65851940738aad522857b71aa.tar.bz2
redshift-ng-0644dfde1f691df65851940738aad522857b71aa.tar.xz
Clean up
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r--TODO1
-rw-r--r--src/backend-direct.c18
-rw-r--r--src/common.h11
-rw-r--r--src/config.c4
-rw-r--r--src/gamma-coopgamma.c28
-rw-r--r--src/gamma-drm.c8
-rw-r--r--src/gamma-dummy.c6
-rw-r--r--src/gamma-quartz.c8
-rw-r--r--src/gamma-randr.c8
-rw-r--r--src/gamma-vidmode.c8
-rw-r--r--src/gamma-w32gdi.c8
-rw-r--r--src/location-corelocation.m6
-rw-r--r--src/location-geoclue2.c6
-rw-r--r--src/location-manual.c23
14 files changed, 68 insertions, 75 deletions
diff --git a/TODO b/TODO
index f813cc0..463050f 100644
--- a/TODO
+++ b/TODO
@@ -147,5 +147,4 @@ Document option delimiter for -l and -m
The method option "display" requires support for ":", use ";" delimit after "display"
":" cannot be changed to ";" for all options are this would break backwards
compatibility; however ";" could be supported in addition to ":" for all options
-remove FILE argument for print_help
print, for use by frontends, what mode redshift was started in
diff --git a/src/backend-direct.c b/src/backend-direct.c
index 37c82c6..f92cb7d 100644
--- a/src/backend-direct.c
+++ b/src/backend-direct.c
@@ -256,38 +256,38 @@ direct_create(struct gamma_state **state_out, int method, const char *method_nam
void
-direct_print_help(FILE *f, int method)
+direct_print_help(int method)
{
struct libgamma_method_capabilities caps;
if (libgamma_method_capabilities(&caps, sizeof(caps), method)) {
- fprintf(f, _("Adjustment method not available\n"));
- fprintf(f, "\n");
+ printf(_("Adjustment method not available\n"));
+ printf("\n");
return;
}
if (caps.multiple_sites)
- fprintf(f, " display=%s %s\n", _("NAME "), _("Display server instance to apply adjustments to"));
+ printf(" display=%s %s\n", _("NAME "), _("Display server instance to apply adjustments to"));
if (caps.multiple_partitions && caps.partitions_are_graphics_cards) {
/* TRANSLATORS: "N" represents "ordinal"; right-pad with spaces to preserve display width */
- fprintf(f, " card=%s %s\n", _("N "), _("Graphics card to apply adjustments to"));
+ printf(" card=%s %s\n", _("N "), _("Graphics card to apply adjustments to"));
} else if (caps.multiple_partitions) {
/* TRANSLATORS: "N" represents "ordinal"; right-pad with spaces to preserve display width */
- fprintf(f, " screen=%s %s\n", _("N "), _("List of comma-separated X screens to apply adjustments to"));
+ printf(" screen=%s %s\n", _("N "), _("List of comma-separated X screens to apply adjustments to"));
}
if (caps.multiple_crtcs) {
/* TRANSLATORS: "N" represents "number"; right-pad with spaces to preserve display width */
- fprintf(f, " crtc=%s %s\n", _("N "), _("List of comma-separated CRTCs to apply adjustments to"));
+ printf(" crtc=%s %s\n", _("N "), _("List of comma-separated CRTCs to apply adjustments to"));
}
if (caps.multiple_crtcs && (caps.crtc_information & LIBGAMMA_CRTC_INFO_EDID)) {
- fprintf(f, " edid=%s %s\n", _("EDID "), _("List of comma-separated EDIDS of monitors to apply "
+ printf(" edid=%s %s\n", _("EDID "), _("List of comma-separated EDIDS of monitors to apply "
"adjustments to, enter `list' to list available monitors"));
}
if (caps.multiple_sites || caps.multiple_partitions || caps.multiple_crtcs)
- fprintf(f, "\n");
+ printf("\n");
}
diff --git a/src/common.h b/src/common.h
index 1b352f2..fa1a0f2 100644
--- a/src/common.h
+++ b/src/common.h
@@ -957,10 +957,8 @@ struct gamma_method {
/**
* Print help on options for the adjustment method
- *
- * @param f Output sink
*/
- void (*print_help)(FILE *f);
+ void (*print_help)(void);
/**
* Finalise option-dependent initialisation and connections
@@ -1054,10 +1052,8 @@ struct location_provider {
/**
* Print help on options for the location provider
- *
- * @param f Output sink
*/
- void (*print_help)(FILE *f);
+ void (*print_help)(void);
/**
* Finalise option-dependent initialisation and connections
@@ -1204,10 +1200,9 @@ int direct_create(GAMMA_STATE **state_out, int method, const char *method_name);
/**
* Print help on options for the adjustment method using direct gamma adjustments
*
- * @param f Output sink
* @param method libgamma constant for the adjustment method
*/
-void direct_print_help(FILE *f, int method);
+void direct_print_help(int method);
/**
* Configure the adjustment method using direct gamma adjustments
diff --git a/src/config.c b/src/config.c
index dc6e47c..5261c10 100644
--- a/src/config.c
+++ b/src/config.c
@@ -756,7 +756,7 @@ load_from_cmdline(struct settings *settings, int argc, char *argv[])
/* Print provider help if arg is `help'. */
if (settings->provider_args && !strcasecmp(settings->provider_args, "help")) {
- settings->provider->print_help(stdout);
+ settings->provider->print_help();
exit(0);
}
break;
@@ -782,7 +782,7 @@ load_from_cmdline(struct settings *settings, int argc, char *argv[])
/* Print method help if arg is `help'. */
if (settings->method_args && !strcasecmp(settings->method_args, "help")) {
- settings->method->print_help(stdout);
+ settings->method->print_help();
exit(0);
}
break;
diff --git a/src/gamma-coopgamma.c b/src/gamma-coopgamma.c
index 6025da7..f51c0ee 100644
--- a/src/gamma-coopgamma.c
+++ b/src/gamma-coopgamma.c
@@ -390,22 +390,20 @@ coopgamma_free(struct gamma_state *state)
static void
-coopgamma_print_help(FILE *f) /* TODO not documented in readme and manpage */
+coopgamma_print_help(void) /* TODO not documented in readme and manpage */
{
- fputs(_("Adjust gamma ramps with coopgamma.\n"), f);
- fputs("\n", f);
-
- /* TRANSLATORS: coopgamma help output left column must not be translated */
- fputs(_(" edid=EDID \tEDID of monitor to apply adjustments to, enter "
- "`list' to list available monitors\n"
- " crtc=N \tIndex of CRTC to apply adjustments to\n"
- " priority=N \tThe application order of the adjustments, "
- "default value is 576460752303423488.\n"
- " method=METHOD \tUnderlaying adjustment method, enter "
- "`list' to list available methods\n"
- " display=DISPLAY\tThe display to apply adjustments to\n"),
- f);
- fputs("\n", f);
+ printf(_("Adjust gamma ramps with coopgamma.\n"));
+ printf("\n");
+
+ printf(" display=%s %s\n", _("NAME "), _("Display server instance to apply adjustments to"));
+ printf(" crtc=%s %s\n", _("N "), _("Index of CRTC to apply adjustments to"));
+ printf(" edid=%s %s\n", _("EDID "), _("EDID of monitor to apply adjustments to, "
+ "enter `list' to list available monitors"));
+ printf(" priority=%s %s\n", _("N "), _("The application order of the adjustments, "
+ "default value is 576460752303423488"));
+ printf(" method=%s %s\n", _("NAME "), _("Underlaying adjustment method, "
+ "enter `list' to list available methods"));
+ printf("\n");
}
diff --git a/src/gamma-drm.c b/src/gamma-drm.c
index 196b4dd..cecc836 100644
--- a/src/gamma-drm.c
+++ b/src/gamma-drm.c
@@ -35,11 +35,11 @@ drm_create(struct gamma_state **state_out)
static void
-drm_print_help(FILE *f)
+drm_print_help(void)
{
- fputs(_("Adjust gamma ramps with Direct Rendering Manager.\n"), f);
- fputs("\n", f);
- direct_print_help(f, LIBGAMMA_METHOD_LINUX_DRM);
+ printf(_("Adjust gamma ramps with Direct Rendering Manager.\n"));
+ printf("\n");
+ direct_print_help(LIBGAMMA_METHOD_LINUX_DRM);
}
diff --git a/src/gamma-dummy.c b/src/gamma-dummy.c
index ba9480a..de4b687 100644
--- a/src/gamma-dummy.c
+++ b/src/gamma-dummy.c
@@ -59,10 +59,10 @@ dummy_free(struct gamma_state *state)
static void
-dummy_print_help(FILE *f)
+dummy_print_help(void)
{
- fputs(_("Does not affect the display but prints the color temperature to the terminal.\n"), f);
- fputs("\n", f);
+ printf(_("Does not affect the display but prints the color temperature to the terminal.\n"));
+ printf("\n");
}
diff --git a/src/gamma-quartz.c b/src/gamma-quartz.c
index 38e476d..c303031 100644
--- a/src/gamma-quartz.c
+++ b/src/gamma-quartz.c
@@ -35,11 +35,11 @@ quartz_create(struct gamma_state **state_out)
static void
-quartz_print_help(FILE *f)
+quartz_print_help(void)
{
- fputs(_("Adjust gamma ramps on macOS using Quartz.\n"), f);
- fputs("\n", f);
- direct_print_help(f, LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS);
+ printf(_("Adjust gamma ramps on macOS using Quartz.\n"));
+ printf("\n");
+ direct_print_help(LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS);
}
diff --git a/src/gamma-randr.c b/src/gamma-randr.c
index f10a95b..1ccd277 100644
--- a/src/gamma-randr.c
+++ b/src/gamma-randr.c
@@ -35,11 +35,11 @@ randr_create(struct gamma_state **state_out)
static void
-randr_print_help(FILE *f)
+randr_print_help(void)
{
- fputs(_("Adjust gamma ramps with the X RANDR extension.\n"), f);
- fputs("\n", f);
- direct_print_help(f, LIBGAMMA_METHOD_X_RANDR);
+ printf(_("Adjust gamma ramps with the X RANDR extension.\n"));
+ printf("\n");
+ direct_print_help(LIBGAMMA_METHOD_X_RANDR);
}
diff --git a/src/gamma-vidmode.c b/src/gamma-vidmode.c
index 634fc37..5c2bdf3 100644
--- a/src/gamma-vidmode.c
+++ b/src/gamma-vidmode.c
@@ -35,11 +35,11 @@ vidmode_create(struct gamma_state **state_out)
static void
-vidmode_print_help(FILE *f)
+vidmode_print_help(void)
{
- fputs(_("Adjust gamma ramps with the X VidMode extension.\n"), f);
- fputs("\n", f);
- direct_print_help(f, LIBGAMMA_METHOD_X_VIDMODE);
+ printf(_("Adjust gamma ramps with the X VidMode extension.\n"));
+ printf("\n");
+ direct_print_help(LIBGAMMA_METHOD_X_VIDMODE);
}
diff --git a/src/gamma-w32gdi.c b/src/gamma-w32gdi.c
index 4f766a2..751d9fd 100644
--- a/src/gamma-w32gdi.c
+++ b/src/gamma-w32gdi.c
@@ -35,11 +35,11 @@ w32gdi_create(struct gamma_state **state_out)
static void
-w32gdi_print_help(FILE *f)
+w32gdi_print_help(void)
{
- fputs(_("Adjust gamma ramps with the Windows GDI.\n"), f);
- fputs("\n", f);
- direct_print_help(f, LIBGAMMA_METHOD_W32_GDI);
+ printf(_("Adjust gamma ramps with the Windows GDI.\n"));
+ printf("\n");
+ direct_print_help(LIBGAMMA_METHOD_W32_GDI);
}
diff --git a/src/location-corelocation.m b/src/location-corelocation.m
index c53ed14..035dda7 100644
--- a/src/location-corelocation.m
+++ b/src/location-corelocation.m
@@ -256,10 +256,10 @@ corelocation_free(struct location_state *state)
static void
-corelocation_print_help(FILE *f)
+corelocation_print_help(void)
{
- fputs(_("Use the location as discovered by the Corelocation provider.\n"), f);
- fputs("\n", f);
+ printf(_("Use the location as discovered by the Corelocation provider.\n"));
+ printf("\n");
}
diff --git a/src/location-geoclue2.c b/src/location-geoclue2.c
index ced6eb8..199db2d 100644
--- a/src/location-geoclue2.c
+++ b/src/location-geoclue2.c
@@ -396,10 +396,10 @@ geoclue2_free(struct location_state *state)
static void
-geoclue2_print_help(FILE *f)
+geoclue2_print_help(void)
{
- fputs(_("Use the location as discovered by a GeoClue2 provider.\n"), f);
- fputs("\n", f);
+ printf(_("Use the location as discovered by a GeoClue2 provider.\n"));
+ printf("\n");
}
diff --git a/src/location-manual.c b/src/location-manual.c
index d1285f1..c6c679e 100644
--- a/src/location-manual.c
+++ b/src/location-manual.c
@@ -56,18 +56,19 @@ manual_free(struct location_state *state)
static void
-manual_print_help(FILE *f)
+manual_print_help(void)
{
- fputs(_("Specify location manually.\n"), f);
- fputs("\n", f);
-
- /* TRANSLATORS: Manual location help output left column must not be translated */
- fputs(_(" lat=N\t\tLatitude\n"
- " lon=N\t\tLongitude\n"), f);
- fputs("\n", f);
- fputs(_("Both values are expected to be floating point numbers,\n"
- "negative values representing west / south, respectively.\n"), f);
- fputs("\n", f);
+ printf(_("Specify location manually.\n"));
+ printf("\n");
+
+ /* TRANSLATORS: "N" represents "cardinal"; right-pad with spaces to preserve display width */
+ printf(" lat=%s %s\n", _("N "), _("Latitude"));
+ printf(" lon=%s %s\n", _("N "), _("Longitude"));
+ printf("\n");
+
+ printf(_("Both values are expected to be floating point numbers,\n"
+ "negative values representing west / south, respectively.\n"));
+ printf("\n");
}