summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-03-05 22:43:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-03-05 22:43:46 +0000
commit26a387d5919bba9ccdb8a8447daa114204a997c4 (patch)
treec76ed77468ddcf8ff471514aa3b0eb2b0ee300c4 /perl-install/c
parent0bb6afa215fff585416bc88aa967c7e1eb61672e (diff)
downloaddrakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar.gz
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar.bz2
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar.xz
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.zip
no_comment
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/Makefile.PL2
-rw-r--r--perl-install/c/stuff.pm2
-rw-r--r--perl-install/c/stuff.xs.pm72
3 files changed, 69 insertions, 7 deletions
diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL
index aa4032bb3..4e76dea67 100644
--- a/perl-install/c/Makefile.PL
+++ b/perl-install/c/Makefile.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-my $libs = '-L/usr/X11R6/lib -lX11 -lgdk';
+my $libs = '-L/usr/X11R6/lib -lX11 -lgdk -lXxf86misc';
$libs .= ' -lrpm -ldb1 -lz' if $ENV{C_RPM};
diff --git a/perl-install/c/stuff.pm b/perl-install/c/stuff.pm
index 2cea57d2c..ab6fc4669 100644
--- a/perl-install/c/stuff.pm
+++ b/perl-install/c/stuff.pm
@@ -21,10 +21,10 @@ sub headerGetEntry {
$q eq 'description' and return headerGetEntry_string($h, RPMTAG_DESCRIPTION());
$q eq 'arch' and return headerGetEntry_string($h, RPMTAG_ARCH());
$q eq 'size' and return headerGetEntry_int($h, RPMTAG_SIZE());
- $q eq 'filenames' and return headerGetEntry_string_list($h, RPMTAG_FILENAMES());
$q eq 'obsoletes' and return headerGetEntry_string_list($h, RPMTAG_OBSOLETES());
$q eq 'requires' and return headerGetEntry_string_list($h, RPMTAG_REQUIRENAME());
$q eq 'fileflags' and return headerGetEntry_int_list($h, RPMTAG_FILEFLAGS());
+ $q eq 'filenames' and return headerGetEntry_filenames($h);
}
1;
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm
index d4a272a53..5aaef8605 100644
--- a/perl-install/c/stuff.xs.pm
+++ b/perl-install/c/stuff.xs.pm
@@ -24,11 +24,15 @@ print '
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
+#include <X11/extensions/xf86misc.h>
#define SECTORSIZE 512
';
$ENV{C_RPM} and print '
+#undef Fflush
+#undef Mkdir
+#undef Stat
#include <rpm/rpmlib.h>
void rpmError_callback_empty(void) {}
@@ -42,9 +46,11 @@ void rpmError_callback(void) {
}
FD_t fd2FD_t(int fd) {
- static struct _FD f = { -1, NULL, NULL, NULL };
- f.fd_fd = fd;
- return fd == -1 ? NULL : &f;
+ static FD_t f = NULL;
+ if (fd == -1) return NULL;
+ if (f == NULL) f = fdNew("");
+ fdSetFdno(f, fd);
+ return f;
}
';
@@ -73,6 +79,24 @@ Xtest(display)
RETVAL
void
+setMouse(display, type)
+ char *display
+ int type
+ CODE:
+ {
+ XF86MiscMouseSettings mseinfo;
+ Display *d = XOpenDisplay(display);
+ if (d) {
+ if (XF86MiscGetMouseSettings(d, &mseinfo) == True) {
+ mseinfo.type = type;
+ mseinfo.flags = 128;
+ XF86MiscSetMouseSettings(d, &mseinfo);
+ XFlush(d);
+ }
+ }
+ }
+
+void
XSetInputFocus(window)
int window
CODE:
@@ -655,7 +679,7 @@ headerGetEntry_int_list(h, query)
int query
PPCODE:
int i, type, count = 0;
- int_32 *intlist = (void **) NULL;
+ int_32 *intlist = (int_32 *) NULL;
if (headerGetEntry((Header) h, query, &type, (void**) &intlist, &count)) {
if (count > 0) {
EXTEND(SP, count);
@@ -681,6 +705,44 @@ headerGetEntry_string_list(h, query)
}
free(strlist);
}
+
+void
+headerGetEntry_filenames(h)
+ void *h
+ PPCODE:
+ int i, type, count = 0;
+ char ** baseNames, ** dirNames;
+ int_32 * dirIndexes;
+ char **strlist = (char **) NULL;
+
+ if (headerGetEntry((Header) h, RPMTAG_OLDFILENAMES, &type, (void**) &strlist, &count)) {
+ if (count > 0) {
+ EXTEND(SP, count);
+ for (i = 0; i < count; i++) {
+ PUSHs(sv_2mortal(newSVpv(strlist[i], 0)));
+ }
+ }
+ free(strlist);
+ } else {
+
+ headerGetEntry(h, RPMTAG_BASENAMES, &type, (void **) &baseNames, &count);
+ headerGetEntry(h, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes, NULL);
+ headerGetEntry(h, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL);
+
+ if (baseNames && dirNames && dirIndexes) {
+ EXTEND(SP, count);
+ for(i = 0; i < count; i++) {
+ char *p = malloc(strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1);
+ if (p == NULL) croak("malloc failed");
+ strcpy(p, dirNames[dirIndexes[i]]);
+ strcat(p, baseNames[i]);
+ PUSHs(sv_2mortal(newSVpv(p, 0)));
+ free(p);
+ }
+ free(baseNames);
+ free(dirNames);
+ }
+ }
';
@macros = (
@@ -690,7 +752,7 @@ headerGetEntry_string_list(h, query)
VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE CDROM_LOCKDOOR CDROMEJECT
) ],
);
-push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_ARCH RPMTAG_FILENAMES RPMTAG_OBSOLETES RPMTAG_REQUIRENAME RPMTAG_FILEFLAGS RPMFILE_CONFIG) ]
+push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_ARCH RPMTAG_OBSOLETES RPMTAG_REQUIRENAME RPMTAG_FILEFLAGS RPMFILE_CONFIG) ]
if $ENV{C_RPM};
$\= "\n";