home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / MODSUNKN.ZIP / PREVLINE.MOD < prev    next >
Text File  |  1990-04-09  |  9KB  |  202 lines

  1. Goose #14 @7303
  2. Sat Apr 07 08:39:58 1990
  3.                           Backspace to Previous Line
  4.  
  5. This is an update to my previous versions of the mod.  I've made the following
  6. changes and enhancements to the mod for this release of the PREVLINE mod:
  7.  
  8.   - The calling of the inli void is unchanged, since there are other mods
  9.     that may use this "standard" function.  Instead, I've added an inli2
  10.     that controls the backspacing capabilities.
  11.  
  12.   - I've fixed the problem where colors are not displayed correctly when
  13.     backspacing to the previous line.
  14.  
  15.   - This mod also has all the fixes I've previously released.  Hey, what can
  16.     I say?  I'm not perfect, unlike some people <grin>...
  17.  
  18. OK, on with the mod itself.  What this mod does is allow users to backspace to
  19. the previous line while posting a message.  When the user gets to the
  20. beginning of the line, the message:
  21.  
  22. [*> Previous Line <*]
  23.  
  24. is displayed, the previous line is shown, and the cursor is placed at the end
  25. of the line.  This makes it much easier to fix mistakes that are made at the
  26. end of a line, since it saves the user from having to type /ED and re-enter
  27. the entire line.  This mod will sure be a blessing to those users who have not
  28. yet learned to use a full screen editor (which, by the way, is the reason I
  29. didn't bother to try to update the tiny editor that Wayne built in to the
  30. source.  Sysops should know enough to use a full screen editor).
  31.  
  32. First, load up FCNS.H and make the following change (note: - designates
  33. existing code, + designates new or modified code.  The & symbol indicates
  34. lines that were split by the message editor to make it fit into the 80
  35. column width.  All these should be removed before trying to compile.  They
  36. are there to make your life easier):
  37.  
  38. - char *mmkey(int dl);
  39. + int inli2(char *s, char *rollover, int maxlen, int crend, int wb); /* mod -
  40. & add */
  41. - void inli(char *s, char *rollover, int maxlen, int crend);
  42. - void getuser();
  43.  
  44. Now, load up BBSUTL.C and add the following external variable declaration at
  45. the top of the file:
  46.  
  47. - extern char charbuffer[161];
  48. - extern userrec thisuser;
  49. + extern int charbufferpointer,chatting,curatr;              /* mod - change */
  50. - extern int usernum,useron,num_sec,helpl;
  51.  
  52. Now find the inli(..) void to and rename it to inli2(..), and make the
  53. following changes to it.  Note also that it is being changed from a void to an
  54. int function:
  55.  
  56. + int inli2(char *s, char *rollover, int maxlen, int crend, int wb) /* mod -
  57. & change */
  58. - {
  59. -   int cp,i,i1,done,cm,begx;
  60. -   char s1[255];
  61. -   unsigned char ch;
  62.  
  63. And a little farther down in the code:
  64.  
  65. -                   backspace();
  66. -                 }
  67. +             } else                                       /* mod - change */
  68. +               if (wb) {                                  /* mod - add */
  69. +                 i=curatr;                                /* mod - add */
  70. +                 ansic(3);                                /* mod - add */
  71. +                 pl("[*> Previous Line <*]");             /* mod - add */
  72. +                 setc(i);                                 /* mod - add */
  73. +                 return(1);                               /* mod - add */
  74. +               }                                          /* mod - add */
  75. -             break;
  76. -           case 24: /* Ctrl-X */
  77.  
  78. And at the very bottom of the function:
  79.  
  80. -   }
  81. -   if (crend)
  82. -     nl();
  83. +   return(0);                                               /* mod - add */
  84. - }
  85.  
  86. Then, add a replacement inli function as shown.  This will allow other mods to
  87. call this function in the same way they always have:
  88.  
  89. + void inli(char *s, char *rollover, int maxlen, int crend) /* mod - change
  90. & entire void */
  91. + {
  92. +   inli2(s,rollover,maxlen,crend,0);
  93. + }
  94.  
  95. - void getuser()
  96.  
  97. Next, load COM.C and make the following change in char inkey() to fix the
  98. problem with changing colors in the line:
  99.  
  100. -   if (charbufferpointer) {
  101. -     if (!charbuffer[charbufferpointer])
  102. -       charbufferpointer = charbuffer[0] = 0;
  103. +     else {                                                 /* mod - change */
  104. +       if ((charbuffer[charbufferpointer])==3)              /* mod - add */
  105. +         charbuffer[charbufferpointer]=16;                  /* mod - add */
  106. -       return(charbuffer[charbufferpointer++]);
  107. +     }                                                      /* mod - add */
  108. -   }
  109.  
  110. OK, now for the change to MSGBASE.C to allow the user to actually to the
  111. backspace.  Make the following changes in void inmsg(...):
  112.  
  113. -     while (!done) {
  114. -       helpl=27;
  115. +       while (inli2(s,ro,160,1,curli)) {         /* mod - change */
  116. +         --curli;                                /* mod - add */
  117. +         strcpy(ro,&(lin[(curli)*LEN]));         /* mod - add */
  118. +         if (strlen(ro)>thisuser.screenchars-1)  /* mod - add */
  119. +           ro[thisuser.screenchars-2]=0;         /* mod - add */
  120. +       }                                         /* mod - add */
  121. -       if (hangup)
  122. -         done=1;
  123. -       savel=1;
  124.  
  125. And one more change in XFER.C to allow the user to back up when entering the
  126. extended file description in void modify_extended_description(...).  The first
  127. part is in the variable declarations:
  128.  
  129. - void modify_extended_description(char **sss)
  130. - {
  131. -   char s[161],s1[161];
  132. +   int f,ii,i,i1,i2,i3;                           /* mod - change */
  133. -
  134. -   if (*sss)
  135.  
  136. Then, a little farther down in the code:
  137.  
  138. -       i=1;
  139. +       i3=0;                                              /* mod - add */
  140. -       nl();
  141. -       sprintf(s,"Enter up to %d lines, %d chars
  142. & each.",MAX_LINES,78-INDENTION);
  143. -       pl(s);
  144. -       nl();
  145. -       s[0]=0;
  146. -       i1=thisuser.screenchars;
  147. -       if (thisuser.screenchars>(76-INDENTION))
  148. -         thisuser.screenchars=76-INDENTION;
  149. -       do {
  150. -         itoa(i,s1,10);
  151. -         strcat(s1,": ");
  152. -         prt(2,s1);
  153. -         s1[0]=0;
  154. +         while (inli2(s1,s,90,1,i3)) {              /* mod - change */
  155. +           --i;                                     /* mod - add */
  156. +           itoa(i,s1,10);                           /* mod - add */
  157. +           strcat(s1,": ");                         /* mod - add */
  158. +           prt(2,s1);                               /* mod - add */
  159. +           i2=0;                                    /* mod - add */
  160. +           i3-=2;                                   /* mod - add */
  161. +           do {                                     /* mod - add */
  162. +             s[i2]=*(sss[0]+i3-1);                  /* mod - add */
  163. +             ++i2;                                  /* mod - add */
  164. +             --i3;                                  /* mod - add */
  165. +           } while ((*(sss[0]+i3)!=10) && (i3!=0)); /* mod - add */
  166. +           if (i3)                                  /* mod - add */
  167. +             ++i3;                                  /* mod - add */
  168. +           *(sss[0]+i3)=0;                          /* mod - add */
  169. +           s[i2]=0;                                 /* mod - add */
  170. +           strrev(s);                               /* mod - add */
  171. +           if (strlen(s)>thisuser.screenchars-1)    /* mod - add */
  172. +             s[thisuser.screenchars-2]=0;           /* mod - add */
  173. +         }                                          /* mod - add */
  174. -         i2=strlen(s1);
  175. -         if (i2 && (s1[i2-1]==1))
  176. -           s1[i2-1]=0;
  177. -         if (s1[0]) {
  178. -           strcat(s1,"En");
  179. +           i3+=strlen(s1);                         /* mod - add */
  180. -           strcat(*sss,s1);
  181. -         }
  182. -       } while ((i++<10) && (s1[0]));
  183.  
  184. (NOTE: There may have been an easier way to accomplish this part of the code,
  185. but I sure can't figure it out!).
  186.  
  187. That's it.  You will need to recompile the entire BBS due to the change to
  188. FCNS.H.
  189.  
  190. NOTE: If you have installed the previous version of this mod, you will
  191.       probably get the error "too many parameters in call to inli" or
  192.       something very similar to that.  Well, if you look at the end of these
  193.       lines you will notice that there is a ",0" (comma followed by a zero)
  194.       just before the right parenthesis.  Remove this and it should compile
  195.       just fine.
  196.  
  197. If there are any questions, comments, or whatever, I can be reached at 1@7312
  198. or via the mods net, or my BBS at 703-369-5225.  Maybe I've got this mod good
  199. enough where Wayne will consider implementing it in the next release of the
  200. source code.
  201.  
  202. 3«« 2Goose 3»»0