Non-interactive login using C program in UNIX(Solaris)

Hi i need a c programm to login in unix(solaris).
non-interactivley because it seems difficult to do it with unix shell scripting and passwd command cant be used and also
i don't have expect installed and i am not allowed to installed expect in our servers.
is there any c programm that can help me to do this where the pasword is supplied in the programm itself.

will it be applicable to other *nixes

and can i execute the c programm like :

mypasswd abcd abcd  //where mypassword is the binary executable and abcd is the password

instead of the usual passwd command wich goes interactive and asks for password:

 
passwd
new password:

What network protocol are you using to login to Solaris. If you are using Secure Shell (SSH), then setup ssh-keys for password-less login.