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

Function ppd_read

cups/ppd.c:2919–3412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2917 */
2918
2919static int /* O - Bitmask of fields read */
2920ppd_read(cups_file_t *fp, /* I - File to read from */
2921 _ppd_line_t *line, /* I - Line buffer */
2922 char *keyword, /* O - Keyword from line */
2923 char *option, /* O - Option from line */
2924 char *text, /* O - Human-readable text from line */
2925 char **string, /* O - Code/string data */
2926 int ignoreblank, /* I - Ignore blank lines? */
2927 _ppd_globals_t *pg) /* I - Global data */
2928{
2929 int ch, /* Character from file */
2930 col, /* Column in line */
2931 colon, /* Colon seen? */
2932 endquote, /* Waiting for an end quote */
2933 mask, /* Mask to be returned */
2934 startline, /* Start line */
2935 textlen; /* Length of text */
2936 char *keyptr, /* Keyword pointer */
2937 *optptr, /* Option pointer */
2938 *textptr, /* Text pointer */
2939 *strptr, /* Pointer into string */
2940 *lineptr; /* Current position in line buffer */
2941
2942
2943 /*
2944 * Now loop until we have a valid line...
2945 */
2946
2947 *string = NULL;
2948 col = 0;
2949 startline = pg->ppd_line + 1;
2950
2951 if (!line->buffer)
2952 {
2953 line->bufsize = 1024;
2954 line->buffer = malloc(1024);
2955
2956 if (!line->buffer)
2957 return (0);
2958 }
2959
2960 do
2961 {
2962 /*
2963 * Read the line...
2964 */
2965
2966 lineptr = line->buffer;
2967 endquote = 0;
2968 colon = 0;
2969
2970 while ((ch = cupsFileGetChar(fp)) != EOF)
2971 {
2972 if (lineptr >= (line->buffer + line->bufsize - 1))
2973 {
2974 /*
2975 * Expand the line buffer...
2976 */

Callers 1

_ppdOpenFunction · 0.85

Calls 4

cupsFileGetCharFunction · 0.85
cupsFilePeekCharFunction · 0.85
_cups_isspaceFunction · 0.85
ppd_decodeFunction · 0.85

Tested by

no test coverage detected