Example #1
0
main()
{
	char s1[100] = "johnny\tate\tlunch\n";
	char s2[100] = "johnny\tate\tlunch\n";
	char s3[100] = "johnny\tate\tlunch\n";
	char s4[100] = "johnny\tate\tlunch\n";
	char s5[100] = "johnny\tate\tlunch\n";

	detab(s1, 100, 4);
	should(s1, "johnny__ate_lunch\n");

	detab(s2, 100, 5);
	should(s2, "johnny____ate__lunch\n");

	detab(s3, 100, 6);
	should(s3, "johnny______ate___lunch\n");

	detab(s4, 100, 7);
	should(s4, "johnny_ate____lunch\n");

	detab(s5, 100, 8);
	should(s5, "johnny__ate_____lunch\n");

	return 0;
}
Example #2
0
int main()
{
	char s[MAXLINE];
	detab(s);
	printf("%s", s);
	return 0;
}
Example #3
0
int main ( int argc, char * argv [] ) {

    int i = 0;
    char rez = 0;
    char tmp_line [ MAX ];
//    char tabline [ MAX ];
    char dest_line [ MAX ];

    if ( argc == 1 ) {
        printf ( "Usage: entab 0 4 8 12 16 ...  ( wheres every digit is position of tab stop )\n" );        
    }

    full_tabstops ( tabline, argc, argv );
    
    for ( i = 0; i < MAX; i ++ ) {
        printf ( "getted tabstops [ %d ]:'%d';\n", i, tabline [ i ] );
    }
    while ( ( rez = getline_my ( tmp_line ) ) != 0 ) {
        detab ( dest_line, tmp_line );
        printf ( "detabbed_line = '%s';\n", dest_line );
        for ( i = 0; dest_line [ i ] != '\0'; i ++ ) {
            printf ( "dest_line [ %d ] = '%c' as char and %d as digit;\n", i, dest_line [ i ], dest_line [ i ] );
        }
    }

    return 0;
}
Example #4
0
int main (int argc, char *argv[]) {
	int tab_pos = TAB;
	/** we`ll use different pointers for detab() and entab() */
	char **tab_poses1 = NULL;
	char **tab_poses2 = NULL;

	if (argc == 2)
		tab_pos = atoi(argv[1]);
	else if (argc > 2) {
		tab_poses1 = argv;
		tab_poses2 = argv;
		tab_poses1++;
		tab_poses2++;
	}

//while(tab_poses[0] != NULL)
//	printf("tab_poses %d\n", atoi((tab_poses++)[0]));

	printf("\ndoing detab...\n");
	detab(tab_pos, tab_poses1);

	printf("\ndoing entab...\n");
	entab(tab_pos, tab_poses2);
	printf("\n");
	
	return 0;
}
Example #5
0
int main() {
  char* input = "\t\tThis is a string";
  char output[strlen(input) + 15];
  detab(input, output, 8);
  puts(input);
  puts(output);
}
/* replace tabs with blanks */
int main(int argc,char *argv[])
{
	char tab[MAXLINE+1];
	esettab(argc,argv,tab);
	detab(tab);
	return 0;
}
Example #7
0
File: ex.c Project: xbot/c-ex
int main(int argc, char **argv)
{
    char s1[MAX_LINE_LEN];
    char s2[MAX_LINE_LEN];

    int m, n, m2, n2;

    m = DEFAULTSTARTCOL;
    n = DEFAULTTABWIDTH;

    while (--argc > 0) {
        argv++;
        if (**argv == '-') {
            if ((m2 = atoi(++*argv)) > 0)
                m = m2;
        } else if (**argv == '+') {
            if ((n2 = atoi(++*argv)) > 0)
                n = n2;
        }
    }
    
    printf("Usage example: entab -2 +8\n");

    printf("Input some characters, then press enter:\n");
    while (getline2(s1) == 0);

    detab(s1, s2, m, n);
    /* entab(s1, s2, m, n); */
    printf("result:\n%s\n", s2);

    return 0;
}
main() 
{
    char i;
    i = detab();

    return 0;
}
Example #9
0
/*
 * Modify the program entab and detab (written as exercises in Chapter 1) to accept a list of tab stops as
 * arguments. Use the default tab settings if there are no arguments.
 * */
void e_5_11(int argc, char *argv[])
{
	//entab(argc, argv);
	detab(argc, argv);

	return;
}
int main (int argc, char *argv[]) {
	int start_pos = 0;
	int col_per_tab = TAB;

	if (argc != 3) {
		printf("\nUsage:\n\t%s -m +n\n\tm -\tstart position (column)\n\tn -\tcolumn per TAB\n", argv[0]);
		return 1;
	}
	else {
		if (argv[1][0] == '-')
			start_pos = atoi(argv[1]+1);
		if (argv[2][0] == '+')
			col_per_tab = atoi(argv[2]+1);
	}

	printf("m = %d\nn = %d\n", start_pos, col_per_tab);
	
	printf("\ndoing detab...\n");
	detab(start_pos, col_per_tab);

	printf("\ndoing entab...\n");
	entab(start_pos, col_per_tab);
	printf("\n");
	
	return 0;
}
int main(){
  int len;
  while((len=mygetline())>0){
    detab();
    printf("%s",notab);
  }
  return 0;
}
Example #12
0
main()
{
	char line[MAXLINE];
	char out[MAXLINE];
	getline(line, MAXLINE);
	detab(line, out);
	printf("%s\n",out);
	return 0;
}
Example #13
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionHash(&argc, argv);
tabSize = optionInt("tabSize", tabSize);
if (argc != 3)
    usage();
