diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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 +} |