Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2005 14:48:44 -0400
From:      sammy!!! <sammy@lost-angel.com>
To:        osa@FreeBSD.org
Cc:        freebsd-ports@FreeBSD.org
Subject:   Patch for FreeBSD Port: misc/seq2
Message-ID:  <3C97545C-603F-4E32-8561-B70A906603C7@lost-angel.com>

next in thread | raw e-mail | index | archive | help
I can't seem to find the actual page for this project anymore, but  
this patch is very helpful to seq2 for making it countdown (useful in  
backups):

cooper# diff main.c work/seq2-0.2/src/main.c
94c94
<       } else if (end < start && increment > 0) {
---
 >       } else if (end < start) {
98,99d97
<       } else if (end > start && increment < 0) {
<               fprintf(stderr, "end is greater than start with  
negative increment.  Exiting...\n");

cooper# diff prog.c work/seq2-0.2/src/prog.c
33c33
<       if (increment > 0)
---
 >       for(i=start; i <= end; i = i + increment)
35c35
<               for(i=start; i <= end; i = i + increment)
---
 >               if(text)
37c37
<                       if(text)
---
 >                       if (leadz == 1)
39,44c39
<                               if (leadz == 1)
<                               {
<                                       fprintf(file, "%s %02d",  
text, i);
<                               } else {
<                                       fprintf(file, "%s %d", text, i);
<                               }
---
 >                               fprintf(file, "%s %02d", text, i);
46,51c41
<                               if (leadz == 1)
<                               {
<                                       fprintf(file, "%02d ", i);
<                               } else {
<                                       fprintf(file, "%d ", i);
<                               }
---
 >                               fprintf(file, "%s %d", text, i);
53,54c43,44
<                       sleep(fastmode);
<                       if(new_line == 1)
---
 >               } else {
 >                       if (leadz == 1)
56c46,48
<                               fprintf(file, "\n");
---
 >                               fprintf(file, "%02d ", i);
 >                       } else {
 >                               fprintf(file, "%d ", i);
59,60c51,52
<       } else {
<               for(i=start; i >= end; i = i + increment)
---
 >               sleep(fastmode);
 >               if(new_line == 1)
62,82c54
<                       if(text)
<                       {
<                               if (leadz == 1)
<                               {
<                                       fprintf(file, "%s %02d",  
text, i);
<                               } else {
<                                       fprintf(file, "%s %d", text, i);
<                               }
<                       } else {
<                               if (leadz == 1)
<                               {
<                                       fprintf(file, "%02d ", i);
<                               } else {
<                                       fprintf(file, "%d ", i);
<                               }
<                       }
<                       sleep(fastmode);
<                       if(new_line == 1)
<                       {
<                               fprintf(file, "\n");
<                       }
---
 >                       fprintf(file, "\n");

When running:
seq2 -s 5 -i -1 -e 0
    start is greater than end. Exiting...
is no longer displayed, this is:
5
4
3
2
1
0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C97545C-603F-4E32-8561-B70A906603C7>