+ xasprintf(&confpath,"%s/.ttt/",getenv("HOME"));
+ xasprintf(&conffile,"%s/.ttt/client.conf",getenv("HOME"));
+ username="user";
+ if (access (conffile, F_OK) != 0 ) {
+ envuser=getenv("USER");
+ if (envuser != NULL) username=strdup(envuser);
+ if (access (confpath, F_OK) != 0 ) {
+ xasprintf(&command_string,"mkdir %s",confpath);
+ system (command_string);
+ }
+ if ((conf_file = fopen(conffile,"w")) != NULL) {
+ fprintf(conf_file,"username=%s",username);
+ fclose(conf_file);
+ }
+ }
+ if ((conf_file = fopen(conffile,"r")) != NULL) {
+ while (fgets(buffer,BUFSIZ,conf_file)) {
+ if (buffer[strlen(buffer)-1] == 10) buffer[strlen(buffer)-1] = '\0';
+ if (strncmp(buffer,"username=",9) == 0) {
+ xasprintf (&username, "%s", &buffer[9]);
+ }
+ if (strncmp(buffer,"port=",5) == 0) {
+ xasprintf (&port, "%s",&buffer[5]);
+ }
+ }
+ fclose(conf_file);
+ }
+ status=ttt_socket_create_client (host, port, &_socket);
+ if (status) {
+ endwin();
+ printf("Unable to connect to server! Connection status: %d\n",status);
+ exit(1);
+ }
+ sockin=fdopen(_socket,"r");
+ sockout=fdopen(_socket,"w");
+