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