comparison toys/posix/cut.c @ 1134:ff22f24c9661 draft

Fix cut. Some commands went in before "pending", and thus need cleanup but are enabled in defconfig. The fact cut used a function out of lib/pending.c is a hint it might be in this category...
author Rob Landley <rob@landley.net>
date Sat, 30 Nov 2013 00:57:26 -0600
parents 2bfdd63382b4
children fc1bb49e58a9
comparison
equal deleted inserted replaced
1133:f8c926309a21 1134:ff22f24c9661
80 if (!ctoken) break; 80 if (!ctoken) break;
81 if (!*ctoken) continue; 81 if (!*ctoken) continue;
82 82
83 //Get start position. 83 //Get start position.
84 if (*(dtoken = strsep(&ctoken, "-"))) { 84 if (*(dtoken = strsep(&ctoken, "-"))) {
85 start = get_int_value(dtoken, 0, INT_MAX); 85 start = atolx_range(dtoken, 0, INT_MAX);
86 start = (start?(start-1):start); 86 start = (start?(start-1):start);
87 } 87 }
88 88
89 //Get end position. 89 //Get end position.
90 if (!ctoken) end = -1; //case e.g. 1,2,3 90 if (!ctoken) end = -1; //case e.g. 1,2,3
91 else if (*ctoken) {//case e.g. N-M 91 else if (*ctoken) {//case e.g. N-M
92 end = get_int_value(ctoken, 0, INT_MAX); 92 end = atolx_range(ctoken, 0, INT_MAX);
93 if (!end) end = INT_MAX; 93 if (!end) end = INT_MAX;
94 end--; 94 end--;
95 if(end == start) end = -1; 95 if(end == start) end = -1;
96 } 96 }
97 add_to_list(start, end); 97 add_to_list(start, end);