Hi,

looking through my trees for diffs that were forgotten, i found this one.

Spell uses nothing locale-dependent, and it will never need support for
non-English characters because the basic algorithms used are specific
to the English language in the first place.

So delete <locale.h> and setlocale(3) without functional change.

While here, make usage() static and return() from main rather than exit(3).

Minimially tweaked diff originally from Jan Stary.

OK?
  Ingo


Index: spellprog.c
===================================================================
RCS file: /cvs/src/usr.bin/spell/spellprog.c,v
retrieving revision 1.12
diff -u -p -r1.12 spellprog.c
--- spellprog.c 10 Oct 2015 19:11:04 -0000      1.12
+++ spellprog.c 28 Oct 2016 07:53:39 -0000
@@ -72,7 +72,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
-#include <locale.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -108,7 +107,7 @@ char        *estrdup(const char *);
 void    ise(void);
 void    print_word(FILE *);
 void    ztos(char *);
-__dead void usage(void);
+static void __dead usage(void);
 
 /* from look.c */
 int     look(unsigned char *, unsigned char *, unsigned char *);
@@ -247,8 +246,6 @@ main(int argc, char **argv)
        struct stat sb;
        FILE *file, *found;
 
-       setlocale(LC_ALL, "");
-
        if (pledge("stdio rpath wpath cpath", NULL) == -1)
                err(1, "pledge");
 
@@ -316,7 +313,7 @@ main(int argc, char **argv)
                        if (ch == EOF) {
                                if (found != NULL)
                                        fclose(found);
-                               exit(0);
+                               return (0);
                        }
                }
                for (cp = word, dp = original; cp < ep; )
@@ -345,7 +342,7 @@ lcase:
                file = stdout;
        }
 
-       exit(0);
+       return (0);
 }
 
 void
@@ -788,7 +785,7 @@ dict(char *bp, char *ep)
        return (rval);
 }
 
-__dead void
+static void __dead
 usage(void)
 {
        extern char *__progname;

Reply via email to