| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/sh/fmtulong.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | fmtulong (ui, base, buf, len, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | unsigned long ui; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | int base; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | char *buf; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | size_t len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | char *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | int sign; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | long si; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | if (base == 0
| 0-95950340 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | base = 10; never executed: base = 10; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | if (base < 2
| 0-95950340 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | __builtin_strncpy ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | buf | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | , dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | "invalid base" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | , 5), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | len - 1 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | buf[len-1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 22 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | return never executed: (p = buf);return (p = buf);never executed: return (p = buf); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | sign = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | if ((
| 1267-95948465 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ui = -ui; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | sign = '-'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } executed 1267 times by 1 test: end of blockExecuted by:
| 1267 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | p = buf + len - 2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | p[1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | switch (base) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | case executed 95948927 times by 1 test: 10:case 10:Executed by:
executed 95948927 times by 1 test: case 10:Executed by:
| 95948927 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | if (ui < 10
| 9495036-86453891 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | *p-- = ((ui) + '0'); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | break; executed 86453891 times by 1 test: break;Executed by:
| 86453891 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | if ((
| 12-9495024 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | *p-- = ((ui % 10) + '0'); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | si = ui / 10; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | si = ui; executed 9495024 times by 1 test: si = ui;Executed by:
| 9495024 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | do | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | * executed 32688266 times by 1 test: p-- = ((si % 10) + '0');*p-- = ((si % 10) + '0');Executed by:
executed 32688266 times by 1 test: *p-- = ((si % 10) + '0');Executed by:
| 32688266 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | while (si /= 10
| 9495036-23193230 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | break; executed 9495036 times by 1 test: break;Executed by:
| 9495036 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | case executed 14 times by 1 test: 8:case 8:Executed by:
executed 14 times by 1 test: case 8:Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | do | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | * executed 38 times by 1 test: p-- = ((ui & 7) + '0');*p-- = ((ui & 7) + '0');Executed by:
executed 38 times by 1 test: *p-- = ((ui & 7) + '0');Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | while (ui >>= 3
| 14-24 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | break; executed 14 times by 1 test: break;Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | case executed 1399 times by 1 test: 16:case 16:Executed by:
executed 1399 times by 1 test: case 16:Executed by:
| 1399 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | do | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | * executed 3498 times by 1 test: p-- = (*p-- = (flags & 0x04) ? "0123456789ABCDEF"[ui & 15] : "0123456789abcdef"[ui & 15];Executed by:
executed 3498 times by 1 test: *p-- = (flags & 0x04) ? "0123456789ABCDEF"[ui & 15] : "0123456789abcdef"[ui & 15];Executed by:
| 20-3498 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | while (ui >>= 4
| 1399-2099 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | break; executed 1399 times by 1 test: break;Executed by:
| 1399 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | case never executed: 2:case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | do | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | * never executed: p-- = ((ui & 1) + '0');*p-- = ((ui & 1) + '0');never executed: *p-- = ((ui & 1) + '0'); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | while (ui >>= 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | do | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | * never executed: p-- = ((*p-- = ((ui % base) < 10) ? (ui % base) + '0' : (((ui % base) < 36) ? (ui % base) - 10 + 'a' : (((ui % base) < 62) ? (ui % base) - 36 + 'A' : (((ui % base) == 62) ? '@' : '_')));
never executed: *p-- = ((ui % base) < 10) ? (ui % base) + '0' : (((ui % base) < 36) ? (ui % base) - 10 + 'a' : (((ui % base) < 62) ? (ui % base) - 36 + 'A' : (((ui % base) == 62) ? '@' : '_'))); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | while (ui /= base
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | if ((
| 0-95950340 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | if (base == 16
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | *p-- = (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | *p-- = '0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | else if (p[1] != '0'
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | * never executed: p-- = '0';*p-- = '0';never executed: *p-- = '0'; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | else if ((
| 0-95950340 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | *p-- = '#'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | *p-- = ((base % 10) + '0'); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | if (base > 10
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | * never executed: p-- = ((base / 10) + '0');*p-- = ((base / 10) + '0');never executed: *p-- = ((base / 10) + '0'); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | if (sign
| 1267-95949073 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | * executed 1267 times by 1 test: p-- = '-';*p-- = '-';Executed by:
executed 1267 times by 1 test: *p-- = '-';Executed by:
| 1267 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | return executed 95950340 times by 1 test: (p + 1);return (p + 1);Executed by:
executed 95950340 times by 1 test: return (p + 1);Executed by:
| 95950340 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |