From 26a387d5919bba9ccdb8a8447daa114204a997c4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 5 Mar 2000 22:43:46 +0000 Subject: no_comment --- perl-install/c/Makefile.PL | 2 +- perl-install/c/stuff.pm | 2 +- perl-install/c/stuff.xs.pm | 72 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 69 insertions(+), 7 deletions(-) (limited to 'perl-install/c') 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 #include +#include #define SECTORSIZE 512 '; $ENV{C_RPM} and print ' +#undef Fflush +#undef Mkdir +#undef Stat #include 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; } '; @@ -72,6 +78,24 @@ Xtest(display) OUTPUT: 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 @@ -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"; -- cgit v1.2.1