From: Bernhard Tittelbach Date: Thu, 18 Mar 2010 20:52:19 +0000 (+0000) Subject: update X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=e5fdd1e16a7f04db53dfbfd8d7429ba9550e578b;p=svn42.git update --- diff --git a/serial_console/usocket.c b/serial_console/usocket.c index d00a8b5..4a6df80 100644 --- a/serial_console/usocket.c +++ b/serial_console/usocket.c @@ -64,7 +64,9 @@ void connect_terminal(int fd) { send(fd,buffer,num_byte,0); } - if (num_byte == 0 || (num_byte <0 && errno != EAGAIN)) + if (num_byte <0 && errno != EAGAIN) + return; + if (quit_on_eof_ && num_byte == 0) return; } @@ -104,12 +106,18 @@ int main(int argc, char* argv[]) { int ret = 0; int socket_fd = 0; + char *socket_file; //~ struct termios tmio_prev; if (argc > 0) - socket_file_ = argv[1]; + socket_file = argv[1]; + else + socket_file = default_socket_file_; + + if (argc > 1) + quit_on_eof_=0; - socket_fd = establish_socket_connection(socket_file_); + socket_fd = establish_socket_connection(socket_file); if(socket_fd) { //~ ret = set_tty_raw(STDIN_FILENO,&tmio_prev); @@ -124,7 +132,7 @@ int main(int argc, char* argv[]) } else { - fprintf(stderr, "%s error, aborting..\n", socket_file_); + fprintf(stderr, "%s error, aborting..\n", socket_file); ret=2; } diff --git a/serial_console/usocket.h b/serial_console/usocket.h index cc458c4..11a6b0d 100644 --- a/serial_console/usocket.h +++ b/serial_console/usocket.h @@ -10,5 +10,5 @@ #include #include -char const *socket_file_="/var/run/powersensordaemon/cmd.sock"; - +char *default_socket_file_="/var/run/powersensordaemon/cmd.sock"; +int quit_on_eof_ = 1; \ No newline at end of file