detab(argv[1], argv[2]);
return 0;
}
Example #14
0
/* replace strings of blanks with tabs */
int main(int argc, char *argv[])
{
    char tab[MAXLINE+1];

    settab(argc, argv, tab); /* initialize tab stops */
    entab(tab); /* replace blanks with tabs */
    detab(tab); /* replace tab with blanks */

    return 0;
}
Example #15
0
int main()
{
    int len;
    char line[MAX_LEN];

    while((len = getlineX(line))> 0) {
        detab(line, len);
        printf("%s\n", ss);
    }
}
Example #16
0
void addLine(int size)
{
    int j, len;

    line[size] = '\0';
    len = detab(line, TABSTOP, (size + 1));
    for (j = 0; j < len; ++j) {
        lines[linecount][j] = line[j];
    }
    ++linecount;
}
Example #17
0
main()
{
	int len;
	char line[MAX]={0};
	freopen("1-20.in","r",stdin);
	freopen("1-20.out","w",stdout);
	while (len=get(line)) {
		detab(line);
		printf("%s",line);
	}
}
int main(){
    int len;               
    char line[MAXLEN];
    char newLine[MAXLEN];  

    while((len = getLine(line, MAXLEN)) != 0){
    	detab(line, newLine, len);
        printf("%s", newLine);
    }
	return 0;
}
Example #19
0
int main(int argc, char *argv[]) {
	char in[MAXLINE], out[MAXLINE];
	int *tbp = tabstop;
	while (--argc > 0 && tbp < tabstop + MAXSTOPS)
		*tbp++ = atoi(*++argv);
	while (getlinef(in,MAXLINE) > 0) {
		detab(in, out, tbp - tabstop);
		printf("%s", out);
	}
	return 0;
}
Example #20
0
int main(int argc, char *argv[]) {
	int place_holder;
	int column_start = ((place_holder = set_detab_start_column(argc, argv)) > 0) ? place_holder : 0;
	int tabstop = ((place_holder = set_tabstop(argc, argv)) > 0) ? place_holder : 8;

	int character;
	while ((character = getchar()) != EOF)
		detab(column_start, tabstop, character);

	return 0;
}
int main() {
  int len;
  char s[MAXL];
  char t[MAXL * TABW];

  printf("Note: for the sake of clarity, all tabs will be replaced with '-'.\n");
  while (line(s, MAXL)) {
    detab(s, t);
    printf("%s", t);
  }
}
Example #22
0
main()
{
    int len;
    char line[MAXLINE];

    while ((len = get_line(line, MAXLINE)) > 0) {
        if (len > 0) {
            detab(line);
        }
    }
}
Example #23
0
main()
{
	int len;
	char line[MAXLINE];
	//max = 80;
	while ((len = detab(line, MAXLINE)) > 0) {
		//printf("%s", line);
		//detab(line);
		//printf("test");
		printf("%s\n", line);
	}
}
Example #24
0
File: a.c Project: christoffer/k-r
int main() {
  int  len;
  char line[MAXLINE];
  char detabbed[MAXLINE];

  while ((len = getline(line, MAXLINE)) > 0) {
    detab(detabbed, line);
    printf("%s", detabbed);
  }

  return 0;
}
Example #25
0
main()
{
	int len;
	int max;
	char *line;

	while(flag)
	{
		get_line(&line);
		fold(detab(line));
	}
	return 0;			
}
Example #26
0
main(){
    char string[MAX], accum[SIZE]="", detabed[MAX];
    int length;

    while((length = get(string, MAX)) != 0){
        detab(string, detabed);
        concat(accum, accum, detabed);
        clear(detabed);
    }
    
    printf("\nThe output is:\n%s", accum);
    return 0;
}
main() {
  int len;      /* current line length */
  char line[MAXLINE];    /* current input line */
  char current[MAXLINE]; /* current line to print */

  while ((len = mygetline(line, MAXLINE)) > 0) {
	detab(current, line);
	printf("%s", current);
  }

  return 0;

}
Example #28
0
main()
{
  
  int i, len;
  char line[MAXLENGTH];

  for (i = 0; (len = getline1(line, MAXLENGTH)) > 0; ++i) {
   detab(line, len);
   printf("%s", line);
  }

  return 0;
}
Example #29
0
File: dh.c Project: andrew0snake/5
 int main()
 {
     int tabstops[MAXLINE];
    int i = 0;

    
     settabs(tabstops);
    for ( i = 0; i < MAXLINE; i ++ ) { 
        printf ( "tabstops [ %d ] = %d;\n", i, tabstops [ i ] );
    }
     detab(tabstops);

     return 0;
 }
Example #30
0
File: ex1-20.c Project: garrow/kr
int main (){
  char line[MAX_LINE];
  char cleanLine[MAX_LINE];
  int len;

  while ( (len = getln(line, MAX_LINE)) > 0 )
  {
    printf("\nLine::: %s",line);
    detab(line, cleanLine, len);
    printf("\nDETAB:: %s",cleanLine);
  }
  
return 0;
}