Selaa lähdekoodia

No longer set LC_CTYPE and switch to using cisalpha and cisdigit instead

Wichert Akkerman 24 vuotta sitten
vanhempi
commit
23df49b33d
8 muutettua tiedostoa jossa 23 lisäystä ja 19 poistoa
  1. 7 0
      ChangeLog
  2. 2 2
      dpkg-deb/build.c
  3. 0 1
      dselect/main.cc
  4. 2 2
      lib/dbmodify.c
  5. 6 6
      lib/vercmp.c
  6. 5 6
      main/main.c
  7. 0 1
      main/query.c
  8. 1 1
      main/remove.c

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+Mon Dec 31 17:38:26 CET 2001 Wichert Akkerman <wakkerma@debian.org>
+
+  * dselect/main.cc, main/main.c, main/query.c: no longer set LC_CTYPE
+    to C since that breaks the braindead gettext.
+  * dpkg-deb/build.c, lib/dbmodify.c, lib/vercmp.c, main/remove.c: Switch
+    to using cisdigit and cisalpha.
+
 Mon Dec 31 17:28:10 CET 2001 Wichert Akkerman <wakkerma@debian.org>
 
   * lib/utils.c: new file with general utility functions. Add

+ 2 - 2
dpkg-deb/build.c

@@ -3,7 +3,7 @@
  * build.c - building archives
  *
  * Copyright (C) 1994,1995 Ian Jackson <iwj10@cus.cam.ac.uk>
