#include int l4_write_string(char *); int l4_write_estring(char *s); int l4_read_string(char *, int); int l4_read_estring(char *, int); int main(int argc,char **argv) { char buf[1000]; if (argc!=3) { // I'm a reader - read the username if (l4_read_string(buf,999)==-1) { fprintf(stderr,"Reading error\n"); exit(1); } printf("Username: %s\n",buf); // now get the password if (l4_read_estring(buf,999)==-1) { fprintf(stderr,"Reading error\n"); exit(1); } printf("Password: %s\n",buf); } else { // I'm a writer - first send argv[1] as plain text if (l4_write_string(argv[1])==-1) { fprintf(stderr,"error sending username\n"); exit(1); } // now send second parameter scrambled if (l4_write_estring(argv[2])==-1) { fprintf(stderr,"error sending password\n"); exit(1); } } return(0); }