1 #include <X11/Intrinsic.h>
2 #include <X11/StringDefs.h>
3 #include "TabString.h"
4 
5 /*
6  *	Converts a string list of tabs to an array of tabs
7  */
8 int *
XfwfTablist2Tabs(tablist)9 XfwfTablist2Tabs(tablist)
10 char *tablist;
11 {
12 	register int	*tabs;
13 	register int	ntabs = 0;
14 
15 	if (!tablist)
16 		return NULL;
17 	for (;;)
18 	{
19 		/* Skip leading blanks */
20 		while (*tablist && *tablist == ' ') ++tablist;
21 		if (!*tablist) break;
22 
23 		/* Allocate space for the new tab */
24 		if (ntabs)
25 			tabs = (int *) XtRealloc( (char *) tabs,
26 						(ntabs+1) * sizeof(int));
27 		else
28 			tabs = (int *) XtMalloc( (ntabs + 1) * sizeof(int));
29 		/* Add it to the list */
30 		tabs[ntabs++] = atoi(tablist);
31 		/* Skip to the next blank */
32 		while (*tablist && *tablist != ' ') ++tablist;
33 	}
34 	return (tabs);
35 }
36