Skip to content

Commit c6d0641

Browse files
committed
Use constants for copyright and package name to avoid duplication
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
1 parent 1ddd17a commit c6d0641

File tree

16 files changed

+51
-41
lines changed

16 files changed

+51
-41
lines changed

lib/global.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ mc_global_t mc_global =
114114

115115
};
116116

117+
const char PACKAGE_COPYRIGHT[] = N_ ("Copyright (C) 1996-2025 the Free Software Foundation");
118+
117119
#undef SUBSHELL_USE
118120

119121
/*** file scope macro definitions ****************************************************************/

lib/global.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ typedef struct
224224
/*** global variables defined in .c file *********************************************************/
225225

226226
extern mc_global_t mc_global;
227+
extern const char PACKAGE_COPYRIGHT[];
227228

228229
/*** declarations of public functions ************************************************************/
229230

maint/update-years.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ for i in $SOURCES; do
2121
done
2222

2323
# special case
24-
${SED-sed} -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c > src/editor/editwidget.c.tmp && \
25-
mv -f src/editor/editwidget.c.tmp src/editor/editwidget.c
24+
${SED-sed} -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" lib/global.c > lib/global.c.tmp && \
25+
mv -f lib/global.c.tmp lib/global.c
2626

2727
# restore permissions
2828
chmod 755 tests/src/vfs/extfs/helpers-list/test_all

src/args.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,10 @@ mc_args_add_extended_info_to_help (void)
459459
{
460460
mc_args__loc__footer_string =
461461
g_strdup_printf (_ ("\n"
462-
"Please send any bug reports (including the output of 'mc -V')\n"
462+
"Please send any bug reports (including the output of '%s -V')\n"
463463
"as tickets at %s\n"),
464-
PACKAGE_BUGREPORT);
465-
mc_args__loc__header_string = g_strdup_printf (PACKAGE_NAME " %s\n", mc_global.mc_version);
464+
PACKAGE, PACKAGE_BUGREPORT);
465+
mc_args__loc__header_string = g_strdup_printf ("%s %s\n", PACKAGE_NAME, mc_global.mc_version);
466466

467467
g_option_context_set_description (context, mc_args__loc__footer_string);
468468
g_option_context_set_summary (context, mc_args__loc__header_string);

