Annotation of researchv10no/cmd/lcc/ph/scanf.tbl, revision 1.1.1.1

1.1       root        1:                 scanf format string decision tree
                      2:                 ----- ------ ------ -------- ----
                      3: 
                      4: misc:
                      5:     extra arguments are ignored
                      6: 
                      7: 
                      8: d
                      9:     size indicator:
                     10:         h   pointer to short int
                     11:         l   pointer to long int
                     12:         L   UNDEFINED
                     13:     conversion:
                     14:         signed integer (same as strtol base 10)
                     15:         argument is pointer to int
                     16: 
                     17: i
                     18:     size indicator:
                     19:         h   pointer to short int
                     20:         l   pointer to long int
                     21:         L   UNDEFINED
                     22:     conversion:
                     23:         signed integer (same as strtol base 0)
                     24:         argument is pointer to int
                     25: 
                     26: o
                     27:     size indicator:
                     28:         h   pointer to unsigned short
                     29:         l   pointer to unsigned long
                     30:         L   UNDEFINED
                     31:     conversion:
                     32:         unsigned integer (same as strtoul base 8)
                     33:         argument is pointer to unsigned int
                     34: 
                     35: u
                     36:     size indicator:
                     37:         h   pointer to unsigned short
                     38:         l   pointer to unsigned long
                     39:         L   UNDEFINED
                     40:     conversion:
                     41:         unsigned integer (same as strtoul base 10)
                     42:         argument is pointer to unsigned int
                     43: 
                     44: x,X
                     45:     size indicator:
                     46:         h   pointer to unsigned short
                     47:         l   pointer to unsigned long
                     48:         L   UNDEFINED
                     49:     conversion:
                     50:     argument is pointer to float
                     51: 
                     52: s
                     53:     size indicator:
                     54:         h   UNDEFINED
                     55:         l   UNDEFINED
                     56:         L   UNDEFINED
                     57:     conversion:
                     58:         sequence of non-whitespace characters
                     59: 
                     60: [
                     61:     size indicator:
                     62:         h   UNDEFINED
                     63:         l   UNDEFINED
                     64:         L   UNDEFINED
                     65:     conversion:
                     66:         matches non-empty set of characters fromthe "scanset"
                     67:         argument is pointer to array large enough to recieve input string
                     68:         scanset:
                     69:             all characters between [ and  ]
                     70:             all characters not between [^ and ]
                     71:             the beginning sequences [] and [^] mean that ] is in the list
                     72:             '-' is implementation defined unless as [-   [^-   []-   or [^]-
                     73:             chargument is char *
                     74: 
                     75: c
                     76:     size indicator:
                     77:         h   UNDEFINED
                     78:         l   UNDEFINED
                     79:         L   UNDEFINED
                     80:     conversion:
                     81:         match characters up to field width
                     82:         default if no width is 1
                     83:         no null character is added
                     84:         argument is char *
                     85:     
                     86: p
                     87:     size indicator:
                     88:         h   UNDEFINED
                     89:         l   UNDEFINED
                     90:         L   UNDEFINED
                     91:     conversion:
                     92:         matches text produced by printf %p
                     93:         printf -> scanf with %p must produce the same pointer back
                     94:         argument is pointer to void *
                     95: 
                     96: n
                     97:     size indicator:
                     98:         h   pointer to short int
                     99:         l   pointer to long int
                    100:         L   UNDEFINED
                    101:     conversion:
                    102:         no input consumed and argument count not incremented
                    103:         argument is pointer to int
                    104:         write number of characters consumed
                    105: 
                    106: misc:
                    107:     %% is escape to match % in input
                    108:     width specifies max characters matched
                    109:     whitespace means to skip leading white space up to end of input
                    110:     multibyte characters means to read as long as match occurs (no assignment)
                    111:     input conversion is processed as:
                    112:         skip whitespace unless there is a c, [, or n specifier
                    113:         read an item fromthe input unless processing an 'n' specifier
                    114:         read longest possible match up to width specifier
                    115:         if no characters read, it is a matching failure
                    116:         * suppresses assignment 
                    117:     success leaves trailing whitespace unless there is whiatespace
                    118:             at the end of the directive
                    119:     input failure or matching failure leave next character on the input
                    120:     EOF returned if end of input before any conversions
                    121:     return number of conversions performed, may be less than
                    122:         requeted if matchin or input failure occurs

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.