comp.lang.ada
 help / color / mirror / Atom feed
* Ada binding to redirect standard output in Win32
@ 2001-10-01  8:59 Martin Dowie
  2001-10-01 12:35 ` Chad Robert Meiners
  2001-10-01 13:25 ` Marin David Condic
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Dowie @ 2001-10-01  8:59 UTC (permalink / raw)


I have a Win32 (non-GUI) program which requires the user
to type in their password but, for obvious reasons, I
don't want it to appear on the screen/DOS window as
they type.

Does anyone have an Ada binding to a routine similar in
effect to 'ECHO OFF' that I could call before the
'Get_Line'? or, something similar to redirecting the
standard output to a UNIX null device.

I've exhausted my search engine enough on this! :-)

Thanks in advance...






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada binding to redirect standard output in Win32
  2001-10-01  8:59 Ada binding to redirect standard output in Win32 Martin Dowie
@ 2001-10-01 12:35 ` Chad Robert Meiners
  2001-10-01 13:44   ` Martin Dowie
  2001-10-01 13:25 ` Marin David Condic
  1 sibling, 1 reply; 4+ messages in thread
From: Chad Robert Meiners @ 2001-10-01 12:35 UTC (permalink / raw)


I take it that you don't want to write your own Get_Line routine.  If that
is acceptable though, try using Get_Immediate I believe that it doesn't
echo the keystroke.  Otherwise use the NT_Console package to set the
foreground color equal to the background color.  The only problem with
that is it would still be possible to cut and paste the password off of
the screen, but if you are using NT_Console you can easy write blanks over
the password.

-Chad R. Meiners

On Mon, 1 Oct 2001, Martin Dowie wrote:

> I have a Win32 (non-GUI) program which requires the user
> to type in their password but, for obvious reasons, I
> don't want it to appear on the screen/DOS window as
> they type.
>
> Does anyone have an Ada binding to a routine similar in
> effect to 'ECHO OFF' that I could call before the
> 'Get_Line'? or, something similar to redirecting the
> standard output to a UNIX null device.
>
> I've exhausted my search engine enough on this! :-)
>
> Thanks in advance...
>
>
>
>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada binding to redirect standard output in Win32
  2001-10-01  8:59 Ada binding to redirect standard output in Win32 Martin Dowie
  2001-10-01 12:35 ` Chad Robert Meiners
@ 2001-10-01 13:25 ` Marin David Condic
  1 sibling, 0 replies; 4+ messages in thread
From: Marin David Condic @ 2001-10-01 13:25 UTC (permalink / raw)


I don't know if it works on MS-DOS, but its something that comes with Gnat &
may be half-way portable. Perform a system command doing something like the
following: (You may need to modify this for MS-DOS-isms rather than
Unix-isms, but IIRC, there is a "system" C call that works for MS-DOS.)

with Interfaces.C;

procedure UTIL.Perform_System_Command (
    Command     : in     String ;
    Wait        : in     Boolean := True ;
    Success     :    out Boolean) is
    --
    Return_Code : Integer ;
    --
    function Sys (
        Item    : in     Interfaces.C.Char_Array) return Integer ;
    pragma Import (C, Sys, "system") ;
    --
    package C renames Interfaces.C ;
    --
begin
    --
    if (Wait) then
        Return_Code := Sys (
            Item    => C.To_C ("ksh -c " & '"' & Command & '"'));
    else
        Return_Code := Sys (
            Item    => C.To_C ("ksh -c " & '"' & Command & " &" & '"'));
    end if ;
    --
    if (Return_Code /= 0) then
        Success := False ;
    else
        Success := True ;
    end if;
    --
end UTIL.Perform_System_Command ;


MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/

"Martin Dowie" <martin.dowie@nospam.baesystems.com> wrote in message
news:3bb82d8e$1@pull.gecm.com...
> I have a Win32 (non-GUI) program which requires the user
> to type in their password but, for obvious reasons, I
> don't want it to appear on the screen/DOS window as
> they type.
>
> Does anyone have an Ada binding to a routine similar in
> effect to 'ECHO OFF' that I could call before the
> 'Get_Line'? or, something similar to redirecting the
> standard output to a UNIX null device.
>
> I've exhausted my search engine enough on this! :-)
>
> Thanks in advance...
>
>
>





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada binding to redirect standard output in Win32
  2001-10-01 12:35 ` Chad Robert Meiners
@ 2001-10-01 13:44   ` Martin Dowie
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Dowie @ 2001-10-01 13:44 UTC (permalink / raw)


Fantastic! Thanks Chad! Get_Immediate did the trick nicely.

Chad Robert Meiners <meinersc@cse.msu.edu> wrote in message
news:Pine.GSO.4.31.0110010830050.21460-100000@sens-a.cse.msu.edu...
> I take it that you don't want to write your own Get_Line routine.  If that
> is acceptable though, try using Get_Immediate I believe that it doesn't
> echo the keystroke.  Otherwise use the NT_Console package to set the
> foreground color equal to the background color.  The only problem with
> that is it would still be possible to cut and paste the password off of
> the screen, but if you are using NT_Console you can easy write blanks over
> the password.






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-10-01 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-01  8:59 Ada binding to redirect standard output in Win32 Martin Dowie
2001-10-01 12:35 ` Chad Robert Meiners
2001-10-01 13:44   ` Martin Dowie
2001-10-01 13:25 ` Marin David Condic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox