[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev Minor patch [2-8-4] for interrupting lynx
From: |
Ilya Zakharevich |
Subject: |
lynx-dev Minor patch [2-8-4] for interrupting lynx |
Date: |
Thu, 28 Sep 2000 22:15:33 -0400 |
User-agent: |
Mutt/1.2i |
This patch is the first step in making ESC key to work as it should (I
see that there is some code to make it work on Win*). It basically
"does nothing": macroizes checks for interrupt characters.
The purpose of this patch is to make it easier to identify places
which depend on how the interrupts are implemented. In several places
I (effectively) changed (c==7) to (c==3||c==7), but these places had 3
converted to 7 anyway beforehand...
Enjoy,
Ilya
--- ./src/HTAlert.c~ Fri Jun 23 11:15:08 2000
+++ ./src/HTAlert.c Thu Sep 28 19:00:48 2000
@@ -464,7 +464,7 @@ PUBLIC int HTConfirmDefault ARGS2(CONST
c = TOUPPER(*msg_no);
}
#endif /* VMS */
- if (c == 7 || c == 3) { /* remember we had ^G or ^C */
+ if (LYCharIsINTERRUPT(c)) { /* remember we had ^G or ^C */
conf_cancelled = YES;
result = NO;
} else if (c == TOUPPER(*msg_yes)) {
@@ -916,8 +916,8 @@ PUBLIC BOOL HTConfirmCookie ARGS4(
return TRUE;
case 'N':
- case 7: /* Ctrl-G */
- case 3: /* Ctrl-C */
+ case LYCharINTERRUPT2: /* Ctrl-G */
+ case LYCharINTERRUPT1: /* Ctrl-C */
/*
** Reject the cookie.
*/
--- ./src/HTFWriter.c~ Fri Sep 1 07:23:46 2000
+++ ./src/HTFWriter.c Thu Sep 28 19:04:54 2000
@@ -825,7 +825,7 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
_statusline(CANNOT_DISPLAY_FILE_D_OR_C);
}
- while (c != 'D' && c != 'C' && c != 7) {
+ while (c != 'D' && c != 'C' && !LYCharIsINTERRUPT(c)) {
c = LYgetch_single();
#ifdef VMS
/*
@@ -842,7 +842,7 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
/*
* Cancel on 'C', 'c' or Control-G or Control-C.
*/
- if (c == 'C' || c == 7) {
+ if (c == 'C' || LYCharIsINTERRUPT(c)) {
_statusline(CANCELLING_FILE);
LYCancelDownload = TRUE;
FREE(ret_obj);
--- ./src/LYBookmark.c~ Thu Aug 24 21:30:11 2000
+++ ./src/LYBookmark.c Thu Sep 28 19:06:19 2000
@@ -698,11 +698,10 @@ get_advanced_choice:
#ifdef VMS
if (HadVMSInterrupt) {
HadVMSInterrupt = FALSE;
- c = 7;
+ c = LYCharINTERRUPT2;
}
#endif /* VMS */
- if (LYisNonAlnumKeyname(c, LYK_PREV_DOC) ||
- c == 7 || c == 3) {
+ if (LYisNonAlnumKeyname(c, LYK_PREV_DOC) || LYCharIsINTERRUPT(c)) {
/*
* Treat left-arrow, ^G, or ^C as cancel.
*/
--- ./src/LYCookie.c~ Thu Aug 24 21:30:11 2000
+++ ./src/LYCookie.c Thu Sep 28 19:07:26 2000
@@ -2436,8 +2436,8 @@ PRIVATE int LYHandleCookies ARGS4 (
return(HT_NO_DATA);
case 'C':
- case 7: /* Ctrl-G */
- case 3: /* Ctrl-C */
+ case LYCharINTERRUPT2: /* Ctrl-G */
+ case LYCharINTERRUPT1: /* Ctrl-C */
/*
* Cancelled. - FM
*/
--- ./src/LYForms.c~ Thu Aug 3 13:19:52 2000
+++ ./src/LYForms.c Thu Sep 28 19:08:36 2000
@@ -489,7 +489,7 @@ again:
#ifdef VMS
if (HadVMSInterrupt) {
HadVMSInterrupt = FALSE;
- ch = 7;
+ ch = LYCharINTERRUPT2;
}
#endif /* VMS */
@@ -594,7 +594,7 @@ again:
#ifdef VMS
if (HadVMSInterrupt) {
HadVMSInterrupt = FALSE;
- ch = 7;
+ ch = LYCharINTERRUPT2;
}
#endif /* VMS */
break;
--- ./src/LYMail.c~ Thu Aug 24 21:30:11 2000
+++ ./src/LYMail.c Thu Sep 28 19:09:38 2000
@@ -1687,7 +1687,7 @@ PUBLIC void reply_by_mail ARGS4(
LYCloseTempFP(fd); /* Close the tmpfile. */
scrollok(stdscr,FALSE); /* Stop scrolling. */
- if (term_letter || c == 7 || c == 3)
+ if (term_letter || LYCharIsINTERRUPT(c))
goto cleanup;
/*
@@ -1724,7 +1724,7 @@ PUBLIC void reply_by_mail ARGS4(
refresh();
c = LYgetch();
addstr("\n");
- if (term_letter || c == 7 || c == 3) {
+ if (term_letter || LYCharIsINTERRUPT(c)) {
addstr(CANCELLED);
LYSleepInfo();
LYCloseTempFP(fd); /* Close the tmpfile. */
--- ./src/LYNews.c~ Thu Aug 24 21:30:11 2000
+++ ./src/LYNews.c Thu Sep 28 19:10:06 2000
@@ -366,7 +366,7 @@ PUBLIC char *LYNewsPost ARGS2(
}
LYCloseTempFP(fd); /* Close the temp file. */
scrollok(stdscr, FALSE); /* Stop scrolling. */
- if (term_message || c == 7 || c == 3)
+ if (term_message || LYCharIsINTERRUPT(c))
goto cleanup;
/*
--- ./src/LYOptions.c~ Thu Aug 3 13:19:52 2000
+++ ./src/LYOptions.c Thu Sep 28 19:12:11 2000
@@ -523,7 +523,7 @@ draw_options:
while (response != 'R' &&
!LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
response != '>' && !term_options &&
- response != 7 && response != 3) {
+ LYCharIsINTERRUPT(response)) {
if (AddValueAccepted == TRUE) {
_statusline(VALUE_ACCEPTED);
AddValueAccepted = FALSE;
@@ -535,7 +535,7 @@ draw_options:
refresh();
response = LYgetch_single();
- if (term_options || response == 7 || response == 3)
+ if (term_options || LYCharIsINTERRUPT(response))
response = 'R';
if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
lynx_force_repaint();
@@ -1711,7 +1711,7 @@ PRIVATE int boolean_choice ARGS4(
if (term_options == FALSE) {
response = LYgetch_single();
}
- if (term_options || response == 7) {
+ if (term_options || LYCharIsINTERRUPT(response)) {
/*
* Control-C or Control-G.
*/
@@ -1940,8 +1940,7 @@ draw_bookmark_list:
while (!term_options &&
!LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
- response != 7 && response != 3 &&
- response != '>') {
+ !LYCharIsINTERRUPT(response) && response != '>') {
move((LYlines - 2), 0);
lynx_start_prompt_color ();
@@ -1955,8 +1954,7 @@ draw_bookmark_list:
/*
* Check for a cancel.
*/
- if (term_options ||
- response == 7 || response == 3 ||
+ if (term_options || LYCharIsINTERRUPT(response) ||
LYisNonAlnumKeyname(response, LYK_PREV_DOC))
continue;
--- ./src/LYStrings.c~ Thu Aug 24 21:30:11 2000
+++ ./src/LYStrings.c Thu Sep 28 21:33:11 2000
@@ -1553,7 +1553,7 @@ re_read:
if (sigint)
sigint = FALSE;
#endif /* IGNORE_CTRL_C */
- return(7); /* use ^G to cancel whatever called us. */
+ return(LYCharINTERRUPT2); /* use ^G to cancel whatever called us. */
}
}
#endif /* !USE_SLANG || VMS */
@@ -1634,12 +1634,12 @@ re_read:
goto re_read;
}
#endif /* IGNORE_CTRL_C */
- return(7); /* use ^G to cancel whatever called us. */
+ return(LYCharINTERRUPT2); /* use ^G to cancel whatever called us. */
}
#else /* not USE_SLANG: */
if (feof(stdin) || ferror(stdin) || c == EOF) {
if (recent_sizechange)
- return(7); /* use ^G to cancel whatever called us. */
+ return(LYCharINTERRUPT2); /* use ^G to cancel whatever called us. */
#ifdef IGNORE_CTRL_C
if (sigint) {
sigint = FALSE;
@@ -2368,8 +2368,8 @@ PUBLIC int LYgetch NOARGS
PUBLIC int LYgetch_choice NOARGS
{
int ch = LYReadCmdKey(FOR_CHOICE);
- if (ch == 3)
- ch = 7; /* treat ^C the same as ^G */
+ if (ch == LYCharINTERRUPT1)
+ ch = LYCharINTERRUPT2; /* treat ^C the same as ^G */
return ch;
}
@@ -2379,8 +2379,8 @@ PUBLIC int LYgetch_choice NOARGS
PUBLIC int LYgetch_input NOARGS
{
int ch = LYReadCmdKey(FOR_INPUT);
- if (ch == 3)
- ch = 7; /* treat ^C the same as ^G */
+ if (ch == LYCharINTERRUPT1)
+ ch = LYCharINTERRUPT2; /* treat ^C the same as ^G */
return ch;
}
@@ -2391,8 +2391,8 @@ PUBLIC int LYgetch_input NOARGS
PUBLIC int LYgetch_single NOARGS
{
int ch = LYReadCmdKey(FOR_SINGLEKEY);
- if (ch == 3)
- ch = 7; /* treat ^C the same as ^G */
+ if (ch == LYCharINTERRUPT1)
+ ch = LYCharINTERRUPT2; /* treat ^C the same as ^G */
else if (ch > 0 && ch < 256)
ch = TOUPPER(ch); /* will ignore case of result */
return ch;
@@ -3766,7 +3766,7 @@ redraw:
LYstowCursor(form_window, row, 1);
c = LYgetch_choice();
- if (term_options || c == 7) { /* Control-C or Control-G */
+ if (term_options || LYCharIsINTERRUPT(c)) { /* Control-C or Control-G */
cmd = LYK_QUIT;
#ifndef USE_SLANG
} else if (c == MOUSE_KEY) {
@@ -4474,7 +4474,7 @@ again:
#ifdef VMS
HadVMSInterrupt = FALSE;
#endif /* VMS */
- ch = 7;
+ ch = LYCharINTERRUPT2;
}
if (recall != NORECALL && (ch == UPARROW || ch == DNARROW)) {
--- ./src/LYUtils.c~ Thu Aug 24 21:30:11 2000
+++ ./src/LYUtils.c Thu Sep 28 21:34:08 2000
@@ -2363,7 +2363,7 @@ PUBLIC int HTCheckForInterrupt NOARGS
*/
/** Keyboard 'Z' or 'z', or Control-G or Control-C **/
- if (TOUPPER(c) == 'Z' || c == 7 || c == 3)
+ if (TOUPPER(c) == 'Z' || LYCharIsINTERRUPT(c))
return((int)TRUE);
/* There is a subset of mainloop() actions available at this stage:
@@ -4926,7 +4926,7 @@ PUBLIC int win32_check_interrupt()
if (kbhit()) {
c = getch();
/** Keyboard 'Z' or 'z', or Control-G or Control-C **/
- if (TOUPPER(c) == 'Z' || c == 7 || c == 3 || c == 0x1b) {
+ if (TOUPPER(c) == 'Z' || LYCharIsINTERRUPT(c) || c == 0x1b) {
return TRUE;
}
}
--- ./src/LYUtils.h~ Thu Aug 24 21:30:11 2000
+++ ./src/LYUtils.h Thu Sep 28 18:59:07 2000
@@ -34,6 +34,10 @@
#define LYIsPipeCommand(s) ((s)[0] == '|')
+#define LYCharINTERRUPT1 3 /* Control-C */
+#define LYCharINTERRUPT2 7 /* Control-G */
+#define LYCharIsINTERRUPT(ch) ((ch) == LYCharINTERRUPT1 || ch ==
LYCharINTERRUPT2)
+
#if defined(DOSPATH) || defined(__EMX__)
#define LYIsPathSep(ch) ((ch) == '/' || (ch) == '\\')
#else
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
- lynx-dev Minor patch [2-8-4] for interrupting lynx,
Ilya Zakharevich <=