[BACK]Return to rcsutil.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rcs

Diff for /src/usr.bin/rcs/rcsutil.c between version 1.44 and 1.45

version 1.44, 2015/06/13 20:15:21 version 1.45, 2016/07/04 01:39:12
Line 330 
Line 330 
  * Returns the string's pointer.   * Returns the string's pointer.
  */   */
 char *  char *
 rcs_prompt(const char *prompt)  rcs_prompt(const char *prompt, int flags)
 {  {
         BUF *bp;          BUF *bp;
         size_t len;          size_t len;
         char *buf;          char *buf;
   
           if (!(flags & INTERACTIVE) && isatty(STDIN_FILENO))
                   flags |= INTERACTIVE;
   
         bp = buf_alloc(0);          bp = buf_alloc(0);
         if (isatty(STDIN_FILENO))          if (flags & INTERACTIVE)
                 (void)fprintf(stderr, "%s", prompt);                  (void)fprintf(stderr, "%s", prompt);
         if (isatty(STDIN_FILENO))          if (flags & INTERACTIVE)
                 (void)fprintf(stderr, ">> ");                  (void)fprintf(stderr, ">> ");
         clearerr(stdin);          clearerr(stdin);
         while ((buf = fgetln(stdin, &len)) != NULL) {          while ((buf = fgetln(stdin, &len)) != NULL) {
Line 349 
Line 352 
                 else                  else
                         buf_append(bp, buf, len);                          buf_append(bp, buf, len);
   
                 if (isatty(STDIN_FILENO))                  if (flags & INTERACTIVE)
                         (void)fprintf(stderr, ">> ");                          (void)fprintf(stderr, ">> ");
         }          }
         buf_putc(bp, '\0');          buf_putc(bp, '\0');
Line 438 
Line 441 
  * Returns 0 on success, -1 on failure, setting errno.   * Returns 0 on success, -1 on failure, setting errno.
  */   */
 int  int
 rcs_set_description(RCSFILE *file, const char *in)  rcs_set_description(RCSFILE *file, const char *in, int flags)
 {  {
         BUF *bp;          BUF *bp;
         char *content;          char *content;
Line 458 
Line 461 
                 content = xstrdup(in + 1);                  content = xstrdup(in + 1);
         /* Get description from stdin. */          /* Get description from stdin. */
         else          else
                 content = rcs_prompt(prompt);                  content = rcs_prompt(prompt, flags);
   
         rcs_desc_set(file, content);          rcs_desc_set(file, content);
         free(content);          free(content);

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45