Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!BRL.MIL!phil From: phil@BRL.MIL (Phil Dykstra) Newsgroups: comp.windows.x Subject: Re: twm vs. gcc Message-ID: <8904050536.aa17890@SPARK.BRL.MIL> Date: 5 Apr 89 09:36:17 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 31 The Sun sscanf() routine does an ungetc() that writes in the string. The following patch will allow you to compile twm with gcc without using -fwritable-strings. The fix is due to the folks at CSRI. Your line numbers will vary (I've got other changes in twm.c as well). - Phil *** /tmp/,RCSt1a04232 Wed Apr 5 05:28:45 1989 --- twm.c Mon Mar 27 00:51:47 1989 *************** *** 373,381 **** 0, 0, 5, InitialFont.height + 4, BW, DefaultC.fore, DefaultC.back); /* contruct the version string */ sprintf(Version, "%s", &Revision[1]); Version[strlen(Version) - 1] = '\0'; - sscanf(&Date[7], "%d/%d/%d", &y, &m, &d); sprintf(Version, "%s Date: %d/%d/%d %s", Version, m, d, y, &Date[16]); Version[strlen(Version) - 2] = '\0'; --- 390,399 ---- 0, 0, 5, InitialFont.height + 4, BW, DefaultC.fore, DefaultC.back); /* contruct the version string */ + strcpy(Version, &Date[7]); + sscanf(Version, "%d/%d/%d", &y, &m, &d); sprintf(Version, "%s", &Revision[1]); Version[strlen(Version) - 1] = '\0'; sprintf(Version, "%s Date: %d/%d/%d %s", Version, m, d, y, &Date[16]); Version[strlen(Version) - 2] = '\0';