summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--5/11.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/5/11.c b/5/11.c
index bb56131..adf79b3 100644
--- a/5/11.c
+++ b/5/11.c
@@ -4,15 +4,16 @@
#define MAXTABLIST 10
#define MAXDIGLEN 10
#define TABSIZE 8
-#define MAXINPUT 500
+#define MAXTEXTLEN 500
int gettabs(char *s, int *t);
int gettext(char *s, int max);
void entab(char *s, char *t, int *tablist, int tablistc);
+void detab(char *s, char *t, int *tablist, int tablistc);
int main(int argc, char *argv[]) {
- char op, s[MAXINPUT];
int colv[MAXTABLIST], colc;
+ char op, s[MAXTEXTLEN], t[MAXTEXTLEN];
if ((argc != 2 && argc != 3) || (op = argv[1][1] != 'e' && op != 'd')) {
printf("Usage: -e 5,3...\n");
@@ -27,17 +28,20 @@ int main(int argc, char *argv[]) {
}
printf("Enter text to %s\n", op == 'e' ? "entab" : "detab");
- gettext(s, MAXINPUT);
+ gettext(s, MAXTEXTLEN);
switch (op) {
case 'e':
- // todo: entab
+ entab(s, t, colv, colc);
break;
case 'd':
- // todo: detab
+ detab(s, t, colv, colc);
break;
default:
printf("Error: invalid operation.\n");
return 1;
}
+
+ printf("\t%s\n", t);
+ return 0;
} \ No newline at end of file