also honors the -I flag from ci/co when prompting like GNU RCS.
OK jca@
-/* $OpenBSD: ci.c,v 1.223 2015/11/02 16:45:21 nicm Exp $ */
+/* $OpenBSD: ci.c,v 1.224 2016/07/04 01:39:12 millert Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
errx(1, "failed to open rcsfile `%s'", pb.fpath);
if ((pb.flags & DESCRIPTION) &&
- rcs_set_description(pb.file, pb.description) == -1)
+ rcs_set_description(pb.file, pb.description, pb.flags) == -1)
err(1, "%s", pb.filename);
if (!(pb.flags & QUIET))
(void)fprintf(stderr, "new revision: %s; "
"previous revision: %s\n", nrev, prev);
- rcs_msg = rcs_prompt(prompt);
+ rcs_msg = rcs_prompt(prompt, flags);
return (rcs_msg);
}
/* Get description from user */
if (pb->description == NULL &&
- rcs_set_description(pb->file, NULL) == -1) {
+ rcs_set_description(pb->file, NULL, pb->flags) == -1) {
warn("%s", pb->filename);
return (-1);
}
-/* $OpenBSD: rcsprog.c,v 1.160 2015/12/29 19:12:56 gsoares Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.161 2016/07/04 01:39:12 millert Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#include "rcsprog.h"
-#define RCSPROG_OPTSTRING "A:a:b::c:e::ik:Ll::m:Mn:N:o:qt::TUu::Vx::z::"
+#define RCSPROG_OPTSTRING "A:a:b::c:e::Iik:Ll::m:Mn:N:o:qt::TUu::Vx::z::"
const char rcs_version[] = "OpenRCS 4.5";
elist = rcs_optarg;
rcsflags |= RCSPROG_EFLAG;
break;
+ case 'I':
+ rcsflags |= INTERACTIVE;
+ break;
case 'i':
flags |= RCS_CREATE;
break;
}
if (rcsflags & DESCRIPTION) {
- if (rcs_set_description(file, descfile) == -1) {
+ if (rcs_set_description(file, descfile, rcsflags) == -1) {
warn("%s", descfile);
rcs_close(file);
continue;
}
}
else if (flags & RCS_CREATE) {
- if (rcs_set_description(file, NULL) == -1) {
+ if (rcs_set_description(file, NULL, rcsflags) == -1) {
warn("stdin");
rcs_close(file);
continue;
-/* $OpenBSD: rcsutil.c,v 1.44 2015/06/13 20:15:21 nicm Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.45 2016/07/04 01:39:12 millert Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
* Returns the string's pointer.
*/
char *
-rcs_prompt(const char *prompt)
+rcs_prompt(const char *prompt, int flags)
{
BUF *bp;
size_t len;
char *buf;
+ if (!(flags & INTERACTIVE) && isatty(STDIN_FILENO))
+ flags |= INTERACTIVE;
+
bp = buf_alloc(0);
- if (isatty(STDIN_FILENO))
+ if (flags & INTERACTIVE)
(void)fprintf(stderr, "%s", prompt);
- if (isatty(STDIN_FILENO))
+ if (flags & INTERACTIVE)
(void)fprintf(stderr, ">> ");
clearerr(stdin);
while ((buf = fgetln(stdin, &len)) != NULL) {
else
buf_append(bp, buf, len);
- if (isatty(STDIN_FILENO))
+ if (flags & INTERACTIVE)
(void)fprintf(stderr, ">> ");
}
buf_putc(bp, '\0');
* Returns 0 on success, -1 on failure, setting errno.
*/
int
-rcs_set_description(RCSFILE *file, const char *in)
+rcs_set_description(RCSFILE *file, const char *in, int flags)
{
BUF *bp;
char *content;
content = xstrdup(in + 1);
/* Get description from stdin. */
else
- content = rcs_prompt(prompt);
+ content = rcs_prompt(prompt, flags);
rcs_desc_set(file, content);
free(content);
-/* $OpenBSD: rcsutil.h,v 1.14 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: rcsutil.h,v 1.15 2016/07/04 01:39:12 millert Exp $ */
/*
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
int rcs_choosefile(const char *, char *, size_t);
time_t rcs_get_mtime(RCSFILE *);
RCSNUM *rcs_getrevnum(const char *, RCSFILE *);
-char *rcs_prompt(const char *);
+char *rcs_prompt(const char *, int);
u_int rcs_rev_select(RCSFILE *, const char *);
-int rcs_set_description(RCSFILE *, const char *);
+int rcs_set_description(RCSFILE *, const char *, int);
void rcs_setrevstr(char **, char *);
void rcs_setrevstr2(char **, char **, char *);
BUF *rcs_patchfile(u_char *, size_t, u_char *, size_t,