FreeBSD Bugzilla – Attachment 213025 Details for
Bug 245156
audio/pulseaudio: parse /dev/sndstat correctly to get device name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Testcase 2
testcase2.c (text/plain), 900 bytes, created by
lightside
on 2020-04-03 18:08:33 UTC
(
hide
)
Description:
Testcase 2
Filename:
MIME Type:
Creator:
lightside
Created:
2020-04-03 18:08:33 UTC
Size:
900 bytes
patch
obsolete
>/* > cc -o testcase2 testcase2.c && ./testcase2 >*/ > >#include <stdio.h> >#include <string.h> > >int main() { > char line[] = "pcm4: <Realtek (0x1168) (Rear Analog 5.1/2.0)> (play/rec) default"; > //char line[] = "pcm4: <Realtek (0x1168) <#> (Rear Analog 5.1/2.0)> (play/rec) default"; >#if 1 > int device; > > if (sscanf(line, "pcm%i: ", &device) != 1) > return 0; > > char *k = strchr(line, ':'); > > if (!k) > return 0; > > k++; > k += strspn(k, " <"); > k[strcspn(k, ">")] = 0; > > printf("Testcase 1:\n"); > printf("%d - %s\n", device, k); >#else > int device; > > if (sscanf(line, "pcm%i: ", &device) != 1) > return 0; > > char *k = strchr(line, ':'); > > if (!k) > return 0; > > k++; > k += strspn(k, " "); > > if (k[0] == '<') { > const char *e = strrchr(k, '>'); > > if (e) { > const size_t q = strlen(k) - strlen(e); > k[q] = 0; > ++k; > } > } > > printf("Testcase 2:\n"); > printf("%d - %s\n", device, k); >#endif > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 245156
:
212817
|
212838
|
212854
|
212855
|
212875
|
212876
|
212877
|
212878
|
213004
|
213005
|
213006
| 213025 |
213026
|
213050
|
213051
|
213052
|
228663
|
228708