[debian-edu-commits] [Debian Wiki] Update of "DebianEdu/BrowserMultimedia" by PetterReinholdtsen

Debian Wiki debian-www at lists.debian.org
Thu Jul 18 07:26:16 UTC 2013


Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Debian Wiki" for change notification.

The "DebianEdu/BrowserMultimedia" page has been changed by PetterReinholdtsen:
http://wiki.debian.org/DebianEdu/BrowserMultimedia?action=diff&rev1=70&rev2=71

Comment:
Rewrite the code to fetch the MIME status to use dlopen() and the correct symbol name.

  
  cat > x.c <<EOF
  #include <stdio.h>
+ #include <dlfcn.h>
+ 
  int main(int argc, char *argv[]) {
-   printf("%s\n", NPP_GetMIMEDescription());
+   void *lib_handle;
+   char *error;
+   lib_handle = dlopen(argv[1], RTLD_LAZY);
+   if (!lib_handle) {
+     fprintf(stderr, "error: unable to load library\n");
+     return(1);
+   }
+   char * (*func)(void);
+   func = dlsym(lib_handle, "NP_GetMIMEDescription");
+   if (NULL != (error = dlerror())) {
+     fprintf(stderr, "error: from dlsym: %s\n", error);
+     return 1;
+   }
+   char *mimedesc = (*func)();
+   printf("%s\n", mimedesc);
+   dlclose(lib_handle);
    return 0;
  }
  EOF
  
+ gcc -o x x.c -ldl
+ 
  ( for f in /usr/lib/mozilla/plugins/*.so; do
-     gcc -o x x.c $f -Wl,-rpath,/usr/lib/mozilla/plugins > /dev/null 2>&1
      pkg=`dpkg -S $f|cut -d: -f1`
      ver=`dpkg -l $pkg|awk '/^ii/ {print $3}' | sed s/:/_/g`
      if [ "$pkg" ] ; then
-       if [ -x x ] ; then
+       if [ -x ./x ] ; then
+         if ./x $f > /dev/null 2>&1 ; then
-         ./x | sed "s/;/;\n/g" | sed "s%^%$pkg:$ver:%" | sort
+           ./x $f | sed "s/;/;\n/g" | sed "s%^%$pkg:$ver:%" | sort
-       else
+         else
-         #echo error: Unable to fetch info from $f 1>&2
+           echo echo error: unable to get MIME info from $f 1>&2
+         fi
-         for mime in $(strings $f |egrep '(audio|video|application|image)/') ; do
-           echo "$pkg:$ver:$mime::;"
-         done
        fi
      fi
  done ) | perl -e '



More information about the debian-edu-commits mailing list