[illumos-Developer] Bug #1031

Garrett D'Amore garrett at damore.org
Wed May 18 04:52:39 PDT 2011


I would prefer to include a new line and leading "#<tab>" for each additional line, rather than just trying to concatenate on a single line.

  -- Garrett D'Amore

On May 18, 2011, at 1:23 PM, Yuri Pankov <yuri.pankov at gmail.com> wrote:

> On Tue, May 17, 2011 at 04:33:44PM -0700, Garrett D'Amore wrote:
>> So I had another look... the code isn't right.. there will be multiple newlines, so you need to print the prefix for the first newline, but not the second ones.  I should have paid closer attention.
> 
> How about the attached diff?
> 
> altair:yuri:~/ws/illumos/usr/src/cmd/audio/audioctl$ ./audioctl
> show-device -d audiohd#1
> Device: /dev/sound/audiohd:1mixer
>  Name    = audiohd#1
>  Config  = onboard1 (a)
>  HW Info = Unknown HD codec: 0x10de000a Unknown HD codec: 0x10de000a Unknown HD codec: 0x10de000a Unknown HD codec: 0x10de000a
> altair:yuri:~/ws/illumos/usr/src/cmd/audio/audioctl$ ./audioctl
> save-controls -d audiohd#1 -f audiohd1; cat audiohd1
> Bad enum index 10 for control 'record-source'
> # Device: /dev/sound/audiohd:1mixer
> # Name    = audiohd#1
> # Config  = onboard1 (a)
> # HW Info = Unknown HD codec: 0x10de000a Unknown HD codec: 0x10de000a Unknown HD codec: 0x10de000a Unknown HD codec: 0x10de000a
> #
> #CONTROL                 VALUE
> volume                   75
> 
> 
> ("Bad enum.." is unrelated).
> 
> Yuri
> 
>> On May 17, 2011, at 2:59 PM, Ben Taylor <bentaylor.solx86 at gmail.com> wrote:
>> 
>>> 2011/5/17 Γιώργος Γεωργίου <paogeorge13 at gmail.com>:
>>>> Hello to all developers!
>>>> This is my first touch with an open source project.
>>>> I have a suggestion for solving this problem.
>>>> 
>>>> fuction: int do_save_controls(int argc, char **argv)
>>>> file: /illumos-gate/usr/src/cmd/audio/audioctl/audioctl.c
>>>> 
>>>> 
>>>> Replace lines
>>>> 
>>>> 1059     if (strlen(d->card.hw_info)) {
>>>>   1060         (void) fprintf(fp, "# HW Info = %s", d->card.hw_info);
>>>>   1061     }
>>>>   1062     (void) fprintf(fp, "#\n");
>>>> 
>>>> 
>>>> 
>>>> with lines below
>>>> 
>>>> char *hwInfo;
>>>> 
>>>> if (strlen(d->card.hw_info)) {
>>>> 
>>>>         hwInfo = strtok (d->card.hw_info, "\n");
>>>> 
>>>>         while (hwInfo != NULL) {
>>>> 
>>>>                   (void) fprintf(fp, "# HW Info = %s\n", hwInfo);
>>>> 
>>>>                   hwInfo = strtok(NULL, "\n");
>>> 
>>> Why not just set hwInfo to NULL here instead of using
>>> strtok since its obvious that the while loop will execute just once.
>>> 
>>> And is it certain that d->card.hw_info will only contain one
>>> line CR delimited line?
>>> 
>>>> 
>>>>         }
>>>> 
>>>> }
>>>> 
>>>> (void) fprintf(fp, "#\n");
>>> 
>>> Given that you've added a "\n" to the fprintf above, is this fprintf necessary?
>>> 
>>> Ben
>>> 
>>> _______________________________________________
>>> Developer mailing list
>>> Developer at lists.illumos.org
>>> http://lists.illumos.org/m/listinfo/developer
>> 
>> _______________________________________________
>> Developer mailing list
>> Developer at lists.illumos.org
>> http://lists.illumos.org/m/listinfo/developer
>> 
> <audioctl.diff>



More information about the Developer mailing list