| Deutsch English Français Italiano |
|
<vorei9$8d0i$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: =?UTF-8?Q?Arne_Vajh=C3=B8j?= <arne@vajhoej.dk>
Newsgroups: comp.os.vms
Subject: Re: Local Versus Global Command Options
Date: Sat, 15 Feb 2025 20:21:12 -0500
Organization: A noiseless patient Spider
Lines: 99
Message-ID: <vorei9$8d0i$1@dont-email.me>
References: <volt3s$33lo1$1@dont-email.me> <vonh1j$3fukn$1@dont-email.me>
<vonr8r$3ghb6$1@dont-email.me> <voo40m$3jej5$1@dont-email.me>
<vookpo$3mk0q$1@dont-email.me> <67afe79c$0$719$14726298@news.sunsite.dk>
<voqpjj$5mpo$1@dont-email.me> <vor156$6uru$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 16 Feb 2025 02:21:13 +0100 (CET)
Injection-Info: dont-email.me; posting-host="dc12b2a5336eff3a0e0ee38f65f24bd3";
logging-data="275474"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/KL2MMmkYpz+Qk1XEWas6S94rhHRcOTyM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:7bJPPSWJY+SUSen8vEFUHaBRsUY=
In-Reply-To: <vor156$6uru$2@dont-email.me>
Content-Language: en-US
Bytes: 3733
On 2/15/2025 4:32 PM, Lawrence D'Oliveiro wrote:
> On Sat, 15 Feb 2025 12:22:59 -0700, Mark Berryman wrote:
>> So, IMHO, DCL is superior in this regard.
>
> Unfortunately, no. The fundamental problem with DEC OSes (and this
> includes Windows) is that the command line is passed to the program as a
> single string buffer. On *nix systems, it is passed as an array of
> strings.
>
> You should be familiar with the well-known problem of one program invoking
> another with a command that might include characters with special meanings
> to a shell. On a *nix system, there is a simple way to avoid those special
> meanings: the first program invokes the second program directly, without
> going through a shell.
>
> Nowadays, there is even a simple library call to do this
> <https://manpages.debian.org/posix_spawn(3)>.
>
> This is not so easy to do with a DEC-style command line.
How do you get those "characters with special meanings
to a shell" interpreted instead of passed on VMS?
All my trivial attempts failed:
$ type self.pas
[inherit('sys$library:pascal$lib_routines', 'sys$library:starlet')]
program self(input,output);
[external]
function decc$system(%immed cmd : c_str_t) : integer; external;
type
pstr = varying [255] of char;
var
cmdlin : pstr;
begin
lib$get_foreign(cmdlin.body, , cmdlin.length);
if cmdlin <> '' then begin
writeln(cmdlin);
end else begin
decc$system(malloc_c_str('mcr sys$disk:[]self ''a'' ''b'' ''c'''));
lib$spawn('mcr sys$disk:[]self ''a'' ''b'' ''c''');
lib$do_command('mcr sys$disk:[]self ''a'' ''b'' ''c''');
end;
end.
$ pas self
$ link self
$ a = 1
$ b = 2
$ c = 3
$ mcr sys$disk:[]self 'a' 'b' 'c'
1 2 3
$ r self
'a' 'b' 'c'
'a' 'b' 'c'
'a' 'b' 'c'
$ type self2.c
#include <stdio.h>
#include <stdlib.h>
#include <descrip.h>
#include <lib$routines.h>
int main(int argc, char *argv[])
{
$DESCRIPTOR(cmddesc, "mcr sys$disk:[]self2 'a' 'b' 'c'");
if(argc > 1)
{
for(int i = 1; i < argc; i++) printf(" %s", argv[i]);
printf("\n");
}
else
{
system("mcr sys$disk:[]self2 'a' 'b' 'c'");
lib$spawn(&cmddesc);
lib$do_command(&cmddesc);
}
return 0;
}
$ cc self2
$ link self2
$ a = 1
$ b = 2
$ c = 3
$ mcr sys$disk:[]self 'a' 'b' 'c'
1 2 3
$ r self2
'a' 'b' 'c'
'a' 'b' 'c'
'a' 'b' 'c'
Arne