diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Handle.cc | 36 | 
1 files changed, 22 insertions, 14 deletions
| diff --git a/lib/Handle.cc b/lib/Handle.cc index 079f761..56e6c62 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -226,26 +226,34 @@ Handle & operator<<(Handle & h, const String & s) {      return h;  } -Handle & operator>>(Handle & h, String & s) { +Handle & operator>>(Handle & h, String & s) throw (GeneralException) {      char t[BUFSIZ];      int i = 0, r; -     -    while ((r = h.read(&(t[i]), 1)) && (i != (BUFSIZ - 1))) { -	// Il y a souvent des \r\n dans les sockets par exemple, -	// ou bien en lisant des fichiers au format MS-DOS. On -	// ignore le \r pour ne garder que le \n, standard sous Unix. -	if (t[i] == '\r') { -	    continue; -	} -	if (t[i] == '\n') { -	    break; -	} else { -	    i++; -	} +    bool got_ioagain = false; + +    try { +        while ((r = h.read(&(t[i]), 1)) && (i != (BUFSIZ - 1))) { +	    // Il y a souvent des \r\n dans les sockets par exemple, +	    // ou bien en lisant des fichiers au format MS-DOS. On +	    // ignore le \r pour ne garder que le \n, standard sous Unix. +	    if (t[i] == '\r') { +	        continue; +	    } +	    if (t[i] == '\n') { +	        break; +	    } else { +	        i++; +	    } +        } +    } +    catch (IOAgain e) { +        got_ioagain = true;      }      t[i] = '\0';      s = t; +    if (got_ioagain) +        throw IOAgain();      return h;  } | 
