Update header files to 2.6.14
Integrate support for DCCP and tcp_diag into ss
Add -batch to ip command
diff --git a/lib/utils.c b/lib/utils.c
index 7d336eb..4bdda71 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -574,3 +574,67 @@
fprintf(fp, "Timestamp: %s %lu usec\n", tstr, tv.tv_usec);
return 0;
}
+
+int cmdlineno;
+
+/* Like glibc getline but handle continuation lines and comments */
+size_t getcmdline(char **linep, size_t *lenp, FILE *in)
+{
+ size_t cc;
+ char *cp;
+
+ if ((cc = getline(linep, lenp, in)) < 0)
+ return cc; /* eof or error */
+ ++cmdlineno;
+
+ cp = strchr(*linep, '#');
+ if (cp)
+ *cp = '\0';
+
+ while ((cp = strstr(*linep, "\\\n")) != NULL) {
+ char *line1 = NULL;
+ size_t len1 = 0;
+ size_t cc1;
+
+ if ((cc1 = getline(&line1, &len1, in)) < 0) {
+ fprintf(stderr, "Missing continuation line\n");
+ return cc1;
+ }
+
+ ++cmdlineno;
+ *cp = 0;
+
+ cp = strchr(line1, '#');
+ if (cp)
+ *cp = '\0';
+
+ *linep = realloc(*linep, strlen(*linep) + strlen(line1) + 1);
+ if (!*linep) {
+ fprintf(stderr, "Out of memory\n");
+ return -1;
+ }
+ cc += cc1 - 2;
+ strcat(*linep, line1);
+ free(line1);
+ }
+ return cc;
+}
+
+/* split command line into argument vector */
+int makeargs(char *line, char *argv[], int maxargs)
+{
+ static const char ws[] = " \t\r\n";
+ char *cp;
+ int argc = 0;
+
+ for (cp = strtok(line, ws); cp; cp = strtok(NULL, ws)) {
+ if (argc >= (maxargs - 1)) {
+ fprintf(stderr, "Too many arguments to command\n");
+ exit(1);
+ }
+ argv[argc++] = cp;
+ }
+ argv[argc] = NULL;
+
+ return argc;
+}