Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/coreutils/expand.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1122 by niro, Sun May 30 11:32:42 2010 UTC revision 1123 by niro, Wed Aug 18 21:56:57 2010 UTC
# Line 48  static void expand(FILE *file, unsigned Line 48  static void expand(FILE *file, unsigned
48   if (c == '\t') {   if (c == '\t') {
49   unsigned len;   unsigned len;
50   *ptr = '\0';   *ptr = '\0';
51  # if ENABLE_FEATURE_ASSUME_UNICODE  # if ENABLE_UNICODE_SUPPORT
52   len = unicode_strlen(ptr_strbeg);   {
53     uni_stat_t uni_stat;
54     printable_string(&uni_stat, ptr_strbeg);
55     len = uni_stat.unicode_width;
56     }
57  # else  # else
58   len = ptr - ptr_strbeg;   len = ptr - ptr_strbeg;
59  # endif  # endif
# Line 77  static void unexpand(FILE *file, unsigne Line 81  static void unexpand(FILE *file, unsigne
81    
82   while (*ptr) {   while (*ptr) {
83   unsigned n;   unsigned n;
84   unsigned len;   unsigned len = 0;
85    
86   while (*ptr == ' ') {   while (*ptr == ' ') {
  column++;  
87   ptr++;   ptr++;
88     len++;
89   }   }
90     column += len;
91   if (*ptr == '\t') {   if (*ptr == '\t') {
92   column += tab_size - (column % tab_size);   column += tab_size - (column % tab_size);
93   ptr++;   ptr++;
# Line 90  static void unexpand(FILE *file, unsigne Line 95  static void unexpand(FILE *file, unsigne
95   }   }
96    
97   n = column / tab_size;   n = column / tab_size;
98   column = column % tab_size;   if (n) {
99   while (n--)   len = column = column % tab_size;
100   putchar('\t');   while (n--)
101     putchar('\t');
102     }
103    
104   if ((opt & OPT_INITIAL) && ptr != line) {   if ((opt & OPT_INITIAL) && ptr != line) {
105   printf("%*s%s", column, "", ptr);   printf("%*s%s", len, "", ptr);
106   break;   break;
107   }   }
108   n = strcspn(ptr, "\t ");   n = strcspn(ptr, "\t ");
109   printf("%*s%.*s", column, "", n, ptr);   printf("%*s%.*s", len, "", n, ptr);
110  # if ENABLE_FEATURE_ASSUME_UNICODE  # if ENABLE_UNICODE_SUPPORT
111   {   {
112   char c;   char c;
113     uni_stat_t uni_stat;
114   c = ptr[n];   c = ptr[n];
115   ptr[n] = '\0';   ptr[n] = '\0';
116   len = unicode_strlen(ptr);   printable_string(&uni_stat, ptr);
117     len = uni_stat.unicode_width;
118   ptr[n] = c;   ptr[n] = c;
119   }   }
120  # else  # else

Legend:
Removed from v.1122  
changed lines
  Added in v.1123