Patch for FreeBSD Port: misc/seq2

sammy!!! sammy at lost-angel.com
Sun Jun 26 18:48:58 GMT 2005


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


More information about the freebsd-ports mailing list