don't use gets(). pr#2287 (patch sent to rcs maintainers)

This commit is contained in:
mrg 1996-05-21 13:35:27 +00:00
parent 0272dd3aaf
commit c9e2d4f9d5
2 changed files with 10 additions and 7 deletions

View File

@ -30,7 +30,7 @@ Report problems and direct all questions to:
#include "maketime.h"
char const maketId[]
= "$Id: maketime.c,v 1.3 1995/02/24 02:08:02 mycroft Exp $";
= "$Id: maketime.c,v 1.4 1996/05/21 13:35:27 mrg Exp $";
static int isleap P((int));
static int month_days P((struct tm const*));
@ -305,7 +305,7 @@ main(argc, argv) int argc; char **argv;
time_t default_time = time((time_t *)0);
int default_zone = argv[1] ? atoi(argv[1]) : 0;
char buf[1000];
while (gets(buf)) {
while (fgets(buf, 1000, stdin)) {
time_t t = str2time(buf, default_time, default_zone);
printf("%s", asctime(gmtime(&t)));
}

View File

@ -28,6 +28,9 @@ Report problems and direct all questions to:
/*
* $Log: rcsrev.c,v $
* Revision 1.4 1996/05/21 13:35:31 mrg
* don't use gets(). pr#2287 (patch sent to rcs maintainers)
*
* Revision 1.3 1995/02/24 02:25:12 mycroft
* RCS 5.6.7.4
*
@ -100,7 +103,7 @@ Report problems and direct all questions to:
#include "rcsbase.h"
libId(revId, "$Id: rcsrev.c,v 1.3 1995/02/24 02:25:12 mycroft Exp $")
libId(revId, "$Id: rcsrev.c,v 1.4 1996/05/21 13:35:31 mrg Exp $")
static char const *branchtip P((char const*));
static char const *lookupsym P((char const*));
@ -837,17 +840,17 @@ int argc; char * argv[];
/* all output goes to stderr, to have diagnostics and */
/* errors in sequence. */
aputs("\nEnter revision number or <return> or '.': ",stderr);
if (!gets(symrevno)) break;
if (!fgets(symrevno, 100, stdin)) break;
if (*symrevno == '.') break;
aprintf(stderr,"%s;\n",symrevno);
expandsym(symrevno,&numricrevno);
aprintf(stderr,"expanded number: %s; ",numricrevno.string);
aprintf(stderr,"Date: ");
gets(date); aprintf(stderr,"%s; ",date);
fgets(date, 20, stdin); aprintf(stderr,"%s; ",date);
aprintf(stderr,"Author: ");
gets(author); aprintf(stderr,"%s; ",author);
fgets(author, 20, stdin); aprintf(stderr,"%s; ",author);
aprintf(stderr,"State: ");
gets(state); aprintf(stderr, "%s;\n", state);
fgets(state, 20, stdin); aprintf(stderr, "%s;\n", state);
target = genrevs(numricrevno.string, *date?date:(char *)0, *author?author:(char *)0,
*state?state:(char*)0, &gendeltas);
if (target) {