Skip to Content.
Sympa Menu

freetds - [freetds] getpass() and HP/UX

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS <freetds AT lists.ibiblio.org>
  • Subject: [freetds] getpass() and HP/UX
  • Date: 20 Dec 2002 23:15:37 +0100

Trying to compile and check FreeTDS on a HP/UP 10.20 machine I had some
problem
1- tds_get_homedir do not work because getpwuid_r interface is very
weird (fixed in CVS)
2- getpass() is limited to 8 characters (strange but is a documented
behavior). Also this function is obsolete in many systems (like unix).
3- dynamic input params not works (fixed in CVS)
4- %l in strftime do not work (I replaced it with %I, most portable)

On point 2:
What's the best method to replace this functions?

I founded this code on internet:

#include <termios.h>
#include <stdio.h>

ssize_t
my_getpass (char **lineptr, size_t *n, FILE *stream)
{
struct termios old, new;
int nread;

/* Turn echoing off and fail if we can't. */
if (tcgetattr (fileno (stream), &old) != 0)
return -1;
new = old;
new.c_lflag &= ~ECHO;
if (tcsetattr (fileno (stream), TCSAFLUSH, &new) != 0)
return -1;

/* Read the password. */
nread = getline (lineptr, n, stream);

/* Restore terminal. */
(void) tcsetattr (fileno (stream), TCSAFLUSH, &old);

return nread;
}

Is good? Is portable?

freddy77





  • [freetds] getpass() and HP/UX, Frediano Ziglio, 12/20/2002

Archive powered by MHonArc 2.6.24.

Top of Page