Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!dciem!nrcaer!cognos!sarahm From: sarahm@cognos.uucp (Sarah Metcalfe) Newsgroups: comp.sources.bugs Subject: Re: Monthtool from comp.sources.unix Message-ID: <1770@cognos.UUCP> Date: Mon, 16-Nov-87 17:05:08 EST Article-I.D.: cognos.1770 Posted: Mon Nov 16 17:05:08 1987 Date-Received: Thu, 19-Nov-87 02:49:35 EST References: <5419@jhunix.UUCP> Reply-To: sarahm@batman.UUCP (Sarah Metcalfe) Organization: Cognos Inc., Ottawa, Canada Lines: 123 In article <5419@jhunix.UUCP> apl_aimh@jhunix.UUCP (Marty Hall) writes: >when I clicked on any reminder icon, I got "^?" in the text window, >instead of that icon. This problem has been reported to me by a number of people. Someone figured out that it was a problem with SunOS 3.4; unfortunately, I only have access to 3.2, so I was unable to try things out. Luckily, I just received this fix from D. Brent Chapman (capmkt!brent) [thank you!]. It works for him under 3.4 and causes me no problems under 3.2: ---------------------- Start of forwarded message ---------------------- In the current version of SunOS (3.4), SunView ignores the WIN_FONT parameter in the window_create() function call if you are creating a window of type TEXTSW, and always uses the user's default font. This has been demonstrated, and is documented in passing in the WIN_FONT entry on page 332 of the SunView Programmer's Guide (Revision A, 15 Oct 86). What this means is that notes in the notesDsply window show up in the default font, rather than in monthtool.font, and therefore don't have their typeChar (the little 'D', 'T', or 'Y' in a box, or the filled-in box) displayed properly (they all show up as "^?"). Because of the way monthtool is written, I assume that in some past release WIN_FONT was _not_ ignored. It turns out the workaround for the problem I described previously is relatively simple; you just set the environment variable "DEFAULT_FONT" to the monthtool font before you make any SunView calls. Appended is a set of context diffs between your original code and my modified code. ======== Output of "diff -c monthtool.c.orig monthtool.c" *** monthtool.c.orig Mon Nov 9 10:54:17 1987 --- monthtool.c Mon Nov 9 10:58:32 1987 *************** *** 10,15 **** --- 10,23 ---- Discussion: Displays a calendar to the screen for a given month. User may move the mouse to any day of the month and view or enter appointments for that date. + + Modified: D. Brent Chapman (capmkt!brent), 9 Nov 87 + Set the default font (via the "DEFAULT_FONT" + environment variable) to the monthtool font, + so that the program works properly under + SunOS 3.4 (which, for some reason, ignores + the WIN_FONT attribute when creating a TEXTSW + window such as the notesDsply window). */ *************** *** 284,289 **** --- 292,299 ---- 31, 31, 30, 31, 30, 31, }; + + char fontEnv[80]; ^L main(argc, argv) *************** *** 296,301 **** --- 306,323 ---- int type; + /* set default font */ + + strcpy(fontString, FONTDIR); + strcat(fontString, NORMALFONT); + + strcpy(fontEnv, "DEFAULT_FONT="); + strcat(fontEnv, fontString); + putenv(fontEnv); + + font = pf_open(LARGEFONT); /* Open large sized font. */ + notesFont = pf_open(fontString); /* Open regular sized font. */ + /* Set up menus */ fileMenu = menu_create(MENU_ITEM, *************** *** 324,334 **** ^L /* Set up windows */ - - font = pf_open(LARGEFONT); /* Open large sized font. */ - strcpy(fontString, FONTDIR); - strcat(fontString, NORMALFONT); - notesFont ^L= pf_open(fontString); /* Open regular sized font. */ frame = window_create(0, FRAME, FRAME_ICON, &monthIcon, --- 346,351 ---- ---------------------- End of forwarded message ---------------------- Hope it helps. >However, when I saved anything, so that there >was a ".monthtool" file in my home directory, the next time I >brought up monthtool it would give me a segmentation fault and >dump the core. Deleting ".monthtool" would solve the problem until >the next time I saved anything, exited monthtool, and came back. I am at a loss to explain this one. Please repost if this occurs again. Sarah Metcalfe ------- P.S. to Marty Hall: I received your mail message and have been trying to reply for a while, but we have a very flakey mailer and all my messages to you get returned. I'm glad you posted so that I could reply! -- Sarah Metcalfe decvax!utzoo!dciem!nrcaer!cognos!sarahm Cognos Incorporated P.O. Box 9707, 3755 Riverside Drive, Ottawa, Ontario, CANADA K1G 3Z4 (613) 738-1440