chiark
/
gitweb
/
~mdw
/
adns
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
adnshost compiles again, and submits.
[adns]
/
client
/
adh-main.c
diff --git
a/client/adh-main.c
b/client/adh-main.c
index 5a4235dbf9163926d62c8e8b46b132b766565f03..7c43d1e6dce70798cdf98a474815bdd50997950e 100644
(file)
--- a/
client/adh-main.c
+++ b/
client/adh-main.c
@@
-26,28
+26,51
@@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
+#include "adnshost.h"
void sysfail(const char *what, int errnoval) {
fprintf(stderr,"adnshost failed: %s: %s\n",what,strerror(errnoval));
exit(10);
}
void sysfail(const char *what, int errnoval) {
fprintf(stderr,"adnshost failed: %s: %s\n",what,strerror(errnoval));
exit(10);
}
+void usageerr(const char *fmt, ...) {
+ va_list al;
+ fputs("adnshost usage error: ",stderr);
+ va_start(al,fmt);
+ vfprintf(stderr,fmt,al);
+ va_end(al);
+ putc('\n',stderr);
+ exit(11);
+}
+
static void domain_do_arg(const char *domain) {
if (ov_pipe) usageerr("-f/--pipe not consistent with domains on command line");
static void domain_do_arg(const char *domain) {
if (ov_pipe) usageerr("-f/--pipe not consistent with domains on command line");
- domain_do(arg);
+ domain_do(domain);
+}
+
+void *xmalloc(size_t sz) {
+ void *p;
+
+ p= malloc(sz); if (!p) sysfail("malloc",sz);
+ return p;
+}
+
+char *xstrsave(const char *str) {
+ char *p;
+
+ p= xmalloc(strlen(str)+1);
+ strcpy(p,str);
+ return p;
}
}
-
static void of_type(const struct opt
info *oi, const char *arg) { abort(); }
+
void of_type(const struct option
info *oi, const char *arg) { abort(); }
int main(int argc, const char *const *argv) {
const char *arg;
int main(int argc, const char *const *argv) {
const char *arg;
- const
+ const
struct optioninfo *oip;
- while (
arg= *++argv
) {
- if (arg[0]
!
= '-') {
+ while (
(arg= *++argv)
) {
+ if (arg[0]
=
= '-') {
if (arg[1] == '-') {
oip= opt_findl(arg+2);
if (oip->type == ot_funcarg) {
if (arg[1] == '-') {
oip= opt_findl(arg+2);
if (oip->type == ot_funcarg) {