From 2539e7b272995581a2f4ba67c4d86604da1ca171 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 14 Jul 2004 13:09:37 +0000 Subject: [PATCH] More Non-Mac Unix tweaks...now compiles, but needs more work to actually function. --- Makefile | 2 +- platform_unix.c | 37 +++++++++++++++++++++++++++++++++++++ ui_stdio.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5b49cdc..b15a7ff 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ BINDIR := bin SRCDIR := . # must be "macosx" or "unix" or "win32" ... not all necessarily work right now. -platform := macosx +platform := unix # Add zlib support? Will compress all ADD/ADDORREPLACE/PATCH operations. # If you're going to compress the patch anyhow, this might not be wanted. diff --git a/platform_unix.c b/platform_unix.c index bca781b..94e8f67 100644 --- a/platform_unix.c +++ b/platform_unix.c @@ -10,6 +10,7 @@ #include #include #include +#include #if USE_PTHREAD #include @@ -485,6 +486,42 @@ int show_and_install_readme(const char *fname, const char *text) system(cmd); return(1); } /* show_and_install_readme */ + + +#else /* Regular old POSIX-compliant Unix... */ + +int update_version(const char *ver) +{ + /* + * !!! FIXME: need some way to flag this install as updated... + * !!! FIXME: maybe just leave unimplemented? + */ + _fatal("Not implemented!"); + return(0); +} /* show_and_install_readme */ + +int show_and_install_readme(const char *fname, const char *text) +{ + /* + * !!! FIXME: Can just dump to stdout? This should really be in the + * !!! FIXME: UI modules... + */ + _fatal("Not implemented!"); + return(0); +} /* show_and_install_readme */ + + +int chdir_by_identifier(const char *name, const char *str, + const char *version, const char *newversion) +{ + /* + * !!! FIXME: need some way to find the program automatically... + * !!! FIXME: maybe just prompt the user? Oh well. + */ + _fatal("Not implemented!"); + return(0); +} /* chdir_by_identifier */ + #endif diff --git a/ui_stdio.c b/ui_stdio.c index 26fa3b8..c268568 100644 --- a/ui_stdio.c +++ b/ui_stdio.c @@ -1,5 +1,6 @@ #include +#include #include "platform.h" #include "ui.h" @@ -61,7 +62,44 @@ void ui_total_progress(int percent) void ui_status(const char *str) { + printf("Current operation: %s\n", str); } /* ui_status */ + +int ui_prompt_yn(const char *question) +{ + int c; + while (1) + { + printf("%s", question); + c = toupper(getchar()); + if (c == 'N') + return(0); + else if ((c == 'Y') || (c == '\r') || (c == '\n')) + return(1); + printf("\n"); + } /* while */ + + return(1); +} /* ui_prompt_yn */ + + +int ui_prompt_ny(const char *question) +{ + int c; + while (1) + { + printf("%s", question); + c = toupper(getchar()); + if (c == 'Y') + return 1; + else if ((c == 'N') || (c == '\r') || (c == '\n')) + return 0; + printf("\n"); + } /* while */ + + return(0); +} /* ui_prompt_ny */ + /* end of ui_stdio.h ... */