This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
crypt() usage
- To: "'bug-gcc at prep dot ai dot mit dot edu'" <bug-gcc at gnu dot org>, "'help-gcc at prep dot ai dot mit dot edu'" <help-gcc at gnu dot org>
- Subject: crypt() usage
- From: ASe User <menzies1 at airmail dot net>
- Date: Tue, 11 Jul 2000 00:33:38 -0500
- Organization: Advanced Systems for Education, Inc.
- Reply-To: "menzies1 at airmail dot net" <menzies1 at airmail dot net>
Hi,
I'm running in a shell in FreeBSD 3.2 and using GCC to write CGI scripts. I'm trying to use crypt() in the following program
$ cat systest.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <des.h>
//#include <io.h>
void main()
{
char *cryptpass;
strcpy(cryptpass,crypt("firstpas","as"));
}
and getting the error:
$ gcc -g systest.c
/var/tmp/ccm266661.o: In function `main':
/www/cgi-bin/classcgi/cgisrc/src/systest.c(.text+0x1e): undefined reference to `crypt'
My questions are:
1) I greped crypt and it showed up in unistd.h and des.h. Are there other headers that I should include? How do I get it referenced?
2) What is the correct usage for crypt? [Eg. Char *crypt(char *pass, char *salt)] Do you have an example in c?
This info could probably come from man but that is disabled in my shell. Is there a gcc library reference available on the web?
Thanks and regards,
Wes