Print this page
3471 cscope-fast writes constant strings when erroring

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/cscope-fast/display.c
          +++ new/usr/src/tools/cscope-fast/display.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21   */
  22   22  /*      Copyright (c) 1988 AT&T */
  23   23  /*        All Rights Reserved   */
  24   24  
  25   25  
  26   26  /*
  27   27   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  28   28   * Use is subject to license terms.
  29   29   */
  30   30  
  31      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  32      -
  33   31  /*
  34   32   *      cscope - interactive C symbol cross-reference
  35   33   *
  36   34   *      display functions
  37   35   */
  38   36  
  39   37  #include "global.h"
  40   38  #include "version.h"    /* FILEVERSION and FIXVERSION */
  41   39  #include <curses.h>     /* COLS and LINES */
  42   40  #include <setjmp.h>     /* jmp_buf */
↓ open down ↓ 517 lines elided ↑ open up ↑
 560  558          (void) sprintf(msg, "%s: %s", text, strerror(errno));
 561  559          putmsg(msg);
 562  560  }
 563  561  
 564  562  /* putmsg clears the message line and prints the message */
 565  563  
 566  564  void
 567  565  putmsg(char *msg)
 568  566  {
 569  567          if (incurses == NO) {
 570      -                *msg = tolower(*msg);
 571      -                (void) fprintf(stderr, "cscope: %s\n", msg);
      568 +                char *str = stralloc(msg);
      569 +                *str = tolower(*str);
      570 +                (void) fprintf(stderr, "cscope: %s\n", str);
      571 +                (void) free(str);
 572  572          } else {
 573  573                  (void) move(MSGLINE, 0);
 574  574                  (void) clrtoeol();
 575  575                  (void) addstr(msg);
 576  576                  (void) refresh();
 577  577          }
 578  578          (void) strncpy(lastmsg, msg, sizeof (lastmsg) - 1);
 579  579  }
 580  580  
 581  581  /* clearmsg2 clears the second message line */
↓ open down ↓ 95 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX