From owner-freebsd-hackers@FreeBSD.ORG Sat Jan 17 17:59:07 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23F7DECC for ; Sat, 17 Jan 2015 17:59:07 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE2A66AF for ; Sat, 17 Jan 2015 17:59:06 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id ho1so9399946wib.0 for ; Sat, 17 Jan 2015 09:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=rFNxXWIfYXbRoW3Rc1QGP9+WJZzydz1XVst2903cC6o=; b=utrCdSfx/aLW5e7y4Mnq9eqfgpivNbAOF8AgKxUzZXGXv+fTsyvmyYQUoZE1dnyESC 2vxWm5o9orvWmzMw9Y059BtBLZPTh72suQ4tp5YVKJdTCVepWqKh1PbtMD2BnUuPvdf1 AeKKaYfT3YKtyd/F//TEyZLamAAyYtZvffQnDG/AUHIFAZW0YJWfobDY9Q0fE6Bh9vEU Jfwr7VO3WkZiPJ2l2VEDmMMPAbCEPd2el066Ge7loN4dx19nLJ3faClSTlXverEW7IUz YB3jPMYgx2m43Iq8bg/k025zv+I+fA1Of7an4pZOu6K0EdKIhZUEtT2p2E+RhrlFWIV/ QiWQ== MIME-Version: 1.0 X-Received: by 10.194.84.240 with SMTP id c16mr41819682wjz.74.1421517545160; Sat, 17 Jan 2015 09:59:05 -0800 (PST) Received: by 10.27.228.201 with HTTP; Sat, 17 Jan 2015 09:59:05 -0800 (PST) Date: Sat, 17 Jan 2015 12:59:05 -0500 Message-ID: Subject: ctrl-d appends characters to output From: less xss To: freebsd-hackers@freebsd.org X-Mailman-Approved-At: Sat, 17 Jan 2015 19:20:53 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2015 17:59:07 -0000 I've searched around quite a bit with no luck on this matter. I currently have an issue where I send EOF (ctrl-d) to some simple K&R2 exercises and the terminal returns the D character appended to my data when EOF is sent. I wish to prevent any and all extra characters from being appended and I would also like to understand why it's happening. The following code is an example exercise from K&R2 that yield said problem. #include int main() { double nc; for (nc = 0; getchar() != EOF; ++nc) { ; /* syntactic null statement */ } printf("%.0f\n", nc); } $ ./a.out 0D $