Date: Tue, 11 Feb 1997 07:12:27 -0800 (PST) From: John-Mark Gurney <jmg@nike.efn.org> To: Giles Lean <giles@nemeton.com.au> Cc: freebsd-gnats-submit@freefall.freebsd.org, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: bin/777 patch had problems with closed tty... Message-ID: <Pine.BSF.3.95q.970211065311.24299i-100000@hydrogen.nike.efn.org> In-Reply-To: <199702111136.WAA12347@nemeton.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 11 Feb 1997, Giles Lean wrote: > > On Tue, 11 Feb 1997 00:30:02 -0800 (PST) John-Mark Gurney wrote: > > > comments? is it ok if we change the default?? > > > > I don't like changing the default. I'd rather see no fix than do > this. > > I sent in an alternative patch that is ugly but does solve the problem > without much code change. heh... I see what you mean... well... I think I have a patch that will please every one :)... basicly what this does is adds a return value to ask which you can check... ask will now return 0 if there was an "error" when reading... then you can check this return value and if it's 0 know that you should do something that will continue processesing... else it will return 1 meaning success... I've also modified the 'default' fall back case to return 0 for an error also.. that way it actually fixes the problem else it would still exist... anybody have problems with this patch? here's the patch: Index: pch.c =================================================================== RCS file: /usr/cvs/src/gnu/usr.bin/patch/pch.c,v retrieving revision 1.8 diff -c -r1.8 pch.c *** pch.c 1996/04/12 11:37:32 1.8 --- pch.c 1997/02/11 15:00:09 *************** *** 231,239 **** filearg[0] = fetchname(buf, 0, FALSE); } if (filearg[0] == Nullch) { ! ask1("No file found--skip this patch? [n] "); ! if (*buf != 'y') { ! continue; } if (verbose) say1("Skipping patch...\n"); --- 231,240 ---- filearg[0] = fetchname(buf, 0, FALSE); } if (filearg[0] == Nullch) { ! if (ask1("No file found--skip this patch? [n] ")) { ! if (*buf != 'y') { ! continue; ! } } if (verbose) say1("Skipping patch...\n"); Index: util.c =================================================================== RCS file: /usr/cvs/src/gnu/usr.bin/patch/util.c,v retrieving revision 1.2 diff -c -r1.2 util.c *** util.c 1995/05/30 05:02:37 1.2 --- util.c 1997/02/11 15:08:12 *************** *** 227,233 **** /* Get a response from the user, somehow or other. */ ! void ask(pat,arg1,arg2,arg3) char *pat; long arg1,arg2,arg3; --- 227,233 ---- /* Get a response from the user, somehow or other. */ ! int ask(pat,arg1,arg2,arg3) char *pat; long arg1,arg2,arg3; *************** *** 260,266 **** } else { /* no terminal at all--default it */ buf[0] = '\n'; ! r = 1; } if (r <= 0) buf[0] = 0; --- 260,268 ---- } else { /* no terminal at all--default it */ buf[0] = '\n'; ! buf[1] = 0; ! say1(buf); ! return 0; /* signal possible error */ } if (r <= 0) buf[0] = 0; *************** *** 268,273 **** --- 270,280 ---- buf[r] = '\0'; if (!tty2) say1(buf); + + if (r <= 0) + return 0; /* if there was an error, return it */ + else + return 1; } #endif /* lint */ Index: util.h =================================================================== RCS file: /usr/cvs/src/gnu/usr.bin/patch/util.h,v retrieving revision 1.2 diff -c -r1.2 util.h *** util.h 1995/05/30 05:02:38 1.2 --- util.h 1997/02/11 14:49:19 *************** *** 86,92 **** void say(); void fatal(); void pfatal(); ! void ask(); char *savestr(); void set_signals(); void ignore_signals(); --- 86,92 ---- void say(); void fatal(); void pfatal(); ! int ask(); char *savestr(); void set_signals(); void ignore_signals(); John-Mark gurney_j@efn.org http://resnet.uoregon.edu/~gurney_j/ Modem/FAX: (541) 683-6954 (FreeBSD Box) Live in Peace, destroy Micro$oft, support free software, run FreeBSD (unix)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970211065311.24299i-100000>