MCPcopy Create free account
hub / github.com/OpenPrinting/cups / get_token

Method get_token

ppdc/ppdc-source.cxx:1928–2132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1926//
1927
1928char * // O - Token string or NULL
1929ppdcSource::get_token(ppdcFile *fp, // I - File to read
1930 char *buffer, // I - Buffer
1931 int buflen) // I - Length of buffer
1932{
1933 char *bufptr, // Pointer into string buffer
1934 *bufend; // End of string buffer
1935 int ch, // Character from file
1936 nextch, // Next char in file
1937 quote, // Quote character used...
1938 empty, // Empty input?
1939 startline; // Start line for quote
1940 char name[256], // Name string
1941 *nameptr; // Name pointer
1942 ppdcVariable *var; // Variable pointer
1943
1944
1945 // Mark the beginning and end of the buffer...
1946 bufptr = buffer;
1947 bufend = buffer + buflen - 1;
1948
1949 // Loop intil we've read a token...
1950 quote = 0;
1951 startline = 0;
1952 empty = 1;
1953
1954 while ((ch = fp->get()) != EOF)
1955 {
1956 if (isspace(ch) && !quote)
1957 {
1958 if (empty)
1959 continue;
1960 else
1961 break;
1962 }
1963 else if (ch == '$')
1964 {
1965 // Variable substitution
1966 empty = 0;
1967
1968 for (nameptr = name; (ch = fp->peek()) != EOF;)
1969 {
1970 if (!isalnum(ch) && ch != '_')
1971 break;
1972 else if (nameptr < (name + sizeof(name) - 1))
1973 *nameptr++ = (char)fp->get();
1974 }
1975
1976 if (nameptr == name)
1977 {
1978 // Just substitute this character...
1979 if (ch == '$')
1980 {
1981 // $$ = $
1982 if (bufptr < bufend)
1983 *bufptr++ = (char)fp->get();
1984 }
1985 else

Callers

nothing calls this directly

Calls 3

_cupsLangPrintfFunction · 0.85
getMethod · 0.80
peekMethod · 0.80

Tested by

no test coverage detected