summaryrefslogtreecommitdiff
path: root/patches/debian-changes-0.9.2-2.1
blob: c66d16f1e53092dbff4d7e8b23569a543e46d078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Description: Upstream changes introduced in version 0.9.2-2.1
 This patch has been created by dpkg-source during the package build.
 Here's the last changelog entry, hopefully it gives details on why
 those changes were made:
 .
 gmrun (0.9.2-2.1) unstable; urgency=low
 .
   * Non-maintainer upload.
   * Use patch from Rafael Cunha de Almeida to build using glibc's alphasort
     (Closes: #570348)
 .
 The person named in the Author field signed this changelog entry.
Author: Christoph Egger <christoph@debian.org>
Bug-Debian: http://bugs.debian.org/570348

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gmrun-0.9.2.orig/src/gtkcompletionline.cc
+++ gmrun-0.9.2/src/gtkcompletionline.cc
@@ -374,6 +374,27 @@ select_executables_only(const struct dir
   return 0;
 }
 
+int my_alphasort(const struct dirent** a, const struct dirent** b) {
+  const char* s1 = (*a)->d_name;
+  const char* s2 = (*b)->d_name;
+
+  int l1 = strlen(s1);
+  int l2 = strlen(s2);
+  int result = strcmp(s1, s2);
+
+  if (result == 0) return 0;
+
+  if (l1 < l2) {
+    int res2 = strncmp(s1, s2, l1);
+    if (res2 == 0) return -1;
+  } else {
+    int res2 = strncmp(s1, s2, l2);
+    if (res2 == 0) return 1;
+  }
+
+  return result;
+}
+
 static void
 generate_execs()
 {
@@ -381,7 +402,7 @@ generate_execs()
 
   for (StrSet::iterator i = path.begin(); i != path.end(); i++) {
     struct dirent **eps;
-    int n = scandir(i->c_str(), &eps, select_executables_only, alphasort);
+    int n = scandir(i->c_str(), &eps, select_executables_only, my_alphasort);
     if (n >= 0) {
       for (int j = 0; j < n; j++) {
         execs.insert(eps[j]->d_name);
@@ -481,7 +502,7 @@ generate_dirlist(const char *what)
   dirlist.clear();
   struct dirent **eps;
   prefix = filename;
-  n = scandir(dest.c_str(), &eps, select_executables_only, alphasort);
+  n = scandir(dest.c_str(), &eps, select_executables_only, my_alphasort);
   if (n >= 0) {
     for (int j = 0; j < n; j++) {
       {