Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109075268
D34081.id102062.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34081.id102062.diff
View Options
diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h
--- a/usr.bin/sort/sort.h
+++ b/usr.bin/sort/sort.h
@@ -49,7 +49,8 @@
#include <nl_types.h>
extern nl_catd catalog;
-#define getstr(n) catgets(catalog, 1, n, nlsstr[n])
+#define getstr(n) \
+ (catalog == (nl_catd)-1 ? nlsstr[n] : catgets(catalog, 1, n, nlsstr[n]))
#endif
extern const char *nlsstr[];
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -57,7 +57,7 @@
#ifndef WITHOUT_NLS
#include <nl_types.h>
-nl_catd catalog;
+nl_catd catalog = (nl_catd)-1;
#endif
#define OPTIONS "bcCdfghik:Mmno:RrsS:t:T:uVz"
@@ -1011,6 +1011,10 @@
set_tmpdir();
set_sort_opts();
+#ifndef WITHOUT_NLS
+ catalog = catopen("sort", NL_CAT_LOCALE);
+#endif
+
fix_obsolete_keys(&argc, argv);
while (((c = getopt_long(argc, argv, OPTIONS, long_options, NULL))
@@ -1194,17 +1198,9 @@
argv = argv_from_file0;
}
-#ifndef WITHOUT_NLS
- catalog = catopen("sort", NL_CAT_LOCALE);
-#endif
-
if (sort_opts_vals.cflag && sort_opts_vals.mflag)
errx(1, "%c:%c: %s", 'm', 'c', getstr(1));
-#ifndef WITHOUT_NLS
- catclose(catalog);
-#endif
-
if (keys_num == 0) {
keys_num = 1;
keys = sort_realloc(keys, sizeof(struct key_specs));
@@ -1343,5 +1339,10 @@
sort_free(outfile);
+#ifndef WITHOUT_NLS
+ if (catalog != (nl_catd)-1)
+ catclose(catalog);
+#endif
+
return (result);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 1, 11:26 AM (18 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16382567
Default Alt Text
D34081.id102062.diff (1 KB)
Attached To
Mode
D34081: sort: Fix message catalogue usage
Attached
Detach File
Event Timeline
Log In to Comment