diff options
-rw-r--r-- | Makefile.SH | 2 | ||||
-rw-r--r-- | generate_uudmap.c | 36 | ||||
-rw-r--r-- | vms/descrip_mms.template | 3 | ||||
-rw-r--r-- | win32/Makefile | 2 | ||||
-rw-r--r-- | win32/makefile.mk | 2 |
5 files changed, 34 insertions, 11 deletions
diff --git a/Makefile.SH b/Makefile.SH index f8a115f666..94c1238ff7 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -575,7 +575,7 @@ perlmini\$(OBJ_EXT): perlmini.c globals\$(OBJ_EXT): uudmap.h uudmap.h: generate_uudmap\$(HOST_EXE_EXT) - \$(RUN) ./generate_uudmap\$(HOST_EXE_EXT) >uudmap.h + \$(RUN) ./generate_uudmap\$(HOST_EXE_EXT) uudmap.h generate_uudmap\$(HOST_EXE_EXT): generate_uudmap\$(OBJ_EXT) \$(CC) -o generate_uudmap\$(EXE_EXT) \$(LDFLAGS) generate_uudmap\$(OBJ_EXT) \$(libs) diff --git a/generate_uudmap.c b/generate_uudmap.c index 28cfd274ee..31aba75d86 100644 --- a/generate_uudmap.c +++ b/generate_uudmap.c @@ -1,5 +1,11 @@ #include <stdio.h> #include <stdlib.h> +/* If it turns out that we need to make this conditional on config.sh derived + values, it might be easier just to rip out the use of strerrer(). */ +#include <string.h> +/* If a platform doesn't support errno.h, it's probably so strange that + "hello world" won't port easily to it. */ +#include <errno.h> static const char PL_uuemap[] = "`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; @@ -9,9 +15,21 @@ typedef unsigned char U8; /* This will ensure it is all zeros. */ static char PL_uudmap[256]; -int main() { +int main(int argc, char **argv) { size_t i; char *p; + FILE *uudmap_out; + + if (argc < 2 || argv[1][0] == '\0') { + fprintf(stderr, "Usage: %s uudemap.h\n", argv[0]); + return 1; + } + + if (!(uudmap_out = fopen(argv[1], "w"))) { + fprintf(stderr, "%s: Could not open '%s': %s\n", argv[0], argv[1], + strerror(errno)); + return 1; + } for (i = 0; i < sizeof(PL_uuemap) - 1; ++i) PL_uudmap[(U8)PL_uuemap[i]] = (char)i; @@ -24,18 +42,24 @@ int main() { i = sizeof(PL_uudmap); p = PL_uudmap; - fputs("{\n ", stdout); + fputs("{\n ", uudmap_out); while (i--) { - printf("%d", *p); + fprintf(uudmap_out, "%d", *p); p++; if (i) { - fputs(", ", stdout); + fputs(", ", uudmap_out); if (!(i & 15)) { - fputs("\n ", stdout); + fputs("\n ", uudmap_out); } } } - puts("\n}"); + fputs("\n}\n", uudmap_out); + + if (fclose(uudmap_out)) { + fprintf(stderr, "%s: Could not close '%s': %s\n", argv[0], argv[1], + strerror(errno)); + return 1; + } return 0; } diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index 232c5633ef..6a0668a9ba 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -503,8 +503,7 @@ perlmini$(O) : perlmini.c $(CC) $(CORECFLAGS) $(MMS$SOURCE) uudmap.h : generate_uudmap$(E) - DEFINE/USER_MODE SYS$OUTPUT uudmap.h - MCR SYS$DISK:[]generate_uudmap$(E) + MCR SYS$DISK:[]generate_uudmap$(E) uudmap.h generate_uudmap$(E) : generate_uudmap$(O) $(CRTL) Link $(LINKFLAGS)/NoDebug/Trace/NoMap/NoFull/NoCross/Exe=$(MMS$TARGET) generate_uudmap$(O) $(CRTLOPTS) diff --git a/win32/Makefile b/win32/Makefile index 4ba35b769b..9eed88325f 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -1000,7 +1000,7 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ) $(MINIDIR)\globals$(o) : $(UUDMAP_H) $(UUDMAP_H) : $(GENUUDMAP) - $(GENUUDMAP) >$(UUDMAP_H) + $(GENUUDMAP) $(UUDMAP_H) $(GENUUDMAP) : $(GENUUDMAP_OBJ) $(LINK32) -subsystem:console -out:$@ @<< diff --git a/win32/makefile.mk b/win32/makefile.mk index a6ab156cd7..c5abb46b29 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1301,7 +1301,7 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ) $(MINIDIR)\globals$(o) : $(UUDMAP_H) $(UUDMAP_H) : $(GENUUDMAP) - $(GENUUDMAP) >$(UUDMAP_H) + $(GENUUDMAP) $(UUDMAP_H) $(GENUUDMAP) : $(GENUUDMAP_OBJ) .IF "$(CCTYPE)" == "BORLAND" |