*
* Options:
*
- * -M<ident>
+ * -g<ident>
* Use <ident> rather than hex(sha256(<script>))
* as the basename of the leafname of the fcgi rendezvous
* socket. If <ident> contains only hex digit characters it
* - run cgi-fcgi -connect SOCKET SCRIPT
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include "myopt.h"
+
+static const char *ident;
+static int numservers;
+
+static void diee(const char *m) {
+ fprintf(stderr,"cgi-fcgi-: error: %s failed: %s\n", m, strerror(errno));
+ exit(127);
+}
+
+static void fusagemessage(FILE *f) {
+ fprintf(f, "usage: #!/usr/bin/cgi-fcgi-perl [<options>]\n");
+}
+
+void usagemessage(void) { fusagemessage(stderr); }
+
+static void of_help(const struct cmdinfo *ci, const char *val) {
+ fusagemessage(stdout);
+ if (ferror(stdout)) diee("write usage message to stdout");
+ exit(0);
+}
+
+static const struct cmdinfo cmdinfos[]= {
+ { "help", 0, .call= of_help },
+ { 0, 'g', 1, .sassignto= &ident },
+ { 0, 'M', 1, .iassignto= &numservers },
+ { 0 }
+};
+
+int main(int argc, const char *const *argv) {
+ myopt(&argv, cmdinfos);
+ exit(0);
+}