Xref: utzoo alt.sources:99 comp.unix.xenix:1355 Path: utzoo!hoptoad!cpsc6a!codas!ateng!chip From: chip@ateng.UUCP (Chip Salzenberg) Newsgroups: alt.sources,comp.unix.xenix Subject: Elm 1.7 beta: patches for Xenix (3 of 7) Message-ID: <170@ateng.UUCP> Date: 27 Jan 88 00:27:46 GMT Organization: A T Engineering, Tampa, FL Lines: 115 Patches for filter/*.[hc]. #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the "#! /bin/sh" line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # p.filter # This archive created: Tue Jan 26 19:14:41 1988 export PATH; PATH=/bin:$PATH : echo 'shar: extracting "p.filter" (2312 characters) ' if test -f 'p.filter' then echo 'shar: will not overwrite existing file "p.filter" ' else sed 's/^X//' << \SHAR_EOF > 'p.filter' XIndex: actions.c X*** elm1.7beta/filter/actions.c Mon Nov 2 20:14:16 1987 X--- elm/filter/actions.c Tue Dec 22 17:27:10 1987 X*************** X*** 28,31 **** X FILE *pipefd, *tempfd, *mailfd; X! int attempts = 0, ret, in_header = TRUE, line_count = 0; X! char tempfile[SLEN], mailbox[SLEN], lockfile[SLEN], X buffer[VERY_LONG_STRING]; X--- 28,31 ---- X FILE *pipefd, *tempfd, *mailfd; X! int in_header = TRUE, line_count = 0, fd, attempts, locked; X! char tempfile[SLEN], mailbox[SLEN], lockfile[SLEN], locktemp[SLEN], X buffer[VERY_LONG_STRING]; X*************** X*** 92,93 **** X--- 92,98 ---- X sprintf(mailbox, "%s%s", mailhome, username); X+ X+ #ifdef M_XENIX X+ sprintf(lockfile, "/tmp/%s.mlk", username); X+ sprintf(locktemp, "/tmp/Filter.XXXXXX"); X+ #else X sprintf(lockfile, "%s%s.lock", mailhome, username); X*************** X*** 93,94 **** X--- 98,102 ---- X sprintf(lockfile, "%s%s.lock", mailhome, username); X+ sprintf(locktemp, "%sFilter.XXXXXX", mailhome); X+ #endif X+ mktemp(locktemp); X X*************** X*** 94,97 **** X X! while ((ret=creat(lockfile, 0777)) < 0 && attempts++ < 10) X! sleep(2); /* wait two seconds, okay?? */ X X--- 102,104 ---- X X! locked = FALSE; X X*************** X*** 97,99 **** X X! if (ret < 0) { X fprintf(stderr, "%sfilter (%s): Couldn't create lockfile %s\n", X--- 104,120 ---- X X! if ((fd = creat(locktemp, 0)) != -1) { X! close(fd); X! X! for (attempts = 0; attempts < 10; ++attempts) { X! if (link(locktemp, lockfile) == 0) { X! locked = TRUE; X! break; X! } X! sleep(5); /* wait five seconds, okay?! */ X! } X! X! unlink(locktemp); X! } X! X! if (!locked) { X fprintf(stderr, "%sfilter (%s): Couldn't create lockfile %s\n", X*************** X*** 122,124 **** X fclose(tempfd); X! unlink(lockfile); X leave("Cannot open any mailbox"); /* DIE DIE DIE DIE!! */ X--- 143,146 ---- X fclose(tempfd); X! if (locked) X! unlink(lockfile); X leave("Cannot open any mailbox"); /* DIE DIE DIE DIE!! */ X*************** X*** 146,148 **** X fclose(mailfd); X! unlink(lockfile); /* blamo! */ X fclose(tempfd); X--- 168,171 ---- X fclose(mailfd); X! if (locked) X! unlink(lockfile); /* blamo! */ X fclose(tempfd); SHAR_EOF if test 2312 -ne `wc -c < 'p.filter'` then echo 'shar: error transmitting "p.filter" (should have been 2312 characters) ' fi chmod 644 'p.filter' fi # end of overwriting check # End of shell archive exit 0 -- Chip Salzenberg UUCP: "{codas,uunet}!ateng!chip" A T Engineering My employer's opinions are a trade secret. "Anything that works is better than anything that doesn't."