Changes in uspace/app/bdsh/cmds/modules/ls/ls.c [f2460a50:8d2dd7f2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/ls/ls.c
rf2460a50 r8d2dd7f2 39 39 #include <vfs/vfs.h> 40 40 #include <str.h> 41 #include <sort.h> 41 42 42 43 #include "ls.h" … … 61 62 static unsigned int ls_start(ls_job_t *); 62 63 static void ls_print(struct dir_elem_t *); 63 static int ls_cmp( const void *, constvoid *);64 static int ls_cmp(void *, void *, void *); 64 65 static signed int ls_scan_dir(const char *, DIR *, struct dir_elem_t **); 65 66 static unsigned int ls_recursive(const char *, DIR *); … … 103 104 * @param a Pointer to the structure of the first element. 104 105 * @param b Pointer to the structure of the second element. 106 * @param arg Pointer for an other and optionnal argument. 105 107 * 106 108 * @return -1 if a < b, 1 otherwise. 107 109 */ 108 static int ls_cmp( const void *a, const void *b)109 { 110 struct dir_elem_t const*da = a;111 struct dir_elem_t const*db = b;110 static int ls_cmp(void *a, void *b, void *arg) 111 { 112 struct dir_elem_t *da = a; 113 struct dir_elem_t *db = b; 112 114 113 115 if ((da->s.is_directory && db->s.is_file) || … … 189 191 } 190 192 191 if (ls.sort) 192 qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t), ls_cmp); 193 if (ls.sort) { 194 if (!qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t), 195 ls_cmp, NULL)) { 196 printf("Sorting error.\n"); 197 } 198 } 193 199 194 200 for (i = 0; i < nbdirs; i++)
Note:
See TracChangeset
for help on using the changeset viewer.