DragonFly commits List (threaded) for 2004-12
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: cvs commit: src/usr.bin/rev
On Mon, 13 Dec 2004 13:28:34 -0800 (PST), Matthew Dillon
<dillon@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> :Hehe. Sorry for the late reply everyone. I have been busy with bits
>
>
> :and bobs. Sorry everyone about the mistake I made. I think
> :- Hide quoted text -
> :
> :Index: rev.c
> :===================================================================
> :RCS file: /home/dcvs/src/usr.bin/rev/rev.c,v
> :retrieving revision 1.5
> :diff -u -r1.5 rev.c
> :--- rev.c 13 Dec 2004 17:43:57 -0000 1.5
> :+++ rev.c 13 Dec 2004 18:53:33 -0000
> :@@ -90,7 +90,9 @@
> : clearerr(fp);
> : rval = 1;
> : }
> :- ++argv;
> :+ if (argv != NULL)
> :+ ++argv;
> :+
> : fclose(fp);
> : } while (*argv);
> : exit(rval);
> :
> :will fix it correct? thanks to tomokazu for noticing it.
> :
> :Cheers,
> :
> :--
> :Liam J. Foy
>
> Why don't you get rid of the do {...} while entirely and just make it
> a standard for() loop, with a 0-argument check for stdin and make
> the fgetln() loop its own procedure that you simply pass a FILE *
> into. The original code was very badly written.
>
> e.g.
>
> for (i = 1; i < argc; ++i) {
> if ((fp = fopen ...) != NULL ) {
> dofile(fp);
> fclose(fp);
> } else {
> warn ...
> }
> }
> if (argc == 1)
> dofile(stdin);
>
> dofile(FILE *fp)
> {
> ...
>
>
> }
>
> -Matt
> Matthew Dillon
> <dillon@xxxxxxxxxxxxx>
>
Joerg told me to do this but I decided to submit a patch to quickly
fix the stupid error I made. I will work on this now. Sorry again.
--
Liam J. Foy
http://www.dragonflybsd.org
I mourn for those who never knew you...
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]