diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2014-04-13 14:30:56 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2014-04-13 14:30:56 -0400 |
commit | 94e3f93395de538d73826e128281a3ea9591a5a9 (patch) | |
tree | 45257e4b024537c5e0e5a3037a99ea9765583c99 /vms/vms_args.c | |
parent | c4300d657ba49db0b6d0f0884f41a29622edc58b (diff) | |
parent | a4b59faf911743b30f2e6e979c4f9c1ea0669ac3 (diff) | |
download | egawk-94e3f93395de538d73826e128281a3ea9591a5a9.tar.gz egawk-94e3f93395de538d73826e128281a3ea9591a5a9.tar.bz2 egawk-94e3f93395de538d73826e128281a3ea9591a5a9.zip |
Merge branch 'master' into select
Diffstat (limited to 'vms/vms_args.c')
-rw-r--r-- | vms/vms_args.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/vms/vms_args.c b/vms/vms_args.c index 0a296105..12165131 100644 --- a/vms/vms_args.c +++ b/vms/vms_args.c @@ -1,7 +1,7 @@ /* vms_args.c -- command line parsing, to emulate shell i/o redirection. [ Escape sequence parsing now suppressed. ] - Copyright (C) 1991-1996, 1997, 2011 the Free Software Foundation, Inc. + Copyright (C) 1991-1996, 1997, 2011, 2014 the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -106,10 +106,26 @@ vms_arg_fixup( int *pargc, char ***pargv ) char **argv = *pargv; int i, argc = *pargc; int err_to_out_redirect = 0, out_to_err_redirect = 0; + char * shell; + int using_shell; /* make sure AWK_LIBRARY has a value */ if (!getenv("AWK_LIBRARY")) vms_define("AWK_LIBRARY", "SYS$LIBRARY:"); + + /* Check if running under a shell instead of DCL */ + using_shell = 1; + shell = getenv("SHELL"); + if (shell != NULL) { + if (strcmp(shell, "DCL") == 0) { + using_shell = 0; + } + } else { + using_shell = 0; + } + if (using_shell) { + return; + } #ifdef CHECK_DECSHELL /* don't define this if linking with DECC$SHR */ if (shell$is_shell()) return; /* don't do anything if we're running DEC/Shell */ @@ -325,12 +341,12 @@ vms_expand_wildcards( const char *prospective_filespec ) */ len = -1; /* overload 'len' with flag value */ context = NULL; /* init */ - while (vmswork(lib$find_file(&spec, &result, &context))) { + while (vmswork(LIB$FIND_FILE(&spec, &result, &context))) { for (len = sizeof(res_buf)-1; len > 0 && res_buf[len-1] == ' '; len--) ; res_buf[len] = '\0'; /* terminate after discarding trailing blanks */ v_add_arg(v_argc++, strdup(res_buf)); /* store result */ } - (void)lib$find_file_end(&context); + (void)LIB$FIND_FILE_END(&context); if (len >= 0) /* (still -1 => never entered loop) */ --v_argc; /* undo final post-increment */ return; @@ -395,7 +411,7 @@ vms_define( const char *log_name, const char *trans_val ) log_dsc.len = len; itemlist[0].buffer = (char *)trans_val; itemlist[0].len = strlen(trans_val); - return sys$crelnm(&attr, &lnmtable, &log_dsc, &acmode, itemlist); + return SYS$CRELNM(&attr, &lnmtable, &log_dsc, &acmode, itemlist); } /* t_strstr -- strstr() substitute; search 'str' for 'sub' */ |