]> git.pld-linux.org Git - packages/busybox.git/blob - busybox-print_ascii.patch
- 1.0.0pre8
[packages/busybox.git] / busybox-print_ascii.patch
1 --- busybox-1.00-pre4/miscutils/hdparm.c.orig   2003-11-28 22:55:03.000000000 +0000
2 +++ busybox-1.00-pre4/miscutils/hdparm.c        2003-12-11 14:04:48.000000000 +0000
3 @@ -518,7 +518,34 @@
4                 va_end(ap);
5  }
6  
7 -static void print_ascii(uint16_t *p, uint8_t length);
8 +static void print_ascii(uint16_t *p, uint8_t length) {
9 +        uint8_t ii;
10 +        char cl;
11 +        
12 +        /* find first non-space & print it */
13 +        for(ii = 0; ii< length; ii++)
14 +        {
15 +                if(((char) 0x00ff&((*p)>>8)) != ' ')
16 +                        break;
17 +                if((cl = (char) 0x00ff&(*p)) != ' ')
18 +                {
19 +                        if_printf((cl != '\0'),"%c",cl);
20 +                        p++;
21 +                        ii++;
22 +                        break;
23 +                }
24 +                p++;
25 +        }
26 +        /* print the rest */
27 +        for(; ii< length; ii++)
28 +        {
29 +                if(!(*p))
30 +                        break; /* some older devices have NULLs */
31 +                printf("%c%c",(char)0x00ff&((*p)>>8),(char)(*p)&0x00ff);
32 +                p++;
33 +        }
34 +        printf("\n");
35 +}
36  
37  static void xprint_ascii(uint16_t *val ,int i, char * string, int n)
38  {
39 @@ -600,35 +627,6 @@
40         return err_dma;
41  }
42  
43 -static void print_ascii(uint16_t *p, uint8_t length) {
44 -       uint8_t ii;
45 -       char cl;
46 -       
47 -       /* find first non-space & print it */
48 -       for(ii = 0; ii< length; ii++)
49 -       {
50 -               if(((char) 0x00ff&((*p)>>8)) != ' ')
51 -                       break;
52 -               if((cl = (char) 0x00ff&(*p)) != ' ')
53 -               {
54 -                       if_printf((cl != '\0'),"%c",cl);
55 -                       p++;
56 -                       ii++;
57 -                       break;
58 -               }
59 -               p++;
60 -       }
61 -       /* print the rest */
62 -       for(; ii< length; ii++)
63 -       {
64 -               if(!(*p))
65 -                       break; /* some older devices have NULLs */
66 -               printf("%c%c",(char)0x00ff&((*p)>>8),(char)(*p)&0x00ff);
67 -               p++;
68 -       }
69 -       printf("\n");
70 -}
71 -
72  /* identify() is the only extern function used across two source files.  The
73     others, though, were declared in hdparm.c with global scope; since other
74     functions in that file have static (file) scope, I assume the difference is
This page took 0.045896 seconds and 3 git commands to generate.