char *answer = NULL;
char buf[13];
char *p, *pp;
-
+
XXXAZ(VSS_parse(T_arg, &addr, &port));
XXXAN(n = VSS_resolve(addr, port, &ta));
free(addr);
fprintf(stderr, "Could not open TELNET port\n");
exit(2);
}
-
+
sock = VSS_connect(ta[0]);
-
+
for (i = 0; i < n; ++i) {
free(ta[i]);
ta[i] = NULL;
}
free(ta);
-
+
for (i=0; i<argc; i++) {
if (i > 0)
write(sock, " ", 1);
write(sock, argv[i], strlen(argv[i]));
}
write(sock, "\n", 1);
-
+
n = read(sock, buf, 13);
if (n != 13) {
fprintf(stderr, "An error occured in receiving status.\n");
}
*p = '\0';
bytes = strtol(pp, &p, 10);
-
+
answer = malloc(bytes+1);
n = read(sock, answer, bytes);
if (n != bytes) {
}
answer[bytes] = '\0';
close(sock);
-
+
if (status == STATUS_OK) {
printf("%s\n", answer);
exit(0);
}
fprintf(stderr, "Command failed with error code %ld\n", status);
exit(1);
-
+
}
static void
int c;
const char *address = NULL;
int T_arg = 0;
-
+
if (argc < 2)
usage();
usage();
}
}
-
+
if (T_arg) {
if (optind == argc)
usage();
telnet_mgt(address, argc - optind, &argv[optind]);
}
-
+
exit(0);
}