@@ -151,7 +151,7 @@ static int help(const char *name, const char *msg, int code)
151
151
"EXAMPLES\n"
152
152
" In this basic example, we repeat the command forever.\n"
153
153
"\n"
154
- "\t~$ retry --until=success false\n"
154
+ "\t~$ retry --until=success -- false\n"
155
155
"\tretry: 'false' returned 1, backing off for 10 seconds and trying again...\n"
156
156
"\tretry: 'false' returned 1, backing off for 10 seconds and trying again...\n"
157
157
"\tretry: 'false' returned 1, backing off for 10 seconds and trying again...\n"
@@ -162,11 +162,27 @@ static int help(const char *name, const char *msg, int code)
162
162
" passed once and once only to the next element in the\n"
163
163
" pipeline.\n"
164
164
"\n"
165
- "\t~$ retry curl --fail http://localhost/entities | \\\\ \n"
165
+ "\t~$ retry -- curl --fail http://localhost/entities | \\\\ \n"
166
166
"\tjq ... | \\\\ \n"
167
- "\tretry curl --fail -X POST http://localhost/resource | \\\\ \n"
167
+ "\tretry -- curl --fail -X POST http://localhost/resource | \\\\ \n"
168
168
"\tlogger -t resource-init\n"
169
169
"\n"
170
+ " In this example, we stagger each delay exponentially\n"
171
+ " until 64 seconds, which is then repeated until\n"
172
+ " interrupted.\n"
173
+ "\n"
174
+ "\t~$ retry --until=success --delay \"1,2,4,8,16,32,64\" -- false\n"
175
+ "\tretry: false returned 1, backing off for 1 second and trying again...\n"
176
+ "\tretry: false returned 1, backing off for 2 seconds and trying again...\n"
177
+ "\tretry: false returned 1, backing off for 4 seconds and trying again...\n"
178
+ "\tretry: false returned 1, backing off for 8 seconds and trying again...\n"
179
+ "\tretry: false returned 1, backing off for 16 seconds and trying again...\n"
180
+ "\tretry: false returned 1, backing off for 32 seconds and trying again...\n"
181
+ "\tretry: false returned 1, backing off for 64 seconds and trying again...\n"
182
+ "\tretry: false returned 1, backing off for 64 seconds and trying again...\n"
183
+ "\tretry: false returned 1, backing off for 64 seconds and trying again...\n"
184
+ "\t^C\n"
185
+ "\n"
170
186
"AUTHOR\n"
171
187
" Graham Leggett <minfrin@sharp.fm>\n"
172
188
"" , msg ? msg : "" , n , n );
@@ -402,9 +418,9 @@ int main (int argc, char **argv)
402
418
delay = optarg ;
403
419
404
420
do {
405
- errno = 0 ;
421
+ errno = 0 ;
406
422
407
- d = strtol (optarg , & optarg , 10 );
423
+ d = strtol (optarg , & optarg , 10 );
408
424
409
425
if (errno || (optarg [0 ] && optarg [0 ] != ',' ) || d < 0 ) {
410
426
return help (name , "Delay(s) must be bigger or equal to 0.\n" , EXIT_FAILURE );
@@ -580,10 +596,10 @@ int main (int argc, char **argv)
580
596
memset (& pumps [STDOUT_FD ], 0 , sizeof (pump_t ));
581
597
582
598
if (delay [0 ]) {
583
- d = strtol (delay , & delay , 10 );
599
+ d = strtol (delay , & delay , 10 );
584
600
}
585
601
if (delay [0 ] == ',' ) {
586
- delay ++ ;
602
+ delay ++ ;
587
603
}
588
604
589
605
if (d ) {
0 commit comments