openbsd-ports/devel/prc-tools/patches/patch-prc-tools-0_5_0_build-prc_c
pvalchev 9ea0627237 Re-enable this port.
Still FAKE=No as it installs things during build time.
2001-08-30 22:16:42 +00:00

53 lines
1.2 KiB
Plaintext

$OpenBSD: patch-prc-tools-0_5_0_build-prc_c,v 1.2 2001/08/30 22:16:42 pvalchev Exp $
--- ../prc-tools-0.5.0/build-prc.c.orig Fri Jun 27 10:59:32 1997
+++ ../prc-tools-0.5.0/build-prc.c Wed Aug 22 12:23:06 2001
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <string.h>
#include "prc.h"
#ifdef __CYGWIN32__
@@ -17,6 +18,21 @@
#define O_PLATFORM 0
#endif
+char *
+basename(char *path)
+{
+ char *name;
+
+ name = strrchr(path, '/');
+ if (name) {
+ name++;
+ } else {
+ name = path;
+ }
+
+ return name;
+}
+
main(int argc, char *argv[])
{
pfd_t *pf;
@@ -64,6 +80,8 @@ main(int argc, char *argv[])
/* the .prc write routines write the resources in reverse order! */
for (i=argc-1; i > optind + 2; i--) {
+ char *name;
+
if ((fd = open(argv[i], O_PLATFORM | O_RDONLY)) < 1) {
fprintf(stderr, "Can't open resource file %s\n",argv[i]);
exit(3);
@@ -76,7 +94,8 @@ main(int argc, char *argv[])
read(fd, sd, slen);
close (fd);
- add_section_pfd(pf, argv[i], strtoul(argv[i] + 4, (void *)0, 16),
+ name = basename(argv[i]);
+ add_section_pfd(pf, name, strtoul(name + 4, (void *)0, 16),
sd, slen);
}