comparison src/lstream.c @ 74:54cc21c15cbb r20-0b32

Import from CVS: tag r20-0b32
author cvs
date Mon, 13 Aug 2007 09:04:33 +0200
parents 131b0175ea99
children 6a378aca36af
comparison
equal deleted inserted replaced
73:e2d7a37b7c8d 74:54cc21c15cbb
688 } 688 }
689 689
690 static int 690 static int
691 Lstream_pseudo_close (Lstream *lstr) 691 Lstream_pseudo_close (Lstream *lstr)
692 { 692 {
693 int rc;
694
693 if (!lstr->flags & LSTREAM_FL_IS_OPEN) 695 if (!lstr->flags & LSTREAM_FL_IS_OPEN)
694 { 696 {
695 Lisp_Object obj = Qnil; 697 Lisp_Object obj = Qnil;
696 XSETLSTREAM (obj, lstr); 698 XSETLSTREAM (obj, lstr);
697 signal_simple_internal_error 699 signal_simple_internal_error
698 ("Internal error: lstream is not open", obj); 700 ("Internal error: lstream is not open", obj);
699 } 701 }
700 702
701 /* don't check errors here -- best not to risk file descriptor loss */ 703 /* don't check errors here -- best not to risk file descriptor loss */
702 Lstream_flush (lstr); 704 rc = Lstream_flush (lstr);
703 705
704 return 0; 706 return rc;
705 } 707 }
706 708
707 int 709 int
708 Lstream_close (Lstream *lstr) 710 Lstream_close (Lstream *lstr)
709 { 711 {
712 int rc =0;
713
710 if (lstr->flags & LSTREAM_FL_IS_OPEN) 714 if (lstr->flags & LSTREAM_FL_IS_OPEN)
711 { 715 {
712 /* don't return here on error, or file descriptor leak will result. */ 716 /* don't return here on error, or file descriptor leak will result. */
713 Lstream_pseudo_close (lstr); 717 rc = Lstream_pseudo_close (lstr);
714 if (lstr->imp->closer) 718 if (lstr->imp->closer)
715 { 719 {
716 if ((lstr->imp->closer) (lstr) < 0) 720 if ((lstr->imp->closer) (lstr) < 0)
717 return -1; 721 return -1;
718 } 722 }
741 { 745 {
742 xfree (lstr->unget_buffer); 746 xfree (lstr->unget_buffer);
743 lstr->unget_buffer = 0; 747 lstr->unget_buffer = 0;
744 } 748 }
745 749
746 return 0; 750 return rc;
747 } 751 }
748 752
749 int 753 int
750 Lstream_fputc (Lstream *lstr, int c) 754 Lstream_fputc (Lstream *lstr, int c)
751 { 755 {
886 Bufbyte eof_char; 890 Bufbyte eof_char;
887 int starting_pos; 891 int starting_pos;
888 int current_pos; 892 int current_pos;
889 int end_pos; 893 int end_pos;
890 int chars_sans_newline; 894 int chars_sans_newline;
891 int closing :1; 895 unsigned int closing :1;
892 int allow_quit :1; 896 unsigned int allow_quit :1;
893 int blocked_ok :1; 897 unsigned int blocked_ok :1;
894 int pty_flushing :1; 898 unsigned int pty_flushing :1;
895 int blocking_error_p :1; 899 unsigned int blocking_error_p :1;
896 }; 900 };
897 901
898 #define FILEDESC_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, filedesc) 902 #define FILEDESC_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, filedesc)
899 903
900 DEFINE_LSTREAM_IMPLEMENTATION ("filedesc", lstream_filedesc, 904 DEFINE_LSTREAM_IMPLEMENTATION ("filedesc", lstream_filedesc,