DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Browsing through your code with cscope

Step 4: edit the code

On a windowing terminal you may have multiple windows of arbitrary size. The error message out of storage might have appeared as a result of running prog. That may have been one of the situations in which mymalloc() was called with a negative number. Now you want to be sure that when the program aborts in this scenario in the future, it does so after printing the more significant error message screen too small. Edit the function dispinit() as follows:

   /* initialize display parameters */
   

void dispinit() { /* calculate the maximum displayed reference lines */ lastdispline = FLDLINE - 4; mdisprefs = lastdispline - REFLINE + 1; if (mdisprefs <= 0) { (void) fprintf(stderr,"\\n%s: screen too small\\n", argv0); exit(1); } if (mdisprefs > 9) { mdisprefs = 9; } /* allocate the displayed line array */ displine = (int *) mymalloc(mdisprefs * sizeof(int)); } ^L/* display a page of the references */

void display()

Using cscope to Fix the Problem

You have fixed the problem that you began investigating at the beginning of this tutorial. Now if prog is run in a window with too few lines, it will not simply fail with the vague error message out of storage. Instead, it will check the window size and generate a more significant error message before exiting.


Next topic: Command line options
Previous topic: Viewing dispinit() in the Editor

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005