gk5g+@ANDREW.CMU.EDU (Gary Keim) (10/26/90)
If your code relies on ULstrncmp(s1,s2,n) as provided in libutil.a and defined in andrew/overhead/util/lib/ulstrcmp.c beware that as of the next patch the value returned by that routine will be correct! The comment for that routine is correct but it now actually returns the opposite magnitude. int ULstrncmp(s1,s2,n) char *s1, *s2; int n; { /* case INSENSITIVE: Compare strings, up to n chars: s1>s2: >0 s1==s2: 0 s1<s2: <0 */ register int i; register int result = 0; for(i = 0;(s1[i] || s2[i]) && i<n && !result;++i){ result = DOWNCASE(s2[i]) - DOWNCASE(s1[i]); } return(result); } If you have any code that looks like; if( ULstrncmp(s1,s2,n) < 0 ) break; it will have to be changed to be: if( ULstrncmp(s1,s2,n) > 0 ) break;
pive@BANRUC01.BITNET (10/30/90)
I'm still trying to build andrew with sunos4.1... So, the following questions: Like I've been told I did the following: OK. In andrew/ams/msclients/cui/{cui.c,cuifns.c} change all callsto strnicmp to ULstrncmp. As well, comment out the definition of strnicmp incuifns.c. Recompile. That should work. Ok everything compiles fine, but cui, vui, messages don't work at all. Sowill changing in andrew/ams/msclients/cui/{cui.c,cuifns.c} the testconcerning ULstrcmp solve this problem? Ez core dumps when I trie to edit a directory, is this problem related to theforegoing, or is it something new? You told about the next patch: when will it be available? will it solve theproblems with sunos4.1? P.S. Most other things seems to work decent (but I haven't tested everythingin detail). thanks. P. Verhaeghe University of Antwerp, RUCA Algebra / Geometry Groenenborgerlaan 171 B-2020 Antwerpen, Belgium Tel: +32 3 2180308 Fax: +32 3 2180217 Telex: RUCABI 33362 E-mail: pive@banruc01.bitnet (or pive@ccu.uia.ac.be)
Craig_Everhart@TRANSARC.COM (10/31/90)
At least one use of strnicmp in cui.c cared about whether it returned >0 or <0, even though most uses (as expected) cared only whether it returned 0 or not. In my copy of the code, ULstrcmp(s1, s2) ultimately returns (s1 - s2), while both ULstrncmp(s1, s2, len) and strnicmp(s1, s2, len) ultimately return (s2 - s1), even though the comment in ULstrncmp says that it returns (s1 - s2). Thus, I believe that in my copy of things, one could use ULstrncmp and strnicmp interchangeably, though if one is changed to return (s1 - s2) instead, the replacement couldn't happen unless the relevant call site were changed, too (in this case, the CheckHead routine in andrew/ams/msclients/cui/cui.c). Hope this helps. Craig
gk5g+@ANDREW.CMU.EDU (Gary Keim) (10/31/90)
Excerpts from misc: 30-Oct-90 Re: ULstrncmp pive%BANRUC01.BITNET@vma (1122+0) > Ok everything compiles fine, but cui, vui, messages don't work at all. > So will changing in andrew/ams/msclients/cui/{cui.c,cuifns.c} the test > concerning ULstrcmp solve this problem? If you followed my instructions then the problem is not with ULstrncmp. The problem with {messages,vui,cui} is one that was discovered by Jishnu Mukerji. There are some routines in ams/libs/ms/subs.c that are suppose to return values but which do not. Here is the substance of his message on the subject: Enclosed below is the context diff of ams/libs/ms/subs.c for fixing coredumping and other goofy things in AMS under SunOS4.1 on Sun4. ________________ context diff of ams/libs/ms/subs.c _________________ *** /vol/mtgzfs2.5/dy/andrew/ams/libs/ms/subs.c Mon Aug 6 10:59:51 1990 --- subs.c Mon Oct 15 13:13:22 1990 *************** *** 274,279 **** --- 274,280 ---- } HasInitializedSubsPriorities = 0; ++SubsModCtr; + return(0); } ReadSubs() *************** *** 487,492 **** --- 488,494 ---- } else { NonfatalBizarreError(ErrorText); } + return(0); } static Boolean MailPathChanged = FALSE, LocalPathChanged = FALSE, ExtPathChanged = FALSE, OffPathChanged = FALSE; *************** *** 517,522 **** --- 519,525 ---- oldlocallen = strlen(oldlocal); oldofflen = strlen(oldofficial); oldextlen = strlen(oldexternal); + return(0); } HandlePathChange(sub) *************** *** 531,536 **** --- 534,540 ---- if (LocalPathChanged) HandleChange(sub, oldlocal, LOCALSEARCHPATHTEMPLATE, oldlocallen); if (ExtPathChanged) HandleChange(sub, oldexternal, EXTERNALSEARCHPATHTEMPLATE, oldextlen); if (OffPathChanged) HandleChange(sub, oldofficial, OFFICIALSEARCHPATHTEMPLATE, oldofflen); + return(0); } HandleChange(sub, oldpath, newpath, oldlen) *************** *** 560,565 **** --- 564,570 ---- sub->key = malloc(1+strlen(NewName)); strcpy(sub->key, NewName); } + return(0); } *************** *** 579,584 **** --- 584,590 ---- --i; /* Recheck this spot again! */ } } + return(0); } /* For the qsort call */ *************** *** 649,654 **** --- 655,661 ---- ++i; } ++SubsModCtr; + return(0); } *************** *** 676,681 **** --- 683,690 ---- newvalue = MyBuf; } SetFullProfileEntry(FALSE, FullName, NULL, 0, TRUE, newvalue, newdate, FALSE); + /* Fix for random error message bug JIS 10/15/90 */ + return(0); } SetFullProfileEntry(DoSubs, FullName, NickName, status, DoProf, time64, filedate, NeedToCheckPath) *************** *** 956,961 **** --- 965,971 ---- fclose(ProfLockFP); ProfLockFP = NULL; } + return(0); } MakeSubsListInPathOrder() { *************** *** 1114,1119 **** --- 1124,1130 ---- if (!SkipThis) ++NumSubsOrderElts; } HasInitializedSubsPriorities = 1; + return(0); } WhichPath(s) *************** *** 1174,1179 **** --- 1185,1192 ---- } fclose(fp); } + /* Fix for coredump JIS 10/12/90*/ + return(0); } These fixes have been made to the official sources and will be out in the next patch. Speaking of the next patch... I don't know when it will be out, but I would guess surely before the end of November. Excerpts from misc: 30-Oct-90 Re: ULstrncmp pive%BANRUC01.BITNET@vma (1122+0) > Ez core dumps when I trie to edit a directory, is this problem related > to the foregoing, or is it something new? This, seperate, problem has also been rectified and will be in the next patch. I'm sorry that you've had so much difficulty with Andrew on your SunOS4.1 machine. You've been very helpful in making things work better in the future. Thanks, Gary Keim ATK Group
gk5g+@ANDREW.CMU.EDU (Gary Keim) (10/31/90)
Excerpts from misc: 30-Oct-90 Re: ULstrncmp Craig F. Everhart (719+0) > In my copy of the code, ULstrcmp(s1, s2) ultimately returns (s1 - s2), > while both ULstrncmp(s1, s2, len) and strnicmp(s1, s2, len) ultimately > return (s2 - s1), even though the comment in ULstrncmp says that it > returns (s1 - s2). ULstrncmp and strnicmp both returned the wrong value (s2 - s1). In the next patch, strnicmp is gone and ULstrncmp returns (s1 - s2). As well, the call in cui.c that relied on the incorrect return value from strnicmp has been changed to rely on the correct return value from ULstrncmp.