🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87293

Control D in C-shell

#87293
From: Joachim H. Laubsch
Date: Mon, 10 Oct 1994 23:01
87 lines
2746 bytes
In GNU Emacs 19.27.1 (hppa1.1-hp-hpux9) of Tue Sep 27 1994 on hpljl

a Control D seems not be handed through in the C-shell.

Example file, named p9.c:

/*#################################################################
# Copyright (c) 1991 AT&T Bell Laboratories, All Rights Reserved   
# Published in ``A C++ Primer''  by Stanley Lippman, Addison-Wesley
#################################################################*/
#include <iostream.h>

main() {
    char ch;
    int lineCnt=0, charCnt=0, tabCnt=0, blankCnt=0;
     
    cout << "counting lines ...";

    while ( cin.get(ch) ) {
       switch ( ch ) {
         case '\t': ++tabCnt;
	   break;	      
         case ' ':  ++blankCnt;
	   break;
         case '\n':
	   ++lineCnt; 
	   break;
         default:
	   ++charCnt; 
	   break;
         }
     };    
    cout << "\nLines:\t" << lineCnt;
    cout << "\nChars:\t" << charCnt;
    cout << "\nTabs:\t"  << tabCnt;
    cout << "\nBlanks:\t" << blankCnt << "\n";
    return 0;
}

Here is a log of compiling and running this program:

hpljl 22 /users/laubsch/work/primer/chap0> g++ -o prog2 p9.c
hpljl 23 /users/laubsch/work/primer/chap0> cat p9.c | prog2
counting lines ...
Lines:	32
Chars:	605
Tabs:	7
Blanks:	196
hpljl 24 /users/laubsch/work/primer/chap0> prog2
counting lines ...1
11
111


hpljl 25 /users/laubsch/work/primer/chap0> 
----

Note that the program works with input from a file.

After invoking prog2, the read loop could not be terminated by
a Control-D, typed as Control-c Control-d nor by Control-Q Control-d

I finally typed Control-c Control-c to terminate.  But in a shell
outside of Emacs Control-D is handed through and prog2 behaves as
expected:

50 /users/laubsch/work/primer/chap0> prog2
counting lines ...1
11
111

Lines:  3
Chars:  6
Tabs:   0
Blanks: 0
51 /users/laubsch/work/primer/chap0>

-- 
Checking what C-c C-d is bound to:

comint-send-eof:
Send an EOF to the current buffer's process.



; -*- Joachim -*-
; Email: laubsch@hplabs.hpl.hp.com Tel: 415-857-7695 Fax: 415-857-8526
Technical Details
Message-ID: <9410102256.AA13671@hpljl.hpl.hp.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!hpljl.hpl.hp.com!laubsch

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,443cea971e98ee3b,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-10-10 16:44:17 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!hpljl.hpl.hp.com!laubsch
From: laubsch@hpljl.hpl.hp.com (Joachim H. Laubsch)
Newsgroups: gnu.emacs.bug
Subject: Control D in C-shell
Date: 10 Oct 1994 19:01:15 -0400
Organization: GNUs Not Usenet
Lines: 88
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9410102256.AA13671@hpljl.hpl.hp.com>