summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--5/11.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/5/11.c b/5/11.c
index 75d1389..bb56131 100644
--- a/5/11.c
+++ b/5/11.c
@@ -1,17 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
+#define MAXTABLIST 10
+#define MAXDIGLEN 10
+#define TABSIZE 8
+#define MAXINPUT 500
+
+int gettabs(char *s, int *t);
+int gettext(char *s, int max);
void entab(char *s, char *t, int *tablist, int tablistc);
int main(int argc, char *argv[]) {
- char op;
+ char op, s[MAXINPUT];
+ int colv[MAXTABLIST], colc;
if ((argc != 2 && argc != 3) || (op = argv[1][1] != 'e' && op != 'd')) {
printf("Usage: -e 5,3...\n");
return 1;
}
-
+ if (argc == 3)
+ colc = gettabs(argv[2], colv);
+ else {
+ colv[0] = TABSIZE;
+ colc = 1;
+ }
+
+ printf("Enter text to %s\n", op == 'e' ? "entab" : "detab");
+ gettext(s, MAXINPUT);
switch (op) {
case 'e':