home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * Copyright (C) 1990 by Jay Konigsberg. mail: jak@sactoh0
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appear in all copies and that both the copyright notice and
- * this permission notice appear in supporting documentation. This software
- * is provided "as is" without express or implied warranty. However, the
- * author retains all Copyright priviliges and rights to renumeration if
- * this software is sold.
- */
-
- /*
- * deleteline - delete a line from the text buffer
- */
-
- #include "simped.h"
-
- char **deleteline(text, count, delline)
- char **text;
- int *count;
- int delline; /* returns the line number deleted or 0 */
- {
- int printf(),
- fflush(),
- puts(),
- fputs();
-
- void free();
-
- int inpchar=0,
- loop;
-
- if(delline > 0)
- {
- printf("\n%3d> ",delline);
- fputs(text[delline-1], stdout);
- fputs("Delete this line (Return=n/y): ", stdout);
- fflush(stdout);
- inpchar=getchar();
- putchar(inpchar);
- }
-
- if (inpchar == 'y' || inpchar == 'Y')
- {
- free(text[delline-1]);
- for(loop=delline-1; loop < *count-1; ++loop)
- {
- text[loop] = text[loop+1];
- }
- text[loop]=NULL;
- --*count;
- puts("\nLine deleted.");
- }
- else
- {
- puts("\nLine NOT deleted.");
- }
- return(text);
- }
-