aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/main.c b/main.c
index de3ed72a..45cae61d 100644
--- a/main.c
+++ b/main.c
@@ -68,6 +68,7 @@ static void version(void) ATTRIBUTE_NORETURN;
static void init_fds(void);
static void init_groupset(void);
static void save_argv(int, char **);
+static const char *platform_name();
/* These nodes store all the special variables AWK uses */
NODE *ARGC_node, *ARGIND_node, *ARGV_node, *BINMODE_node, *CONVFMT_node;
@@ -981,6 +982,7 @@ load_procinfo()
update_PROCINFO_str("version", VERSION);
update_PROCINFO_str("strftime", def_strftime_format);
+ update_PROCINFO_str("platform", platform_name());
#ifdef HAVE_MPFR
sprintf(name, "GNU MPFR %s", mpfr_get_version());
@@ -1769,3 +1771,24 @@ set_locale_stuff(void)
(void) bindtextdomain(PACKAGE, locale_dir);
(void) textdomain(PACKAGE);
}
+
+/* platform_name --- return the platform name */
+
+static const char *
+platform_name()
+{
+ // Cygwin and Mac OS X count as POSIX
+#if defined(__VMS)
+ return "vms";
+#elif defined(__MINGW32__)
+ return "mingw";
+#elif defined(__DJGPP__)
+ return "djgpp";
+#elif defined(__EMX__)
+ return "os2";
+#elif defined(USE_EBCDIC)
+ return "os390";
+#else
+ return "posix";
+#endif
+}