Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\vsprintf.c Create Date:2022-07-28 06:12:32
Last Modify:2022-05-21 09:47:42 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:vsscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: format of buffer*@args: arguments

Proto:int vsscanf(const char *buf, const char *fmt, va_list args)

Type:int

Parameter:

TypeParameterName
const char *buf
const char *fmt
va_listargs
3190  str = buf
3193  num = 0
3196  union{long long s;unsigned long long u;}val
3203  When fmt cycle
3214  If fmt != '%' && fmt Then
3215  If fmt++ != str++ Then Break
3217  Continue
3220  If Not fmt Then Break
3222  ++fmt
3227  If fmt == '*' Then
3228  If Not str Then Break
3232  If fmt == '[' Then Return num
3234  fmt++
3237  str++
3238  Continue
3242  field_width = -1
3243  If isdigit( * fmt) Then
3245  If field_width <= 0 Then Break
3250  qualifier = -1
3253  qualifier = fmt++
3255  If qualifier == 'h' Then
3256  qualifier = 'H'
3257  fmt++
3258  Else if qualifier == 'l' Then
3259  qualifier = 'L'
3260  fmt++
3265  If Not fmt Then Break
3268  If fmt == 'n' Then
3270  va_arg(args, int * ) = str - buf
3271  ++fmt
3272  Continue
3275  If Not str Then Break
3278  base = 10
3279  is_sign = false
3282  Case ++ == 'c'
3284  s = va_arg(args, char * )
3285  If field_width == -1 Then field_width = 1
3287  Do
3288  s++ = str++
3289  When --field_width > 0 && str cycle
3290  num++
3292  Continue
3293  Case ++ == 's'
3295  s = va_arg(args, char * )
3296  If field_width == -1 Then field_width = SHRT_MAX
3299  str = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
3302  When str && Not Note: isspace() must return false for %NUL-terminator ( * str) && field_width-- cycle
3303  s++ = str++
3304  s = '\0'
3305  num++
3307  Continue
3323  Case ++ == '['
3325  s = va_arg(args, char * )
3326  DECLARE_BITMAP(set, 256) = {0}
3327  len = 0
3328  negate = fmt == '^'
3331  If field_width == -1 Then Return num
3334  If negate Then ++fmt
3337  When fmt && fmt != ']' cycle set_bit - Atomically set a bit in memory*@nr: the bit to set*@addr: the address to start counting from* This is a relaxed atomic operation (no implied memory barriers).* Note that @nr may be almost arbitrarily large; this function is not
3341  If Not fmt || Not len Then Return num
3343  ++fmt
3345  If negate Then
3346  bitmap_complement(set, set, 256)
3352  If Not st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from Then Return num
3355  When st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from && field_width-- cycle
3356  s++ = str++
3357  s = '\0'
3358  ++num
3360  Continue
3361  Case ++ == 'o'
3362  base = 8
3363  Break
3364  Case ++ == 'x'
3365  Case ++ == 'X'
3366  base = 16
3367  Break
3368  Case ++ == 'i'
3369  base = 0
3371  Case ++ == 'd'
3372  is_sign = true
3374  Case ++ == 'u'
3375  Break
3376  Case ++ == '%'
3378  If str++ != '%' Then Return num
3380  Continue
3381  Default
3383  Return num
3389  str = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
3391  digit = str
3392  If is_sign && digit == '-' Then digit = *(str + 1)
3395  If Not digit || base == 16 && Not isxdigit(digit) || base == 10 && Not isdigit(digit) || base == 8 && ( Not isdigit(digit) || digit > '7' ) || base == 0 && Not isdigit(digit) Then Break
3402  If is_sign Then s = If qualifier != 'L' Then simple_strtol - convert a string to a signed long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use* This function is obsolete. Please use kstrtol instead. Else simple_strtoll - convert a string to a signed long long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use* This function is obsolete. Please use kstrtoll instead.
3406  Else u = If qualifier != 'L' Then simple_strtoul - convert a string to an unsigned long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use* This function is obsolete. Please use kstrtoul instead. Else simple_strtoull - convert a string to an unsigned long long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use* This function is obsolete. Please use kstrtoull instead.
3411  If field_width > 0 && next - str > field_width Then
3412  If base == 0 Then _parse_integer_fixup_radix(str, & base)
3414  When next - str > field_width cycle
3419  --next
3424  Case qualifier == 'H'
3425  If is_sign Then va_arg(args, signedchar * ) = s
3427  Else va_arg(args, unsignedchar * ) = u
3429  Break
3430  Case qualifier == 'h'
3431  If is_sign Then va_arg(args, short * ) = s
3433  Else va_arg(args, unsignedshort * ) = u
3435  Break
3436  Case qualifier == 'l'
3437  If is_sign Then va_arg(args, long * ) = s
3439  Else va_arg(args, unsignedlong * ) = u
3441  Break
3442  Case qualifier == 'L'
3443  If is_sign Then va_arg(args, longlong * ) = s
3445  Else va_arg(args, unsignedlonglong * ) = u
3447  Break
3448  Case qualifier == 'z'
3449  va_arg(args, size_t * ) = u
3450  Break
3451  Default
3452  If is_sign Then va_arg(args, int * ) = s
3454  Else va_arg(args, unsignedint * ) = u
3456  Break
3458  num++
3460  If Not next Then Break
3462  str = next
3465  Return num
Caller
NameDescribe
sscanfsscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments