diff -uN ghostview-1.4/Ghostview.ad ghostview-1.4.1/Ghostview.ad --- ghostview-1.4/Ghostview.ad Thu Oct 1 14:08:39 1992 +++ ghostview-1.4.1/Ghostview.ad Thu Oct 29 15:31:26 1992 @@ -151,6 +151,7 @@ Return: GhostviewNext() \n\ F: GhostviewNext() \n\ Next: GhostviewNext() \n\ + Tab: GhostviewNext() \n\ period: GhostviewShow() \n\ CtrlL: GhostviewShow() \n\ M: GhostviewMark() \n\ @@ -193,6 +194,7 @@ Return: GhostviewNext() \n\ F: GhostviewNext() \n\ Next: GhostviewNext() \n\ + Tab: GhostviewNext() \n\ period: GhostviewShow() \n\ CtrlL: GhostviewShow() \n\ M: GhostviewMark() \n\ diff -uN ghostview-1.4/Ghostview.c ghostview-1.4.1/Ghostview.c --- ghostview-1.4/Ghostview.c Sun Oct 11 15:36:11 1992 +++ ghostview-1.4.1/Ghostview.c Tue Oct 27 10:37:16 1992 @@ -976,6 +976,7 @@ if (gvw->ghostview.use_bpixmap) { if (gvw->core.background_pixmap == XtUnspecifiedPixmap) { /* Get a Backing Pixmap, but be ready for the BadAlloc. */ + XSync(XtDisplay(w), False); /* Get to known state */ oldhandler = XSetErrorHandler(catch_alloc); alloc_error = False; bpixmap = XCreatePixmap(XtDisplay(w), XtWindow(w), diff -uN ghostview-1.4/HISTORY ghostview-1.4.1/HISTORY --- ghostview-1.4/HISTORY Sun Oct 11 15:27:32 1992 +++ ghostview-1.4.1/HISTORY Mon Nov 2 17:51:20 1992 @@ -1,3 +1,19 @@ +==================== ghostview 1.4.1 ( 2 Nov 92) ===================== + + 1. Fix a couple of bugs introduced into the PostScript comment scanner. + - Change isblank() to blank() to avoid name clash. + - Upgrade blank() to call not DSC comments blank lines. + - Avoid core dump by guarding against garbage bewteen the %%EndSetup + and first %%Page. + - Collsaped sections (Documents, Files, ProcSets, etc.) are no longer + returned as a comment line. They are now properly recognized. + - Avoid looping by truncating line buffer at EOF. + + 2. Synchronize X connection before trying to force error associated with + backing pixmap. + + 3. Add as another keyboard accelerator for Next. + ==================== ghostview 1.4 (11 Oct 92) ===================== 1. Merge in VMS support from Terry Poot . diff -uN ghostview-1.4/main.c ghostview-1.4.1/main.c --- ghostview-1.4/main.c Tue Oct 6 21:01:56 1992 +++ ghostview-1.4.1/main.c Mon Nov 2 17:12:40 1992 @@ -55,7 +55,7 @@ extern char *getenv(); -static String version = "Ghostview, version 1.4"; +static String version = "Ghostview, version 1.4.1"; static XtResource resources[] = { {"showTitle", "Labels", XtRBoolean, sizeof(Boolean), diff -uN ghostview-1.4/misc.c ghostview-1.4.1/misc.c --- ghostview-1.4/misc.c Sat Oct 10 15:08:38 1992 +++ ghostview-1.4.1/misc.c Tue Oct 27 10:39:16 1992 @@ -474,7 +474,7 @@ XtPointer client_data; XtIntervalId *timer; { - XSync(XtDisplay(toplevel), False); + XSync(XtDisplay(toplevel), False); /* Push everything out */ if (XtAppPending(app_con)) { XtAppAddTimeOut(app_con, delay, try_try_again, NULL); /* fprintf(stderr, "Delaying(%d)...\n",delay); */ diff -uN ghostview-1.4/ps.c ghostview-1.4.1/ps.c --- ghostview-1.4/ps.c Wed Sep 30 17:01:34 1992 +++ ghostview-1.4.1/ps.c Thu Oct 29 16:39:00 1992 @@ -69,7 +69,7 @@ static char *readline(); static char *gettextline(); static char *gettext(); -static int isblank(); +static int blank(); /* * psscan -- scan the PostScript file for document structuring comments. @@ -145,7 +145,7 @@ * * The Setup section is where the version 2 page defaults are found. * This section either explicitly begins with %%BeginSetup or implicitly - * with any noblank line after the Prolog. + * with any nonblank line after the Prolog. * * %%BeginSetup * %%PageBoundingBox: @@ -510,7 +510,7 @@ /* Optional Preview comments for encapsulated PostScript files */ - while (isblank(line) && + while (blank(line) && readline(line, sizeof line, file, &position, &line_len)) { } @@ -530,7 +530,7 @@ /* Page Defaults for Version 3.0 files */ - while (isblank(line) && + while (blank(line) && readline(line, sizeof line, file, &position, &line_len)) { } @@ -599,7 +599,7 @@ /* Document Prolog */ - while (isblank(line) && + while (blank(line) && readline(line, sizeof line, file, &position, &line_len)) { } @@ -629,7 +629,7 @@ /* Document Setup, Page Defaults found here for Version 2 files */ - while (isblank(line) && + while (blank(line) && readline(line, sizeof line, file, &position, &line_len)) { } @@ -709,7 +709,7 @@ /* Individual Pages */ - while (isblank(line) && + while (blank(line) && readline(line, sizeof line, file, &position, &line_len)) { } @@ -850,8 +850,10 @@ free(gettext(line+length("%%Page:"), &next_char)); if (sscanf(next_char, "%d", &thispage) != 1) thispage = 0; if (!ignore && thispage == nextpage) { - doc->pages[doc->numpages-1].end = position; - doc->pages[doc->numpages-1].len += section_len - line_len; + if (doc->numpages > 0) { + doc->pages[doc->numpages-1].end = position; + doc->pages[doc->numpages-1].len += section_len - line_len; + } goto newpage; } } else if (bb_set == ATEND && iscomment(line+2, "BoundingBox:")) { @@ -1102,7 +1104,8 @@ if (position) *position = ftell(fp); cp = fgets(line, size, fp); - *line_len = cp ? strlen(line) : 0; + if (cp == NULL) line[0] = '\0'; + *line_len = strlen(line); if (iscomment(line, "%%BeginDocument:")) { strcpy(save, line+7); while (readline(line, size, fp, NULL, &nbytes) && @@ -1110,7 +1113,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginFeature:")) { strcpy(save, line+7); while (readline(line, size, fp, NULL, &nbytes) && @@ -1118,7 +1121,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginFile:")) { strcpy(save, line+7); while (readline(line, size, fp, NULL, &nbytes) && @@ -1126,7 +1129,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginFont:")) { strcpy(save, line+7); while (readline(line, size, fp, NULL, &nbytes) && @@ -1134,7 +1137,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginProcSet:")) { strcpy(save, line+7); while (readline(line, size, fp, NULL, &nbytes) && @@ -1142,7 +1145,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginResource:")) { strcpy(save, line+7); while (readline(line, size, fp, NULL, &nbytes) && @@ -1150,7 +1153,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginData:")) { text[0] = '\0'; strcpy(save, line+7); @@ -1175,7 +1178,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } else if (iscomment(line, "%%BeginBinary:")) { strcpy(save, line+7); if(sscanf(line+length("%%BeginBinary:"), "%d", &num) == 1) { @@ -1192,7 +1195,7 @@ *line_len += nbytes; } *line_len += nbytes; - strcpy(line+2, save); + strcpy(line, save); } return cp; } @@ -1337,13 +1340,15 @@ } /* - * isblank -- determine whether the line contains nothing but whitespace. + * blank -- determine whether the line contains nothing but whitespace. */ static int -isblank(line) +blank(line) char *line; { - while (*line == ' ' || *line == '\t') line++; - return *line == '\n'; + char *cp = line; + + while (*cp == ' ' || *cp == '\t') cp++; + return *cp == '\n' || (*cp == '%' && (line[0] != '%' || line[1] != '%')); }