This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

crypt() usage


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]