9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: dhog@plan9.cs.su.oz.au dhog@plan9.cs.su.oz.au
Subject: fixes
Date: Thu, 17 Aug 1995 23:41:11 -0400	[thread overview]
Message-ID: <19950818034111.JG2-tOW-lqEoAp67xWctaeOQ1098r7f33oI_UEG2cvI@z> (raw)

>Did anybody port "patch" to plan9?  That would make
>diffs a lot more useful.

Yes, and it's not too hard either.  You can run patch's configure script
under ape, and it works suprisingly well.  Then you just have to edit the
Makefile, adding "LIBS = -lap" and deleting "rename.o" from OBJS, and
edit util.c, replacing ask() with something sensible.  Oh, and you need
to apply the fix to ape's rename() function that I posted to the list.

So, just run "ape/psh", then type "sh configure", edit the Makefile and util.c
as suggested above, then type make, and you should get a patch binary.
If patch corrupts your files, then you need to fix rename() (don't try this
at home kids!)

Here is the hacked version of ask() that I use, which doesn't try to read
standard output or standard error:

void
ask(pat,arg1,arg2,arg3)
char *pat;
long arg1,arg2,arg3;
{
    static int ttyfd = -1;
    int r;

    Sprintf(buf, pat, arg1, arg2, arg3);
    Fflush(stderr);
    if (ttyfd >= 0 || (ttyfd = open("/dev/cons", 2)) >= 0) {
	write(ttyfd, buf, strlen(buf));
	r = read(ttyfd, buf, sizeof buf);
	Close(ttyfd);
    }
    else {				/* no terminal at all--default it */
	buf[0] = '\n';
	r = 1;
    }
    if (r <= 0)
	buf[0] = 0;
    else
	buf[r] = '\0';
}






             reply	other threads:[~1995-08-18  3:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-08-18  3:41 dhog [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-08-18 13:57 fixes Scott
1995-08-18  1:34 fixes Bruce
1995-08-18  1:02 fixes forsyth
1995-08-17 11:32 fixes Vadim
1995-08-17 11:13 fixes Vadim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19950818034111.JG2-tOW-lqEoAp67xWctaeOQ1098r7f33oI_UEG2cvI@z \
    --to=dhog@plan9.cs.su.oz.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).