Article View: gnu.emacs.bug
Article #87530emacs-19.27/lib-src/getdate.y fix
From: Peter F. Couvares
Date: Wed, 21 Sep 1994 00:24
Date: Wed, 21 Sep 1994 00:24
57 lines
2374 bytes
2374 bytes
The patch appended to this message simply fixes the getdate program to
use fgets() instead of gets().
(I also #define'd the constant size of the buff[] array, since the
fgets() call uses it as an argument, and I wanted to avoid using "128"
twice.)
It is relative to the emacs-19.27 source. I hope it's helpful, though
it sure wasn't much. (Any of this sound familiar? :)
Thanks again for all your hard work!
-Peter
--
-- pfcouvar@unix.amherst.edu (Peter Couvares)
--
*** getdate.y.orig Tue Sep 20 19:20:04 1994
--- getdate.y Tue Sep 20 19:22:22 1994
***************
*** 106,111 ****
--- 106,112 ----
#define HOUR(x) ((time_t)(x) * 60)
#define SECSPERDAY (24L * 60L * 60L)
+ #define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
/*
** An entry in the lexical lookup table.
***************
*** 965,976 ****
int ac;
char *av[];
{
! char buff[128];
time_t d;
(void)printf("Enter date, or blank line to exit.\n\t> ");
(void)fflush(stdout);
! while (gets(buff) && buff[0]) {
d = get_date(buff, (struct timeb *)NULL);
if (d == -1)
(void)printf("Bad format - couldn't convert.\n");
--- 966,977 ----
int ac;
char *av[];
{
! char buff[MAX_BUF_LEN];
time_t d;
(void)printf("Enter date, or blank line to exit.\n\t> ");
(void)fflush(stdout);
! while (fgets(buff, MAX_BUFF_LEN, stdin) && buff[0]) {
d = get_date(buff, (struct timeb *)NULL);
if (d == -1)
(void)printf("Bad format - couldn't convert.\n");
Technical Details
Message-ID:
<199409210021.AA05128@amhux3.amherst.edu>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!unix.amherst.edu!pfcouvarShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,f3f811b2ec7f27fe,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-09-21 15:48:31 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!unix.amherst.edu!pfcouvar From: pfcouvar@unix.amherst.edu (Peter F. Couvares) Newsgroups: gnu.emacs.bug Subject: emacs-19.27/lib-src/getdate.y fix Date: 20 Sep 1994 20:24:50 -0400 Organization: GNUs Not Usenet Lines: 57 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <199409210021.AA05128@amhux3.amherst.edu>