=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rcsprog.c,v retrieving revision 1.87 retrieving revision 1.88 diff -c -r1.87 -r1.88 *** src/usr.bin/rcs/rcsprog.c 2006/03/27 07:38:24 1.87 --- src/usr.bin/rcs/rcsprog.c 2006/03/27 08:21:01 1.88 *************** *** 1,4 **** ! /* $OpenBSD: rcsprog.c,v 1.87 2006/03/27 07:38:24 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcsprog.c,v 1.88 2006/03/27 08:21:01 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. *************** *** 718,723 **** --- 718,729 ---- } } + /* + * Load description from to . + * If starts with a `-', is taken as the description. + * Otherwise is the name of the file containing the description. + * If is NULL, the description is read from stdin. + */ static void rcs_set_description(RCSFILE *file, const char *in) { *************** *** 725,739 **** char *content, buf[128]; content = NULL; ! if (in != NULL) { bp = cvs_buf_load(in, BUF_AUTOEXT); } else { bp = cvs_buf_alloc(64, BUF_AUTOEXT); printf(DESC_PROMPT); for (;;) { fgets(buf, sizeof(buf), stdin); ! if (feof(stdin) || ferror(stdin) || buf[0] == '.') break; cvs_buf_append(bp, buf, strlen(buf)); printf(">> "); --- 731,761 ---- char *content, buf[128]; content = NULL; ! /* Description is in file . */ ! if (in != NULL && *in != '-') bp = cvs_buf_load(in, BUF_AUTOEXT); + /* Description is in . */ + else if (in != NULL) { + size_t len; + const char *desc; + + /* Skip leading `-'. */ + desc = in + 1; + len = strlen(desc); + + bp = cvs_buf_alloc(len + 1, BUF_AUTOEXT); + cvs_buf_append(bp, desc, len); + /* Get description from stdin. */ } else { bp = cvs_buf_alloc(64, BUF_AUTOEXT); printf(DESC_PROMPT); for (;;) { + /* XXX - fgetln() may be more elegant. */ fgets(buf, sizeof(buf), stdin); ! if (feof(stdin) || ferror(stdin) || ! strcmp(buf, ".\n") == 0 || ! strcmp(buf, ".") == 0) break; cvs_buf_append(bp, buf, strlen(buf)); printf(">> ");