dlopen.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <errno.h>
00003 #include <unistd.h>
00004 #include <dlfcn.h>
00005 
00006 int main(int argc, char** argv){
00007     int ok = 0;
00008     int i;
00009     for (i = 1; i < argc; i++) {
00010         if (strchr(argv[i],'?') || strchr(argv[i], '*'))
00011             continue;
00012         if (dlopen(argv[i], RTLD_NOW)) {
00013             printf("%s: OK\n", argv[i]);
00014             ok = 1;
00015         } else {
00016             char buf[1024] = {0};
00017             int j;
00018             snprintf(buf, sizeof(buf)-1, dlerror());
00019             for( j = strlen(buf)-1; j >= 0; j--) {
00020                 if (buf[j] >= 0x20)
00021                     buf[j] ^= 0x1F;
00022             }
00023             printf("%s: %s\n", argv[i], buf);
00024         }
00025     }
00026     return ok ? 0 : -1;
00027 }


dji_ronin
Author(s):
autogenerated on Sat Jun 8 2019 20:15:31