/usr/share/doc/uthash-dev/examples/test44.c is in uthash-dev 1.9.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #include <stdio.h>
#include "utarray.h"
int reverse(const void *a,const void*b) {
int _a = *(int*)a;
int _b = *(int*)b;
return _b - _a;
}
int main() {
UT_array *a;
int i, *p;
utarray_new(a, &ut_int_icd);
for(i=0;i<10;i++) utarray_push_back(a,&i);
for(p=(int*)utarray_front(a); p; p=(int*)utarray_next(a,p)) printf("%d ",*p);
printf("\n");
utarray_sort(a,reverse);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_erase(a,3,3);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_erase(a,1,2);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_erase(a,0,1);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_erase(a,3,1);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_resize(a,5);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_resize(a,3);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_erase(a,0,3);
while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);
printf("\n");
utarray_free(a);
return 0;
}
|