- * Copyright (C) 2000 Wichert Akkerman <wakkerma@debian.org>
+ * Copyright (C) 2000,2001 Wichert Akkerman <wakkerma@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -62,7 +62,7 @@ struct _finfo {
 static void checkversion(const char *vstring, const char *valuename, int *errs) {
   const char *p;
   if (!vstring || !*vstring) return;
-  for (p=vstring; *p; p++) if (isdigit(*p)) return;
+  for (p=vstring; *p; p++) if (cisdigit(*p)) return;
   fprintf(stderr, _("dpkg-deb - error: %s (`%s') doesn't contain any digits\n"),
           valuename, vstring);
   (*errs)++;

+ 0 - 1
dselect/main.cc

@@ -470,7 +470,6 @@ int main(int, const char *const *argv) {
   char *home, *homerc;
 
   setlocale(LC_ALL, "");
-  setlocale(LC_CTYPE, "C");
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 

+ 2 - 2
lib/dbmodify.c

@@ -53,7 +53,7 @@ static int ulist_select(const struct dirent *de) {
   const char *p;
   int l;
   for (p= de->d_name, l=0; *p; p++, l++)
-    if (!isdigit(*p)) return 0;
+    if (!cisdigit(*p)) return 0;
   if (l > IMPORTANTMAXLEN)
     ohshit(_("updates directory contains file `%.250s' whose name is too long "
            "(length=%d, max=%d)"), de->d_name, l, IMPORTANTMAXLEN);
@@ -101,7 +101,7 @@ static void cleanupdates(void) {
 }
 
 static void createimptmp(void) {
-  int i, f;
+  int i;
   
   onerr_abort++;
   

+ 6 - 6
lib/vercmp.c

@@ -34,9 +34,9 @@ int epochsdiffer(const struct versionrevision *a,
 
 /* assume ascii; warning: evaluates x multiple times! */
 #define order(x) ((x) == '~' ? -1 \
-		: isdigit((x)) ? 0 \
+		: cisdigit((x)) ? 0 \
 		: !(x) ? 0 \
-		: isalpha((x)) ? (x) \
+		: cisalpha((x)) ? (x) \
 		: (x) + 256)
 
 static int verrevcmp(const char *val, const char *ref) {
@@ -46,7 +46,7 @@ static int verrevcmp(const char *val, const char *ref) {
   while (*val || *ref) {
     int first_diff= 0;
 
-    while ( (*val && !isdigit(*val)) || (*ref && !isdigit(*ref)) ) {
+    while ( (*val && !cisdigit(*val)) || (*ref && !cisdigit(*ref)) ) {
       int vc= order(*val), rc= order(*ref);
       if (vc != rc) return vc - rc;
       val++; ref++;
@@ -54,12 +54,12 @@ static int verrevcmp(const char *val, const char *ref) {
 
     while ( *val == '0' ) val++;
     while ( *ref == '0' ) ref++;
-    while (isdigit(*val) && isdigit(*ref)) {
+    while (cisdigit(*val) && cisdigit(*ref)) {
       if (!first_diff) first_diff= *val - *ref;
       val++; ref++;
     }
-    if (isdigit(*val)) return 1;
-    if (isdigit(*ref)) return -1;
+    if (cisdigit(*val)) return 1;
+    if (cisdigit(*ref)) return -1;
     if (first_diff) return first_diff;
   }
   return 0;

+ 5 - 6
main/main.c

@@ -364,19 +364,19 @@ static const struct cmdinfo cmdinfos[]= {
   ACTION( "configure",                       0,  act_configure,            packages        ),
   ACTION( "remove",                         'r', act_remove,               packages        ),
   ACTION( "purge",                          'P', act_purge,                packages        ),
-  ACTIONBACKEND( "listfiles",                     'L', DPKGQUERY),
-  ACTIONBACKEND( "status",                        's', DPKGQUERY),
+  ACTIONBACKEND( "listfiles",               'L', DPKGQUERY),
+  ACTIONBACKEND( "status",                  's', DPKGQUERY),
   ACTION( "get-selections",                  0,  act_getselections,        getselections   ),
   ACTION( "set-selections",                  0,  act_setselections,        setselections   ),
-  ACTIONBACKEND( "print-avail",                   'p', DPKGQUERY),
+  ACTIONBACKEND( "print-avail",             'p', DPKGQUERY),
   ACTION( "update-avail",                    0,  act_avreplace,            updateavailable ),
   ACTION( "merge-avail",                     0,  act_avmerge,              updateavailable ),
   ACTION( "clear-avail",                     0,  act_avclear,              updateavailable ),
   ACTION( "forget-old-unavail",              0,  act_forgetold,            forgetold       ),
   ACTION( "audit",                          'C', act_audit,                audit           ),
   ACTION( "yet-to-unpack",                   0,  act_unpackchk,            unpackchk       ),
-  ACTIONBACKEND( "list",                          'l', DPKGQUERY),
-  ACTIONBACKEND( "search",                        'S', DPKGQUERY),
+  ACTIONBACKEND( "list",                    'l', DPKGQUERY),
+  ACTIONBACKEND( "search",                  'S', DPKGQUERY),
   ACTION( "print-architecture",              0,  act_printarch,            printarch       ),
   ACTION( "print-gnu-build-architecture",    0,  act_printgnuarch,         printarch       ),
   ACTION( "assert-support-predepends",       0,  act_assertpredep,         assertpredep    ),
@@ -550,7 +550,6 @@ int main(int argc, const char *const *argv) {
   char *home, *homerc;
 
   setlocale(LC_ALL, "");
-  setlocale(LC_CTYPE, "C");
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 

+ 0 - 1
main/query.c

@@ -534,7 +534,6 @@ int main(int argc, const char *const *argv) {
   static void (*actionfunction)(const char *const *argv);
 
   setlocale(LC_ALL, "");
-  setlocale(LC_CTYPE, "C");
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 

+ 1 - 1
main/remove.c

@@ -412,7 +412,7 @@ void removal_bulk(struct pkginfo *pkg) {
             if (!strcmp(*ext,de->d_name+conffbasenamelen)) goto yes_remove;
           p= de->d_name+conffbasenamelen;
           if (*p++ == '~') {
-            while (*p && isdigit(*p)) p++;
+            while (*p && cisdigit(*p)) p++;
             if (*p == '~' && !*++p) goto yes_remove;
           }
         }