... | ... |
@@ -532,6 +532,32 @@ static int uptime_fifo_cmd( FILE *stream, char *response_file ) |
532 | 532 |
return 1; |
533 | 533 |
} |
534 | 534 |
|
535 |
+static int which_fifo_cmd(FILE *stream, char *response_file ) |
|
536 |
+{ |
|
537 |
+ FILE *reply_pipe; |
|
538 |
+ struct fifo_command *c; |
|
539 |
+ |
|
540 |
+ if (response_file==0 || *response_file==0 ) { |
|
541 |
+ LOG(L_ERR, "ERROR: which_fifo_cmd: null file\n"); |
|
542 |
+ return -1; |
|
543 |
+ } |
|
544 |
+ |
|
545 |
+ reply_pipe=open_reply_pipe(response_file); |
|
546 |
+ if (reply_pipe==NULL) { |
|
547 |
+ LOG(L_ERR, "ERROR: opening reply pipe (%s) failed\n", |
|
548 |
+ response_file ); |
|
549 |
+ return -1; |
|
550 |
+ } |
|
551 |
+ fputs( "------ Begin of registered FIFO commands -----------\n", reply_pipe); |
|
552 |
+ for(c=cmd_list; c; c=c->next) { |
|
553 |
+ fprintf( reply_pipe, "%s\n", c->name ); |
|
554 |
+ } |
|
555 |
+ fputs( "------ End of registered FIFO commands -----------\n", reply_pipe); |
|
556 |
+ |
|
557 |
+ fclose(reply_pipe); |
|
558 |
+ return 1; |
|
559 |
+} |
|
560 |
+ |
|
535 | 561 |
|
536 | 562 |
int register_core_fifo() |
537 | 563 |
{ |
... | ... |
@@ -547,5 +573,9 @@ int register_core_fifo() |
547 | 573 |
LOG(L_CRIT, "unable to register 'version' FIFO cmd\n"); |
548 | 574 |
return -1; |
549 | 575 |
} |
576 |
+ if (register_fifo_cmd(which_fifo_cmd, FIFO_WHICH, 0)<0) { |
|
577 |
+ LOG(L_CRIT, "unable to register 'version' FIFO cmd\n"); |
|
578 |
+ return -1; |
|
579 |
+ } |
|
550 | 580 |
return 1; |
551 | 581 |
} |