patch-2.3.99-pre6 linux/scripts/docproc.c

Next file: linux/scripts/kernel-doc
Previous file: linux/scripts/Configure
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/scripts/docproc.c linux/scripts/docproc.c
@@ -13,6 +13,8 @@
 {
 	char buf[1024];
 	char *vec[8192];
+	char *fvec[200];
+	char **svec;
 	char type[64];
 	int i;
 	int vp=2;
@@ -46,32 +48,55 @@
 	 
 	while(fgets(buf, 1024, stdin))
 	{
-		if(*buf!='!')
+		if(*buf!='!') {
 			printf("%s", buf);
-		else
-		{
-			fflush(stdout);
-			if(buf[1]=='E')
-				strcpy(type, "-function");
-			else if(buf[1]=='I')
-				strcpy(type, "-nofunction");	
-			else
-			{
-				fprintf(stderr, "Unknown ! escape.\n");
-				exit(1);
-			}
-			switch(pid=fork())
-			{
-				case -1:
-					perror("fork");
-					exit(1);
-				case  0:
-					execvp("scripts/kernel-doc", vec);
-					perror("exec scripts/kernel-doc");
-					exit(1);
-				default:
-					waitpid(pid, NULL,0);
+			continue;
+		}
+
+		fflush(stdout);
+		svec = vec;
+		if(buf[1]=='E')
+			strcpy(type, "-function");
+		else if(buf[1]=='I')
+			strcpy(type, "-nofunction");	
+		else if(buf[1]=='F') {
+			int snarf = 0;
+			fvec[0] = "kernel-doc";
+			fvec[1] = "-docbook";
+			strcpy (type, "-function");
+			vp = 2;
+			for (i = 2; buf[i]; i++) {
+				if (buf[i] == ' ' || buf[i] == '\n') {
+					buf[i] = '\0';
+					snarf = 1;
+					continue;
+				}
+
+				if (snarf) {
+					snarf = 0;
+					fvec[vp++] = type;
+					fvec[vp++] = &buf[i];
+				}
 			}
+			fvec[vp++] = &buf[2];
+			fvec[vp] = NULL;
+			svec = fvec;
+		} else
+		{
+			fprintf(stderr, "Unknown ! escape.\n");
+			exit(1);
+		}
+		switch(pid=fork())
+		{
+		case -1:
+			perror("fork");
+			exit(1);
+		case  0:
+			execvp("scripts/kernel-doc", svec);
+			perror("exec scripts/kernel-doc");
+			exit(1);
+		default:
+			waitpid(pid, NULL,0);
 		}
 	}
 	exit(0);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)