Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!uwm.edu!cs.utexas.edu!uunet!pipex!sunic!news.funet.fi!funic!news.eunet.fi!marvin.hpy.fi!mte From: mte@hpy.fi (Marko Teiste) Newsgroups: comp.os.386bsd.bugs Subject: msgs(1) fix Date: 13 Aug 1993 11:25:33 GMT Organization: Helsinki Telephone Company Lines: 91 Message-ID: <24ftnr$4d7@marvin.hpy.fi> NNTP-Posting-Host: marvin.hpy.fi Summary: patch for msgs.c Keywords: msgs patch X-Newsreader: TIN [version 1.2 PL0] msgs didn't know which articles were new due to incorrect update of ~/.msgsrc and therefore all messages were considered to be unread. Following diff takes care of this problem. (Ignore if similar patch has already been posted) --- CUT HERE --- CUT HERE --- CUT HERE --- CUT HERE --- CUT HERE --- *** msgs.c.orig Fri Aug 13 14:10:01 1993 --- msgs.c Wed Jul 28 16:46:46 1993 *************** *** 374,380 **** } if (clean) exit(0); - /* * prepare to display messages */ --- 374,379 ---- *************** *** 382,395 **** use_pager = use_pager && totty; sprintf(fname, "%s/%s", getenv("HOME"), MSGSRC); ! msgsrc = fopen(fname, "r"); if (msgsrc) { newrc = NO; ! fscanf(msgsrc, "%d\n", &nextmsg); ! fclose(msgsrc); ! if (nextmsg > lastmsg+1) { printf("Warning: bounds have been reset (%d, %d)\n", ! firstmsg, lastmsg); truncate(fname, (off_t)0); newrc = YES; } --- 381,393 ---- use_pager = use_pager && totty; sprintf(fname, "%s/%s", getenv("HOME"), MSGSRC); ! msgsrc = fopen(fname, "r+"); if (msgsrc) { newrc = NO; ! if (1 != fscanf(msgsrc, "%d\n", &nextmsg) || ! nextmsg > lastmsg+1) { printf("Warning: bounds have been reset (%d, %d)\n", ! firstmsg, lastmsg); truncate(fname, (off_t)0); newrc = YES; } *************** *** 396,408 **** else if (!rcfirst) rcfirst = nextmsg - rcback; } ! else newrc = YES; ! msgsrc = fopen(fname, "a"); if (msgsrc == NULL) { perror(fname); exit(errno); } if (rcfirst) { if (rcfirst > lastmsg+1) { printf("Warning: the last message is number %d.\n", --- 394,409 ---- else if (!rcfirst) rcfirst = nextmsg - rcback; } ! else { ! msgsrc = fopen(fname, "w+"); newrc = YES; ! } ! if (msgsrc == NULL) { perror(fname); exit(errno); } + if (rcfirst) { if (rcfirst > lastmsg+1) { printf("Warning: the last message is number %d.\n", --- CUT HERE --- CUT HERE --- CUT HERE --- CUT HERE --- CUT HERE --- -- Marko.Teiste@hpy.fi, mte@cirion.fi | I think we are in rats' alley PGP key available | Where the dead men lost their bones