diff options
author | Deron Johnson <deron.johnson@sun.com> | 2005-02-18 17:37:21 +0000 |
---|---|---|
committer | Deron Johnson <deron.johnson@sun.com> | 2005-02-18 17:37:21 +0000 |
commit | 7a611be042ea94a1f5e010bd035bbda706733500 (patch) | |
tree | 5379e29c1bcf6e73ec293f2ac0391548a20f8560 | |
parent | 545064318591f8c27701da0af0ebc5d9fd1b2ec5 (diff) |
-rw-r--r-- | print.c | 4 | ||||
-rw-r--r-- | search.c | 20 |
2 files changed, 17 insertions, 7 deletions
@@ -294,6 +294,10 @@ void DoPrintManpage(const char *programname, apd->jobtitle = jobtitle; n = 0; + /* Override any geometry resource settings as XawPrintShell adjusts it's size + * to the current page siue when |XawPrintLAYOUTMODE_DRAWABLEAREA| or + * |XawPrintLAYOUTMODE_PAGESIZE| are used. */ + XtSetArg(args[n], XtNgeometry, "+0+0"); n++; XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++; apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "printshell", args, n); @@ -169,6 +169,10 @@ DoSearch(ManpageGlobals * man_globals, int type) return(NULL); } + if (strlen(search_string) >= BUFSIZ) { + PopupWarning(man_globals, "Search string too long."); + return(NULL); + } if (search_string[0] == ' ') { PopupWarning(man_globals, "First character cannot be a space."); return(NULL); @@ -205,16 +209,17 @@ DoSearch(ManpageGlobals * man_globals, int type) strcpy(path,manpath); } - sprintf(label,"Results of apropos search on: %s", search_string); + snprintf(label, sizeof(label), + "Results of apropos search on: %s", search_string); #ifdef NO_MANPATH_SUPPORT /* not quite correct, but the best I can do. */ - sprintf(cmdbuf, APROPOS_FORMAT, search_string, mantmp); + snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, search_string, mantmp); #else - sprintf(cmdbuf, APROPOS_FORMAT, path, search_string, mantmp); + snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, path, search_string, mantmp); #endif if(system(cmdbuf) != 0) { /* execute search. */ - sprintf(error_buf,"Something went wrong trying to run %s\n",cmdbuf); + snprintf(error_buf, sizeof(error_buf), "Something went wrong trying to run %s\n",cmdbuf); PopupWarning(man_globals, error_buf); } @@ -232,7 +237,7 @@ DoSearch(ManpageGlobals * man_globals, int type) unlink(mantmp); - sprintf(string_buf,"%s: nothing appropriate", search_string); + snprintf(string_buf, sizeof(string_buf), "%s: nothing appropriate", search_string); /* * Check first LOOKLINES lines for "nothing appropriate". @@ -263,14 +268,15 @@ DoSearch(ManpageGlobals * man_globals, int type) return(NULL); } - strcpy(man_globals->manpage_title,label); + snprintf(man_globals->manpage_title, sizeof(man_globals->manpage_title), + "%s", label); ChangeLabel(man_globals->label,label); fseek(file, 0L, SEEK_SET); /* reset file to point at top. */ } else { /* MANUAL SEACH */ file = DoManualSearch(man_globals, search_string); if (file == NULL) { - sprintf(string_buf,"No manual entry for %s.", search_string); + snprintf(string_buf, sizeof(string_buf), "No manual entry for %s.", search_string); ChangeLabel(man_globals->label, string_buf); if (man_globals->label == NULL) PopupWarning(man_globals, string_buf); |