src/diffviewer/ydiff.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,15 +2966,17 @@ dview_ok_to_exit (WDiff *dview)
29662966
{
29672967
gboolean res = TRUE;
29682968
int act;
2969+
char *text;
29692970

29702971
if (!dview->merged[DIFF_LEFT] && !dview->merged[DIFF_RIGHT])
29712972
return res;
29722973

2973-
act = query_dialog (_ ("Quit"),
2974-
!mc_global.midnight_shutdown
2975-
? _ ("File(s) was modified. Save with exit?")
2976-
: _ ("Midnight Commander is being shut down.\nSave modified file(s)?"),
2977-
D_NORMAL, 2, _ ("&Yes"), _ ("&No"));
2974+
text = g_strdup_printf (!mc_global.midnight_shutdown
2975+
? _ ("File(s) was modified. Save with exit?")
2976+
: _ ("%s is being shut down.\nSave modified file(s)?"),
2977+
PACKAGE_NAME);
2978+
act = query_dialog (_ ("Quit"), text, D_NORMAL, 2, _ ("&Yes"), _ ("&No"));
2979+
g_free (text);
29782980

29792981
// Esc is No
29802982
if (mc_global.midnight_shutdown || (act == -1))

src/editor/editcmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ edit_ok_to_exit (WEdit *edit)
14741474
}
14751475
else
14761476
{
1477-
msg = g_strdup_printf (_ ("Midnight Commander is being shut down.\nSave modified file %s?"),
1477+
msg = g_strdup_printf (_ ("%s is being shut down.\nSave modified file %s?"), PACKAGE_NAME,
14781478
fname);
14791479
act = edit_query_dialog2 (_ ("Quit"), msg, _ ("&Yes"), _ ("&No"));
14801480

src/editor/editwidget.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,20 @@ edit_dlg_deinit (void)
137137
static void
138138
edit_about (void)
139139
{
140-
char *ver;
140+
char *ver, *desc;
141141

142142
ver = g_strdup_printf ("MCEdit %s", mc_global.mc_version);
143+
desc = g_strdup_printf (N_ ("A user friendly text editor\n"
144+
"written for the %s."),
145+
PACKAGE_NAME);
143146

144147
{
145148
quick_widget_t quick_widgets[] = {
146149
QUICK_LABEL (ver, NULL),
147150
QUICK_SEPARATOR (TRUE),
148-
QUICK_LABEL (N_ ("A user friendly text editor\n"
149-
"written for the Midnight Commander."),
150-
NULL),
151+
QUICK_LABEL (desc, NULL),
151152
QUICK_SEPARATOR (FALSE),
152-
QUICK_LABEL (N_ ("Copyright (C) 1996-2025 the Free Software Foundation"), NULL),
153+
QUICK_LABEL (PACKAGE_COPYRIGHT, NULL),
153154
QUICK_START_BUTTONS (TRUE, TRUE),
154155
QUICK_BUTTON (N_ ("&OK"), B_ENTER, NULL, NULL),
155156
QUICK_END,
@@ -174,6 +175,7 @@ edit_about (void)
174175
}
175176

176177
g_free (ver);
178+
g_free (desc);
177179
}
178180

179181
/* --------------------------------------------------------------------------------------------- */

src/execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ toggle_subshell (void)
505505
{
506506
if (output_starts_shell)
507507
{
508-
fputs (_ ("Type 'exit' to return to the Midnight Commander"), stderr);
508+
fprintf (stderr, _ ("Type 'exit' to return to the %s"), PACKAGE_NAME);
509509
fputs ("\n\r\n\r", stderr);
510510

511511
my_system (EXECUTE_INTERNAL, mc_global.shell->path, NULL);

src/filemanager/boxes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ about_box (void)
493493
char *label_cp_display;
494494
char *label_cp_source;
495495

496-
char *version = g_strdup_printf ("Midnight Commander %s", mc_global.mc_version);
496+
char *version = g_strdup_printf ("%s %s", PACKAGE_NAME, mc_global.mc_version);
497497

498498
const char *name_cp_display =
499499
((codepage_desc *) g_ptr_array_index (codepages, mc_global.display_codepage))->name;
@@ -512,7 +512,7 @@ about_box (void)
512512
QUICK_SEPARATOR (TRUE),
513513
QUICK_LABEL (N_ ("Classic terminal file manager inspired by Norton Commander."), NULL),
514514
QUICK_SEPARATOR (FALSE),
515-
QUICK_LABEL (N_ ("Copyright (C) 1996-2025 the Free Software Foundation"), NULL),
515+
QUICK_LABEL (PACKAGE_COPYRIGHT, NULL),
516516
QUICK_SEPARATOR (TRUE),
517517
QUICK_LABEL (label_cp_display, NULL),
518518
QUICK_LABEL (label_cp_source, NULL),

src/filemanager/ext.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,9 @@ check_old_extension_file (void)
772772
extension_old_file = mc_config_get_full_path (MC_EXT_OLD_FILE);
773773
if (exist_file (extension_old_file))
774774
message (D_ERROR, _ ("Warning"),
775-
_ ("You have an outdated %s file.\nMidnight Commander now uses %s file.\n"
775+
_ ("You have an outdated %s file.\n%s now uses %s file.\n"
776776
"Please copy your modifications of the old file to the new one."),
777-
extension_old_file, MC_EXT_FILE);
777+
extension_old_file, PACKAGE_NAME, MC_EXT_FILE);
778778
g_free (extension_old_file);
779779
}
780780

@@ -825,8 +825,8 @@ load_extension_file (void)
825825
message (D_ERROR, MSG_ERROR,
826826
_ ("The format of the\n%s%s\nfile has changed with version 4.0.\n"
827827
"It seems that the installation has failed.\nPlease fetch a fresh copy "
828-
"from the Midnight Commander package."),
829-
mc_global.sysconfig_dir, MC_EXT_FILE);
828+
"from the %s package."),
829+
mc_global.sysconfig_dir, MC_EXT_FILE, PACKAGE_NAME);
830830
return FALSE;
831831
}
832832

0 commit comments

Comments
 (0)