示例#1
0
文件: lines.c 项目: Arthok/Allum1
void	display_all(char *spaces, char *lines)
{
  int	n;
  int	i;
  int	e;
  int	nb;

  n = 4;
  i = 0;
  e = 4;
  my_putstr("*********\n");
  while (n != 0)
    {
      my_putchar('*');
      display_spaces(spaces[i]);
      display_match(lines[i]);
      spaces_add(lines, nb, i, e);
      display_spaces(spaces[i]);
      my_putstr("*\n");
      n = n - 1;
      i++;
      e++;
    }
  my_putstr("*********\n");
}
示例#2
0
int		format_line(char *file, struct stat *s, t_opt * t)
{
  struct passwd	*p;
  struct group	*g;

  file = file;
  print_right(s);
  my_printf("%d ", s->st_nlink);
  if ((p = getpwuid(s->st_uid)) == NULL)
    return (1);
  if ((g = getgrgid(s->st_gid)) == NULL)
    return (1);
  (!t->g) ? my_printf("%s ", p->pw_name) : 0;
  my_printf("%s", g->gr_name);
  display_spaces(6 - my_intlen(s->st_size));
  my_printf("%d ", s->st_size);
  disp_date(&s->st_mtime);
  if (S_ISDIR(s->st_mode))
    my_printf("\033[34m%s\033[0m\n", file);
  else if ((s->st_mode & S_IXUSR))
    my_printf("\033[32m%s\033[0m\n", file);
  else
    my_printf("%s\n", file);
  return (0);
}
示例#3
0
// Prints name in specified number of spaces
void Circuit::display_name(short maxSpaces)
{
	if (name.length() > maxSpaces) cout << name.substr(int_zero,maxSpaces);
	else {
		cout << name;
		display_spaces(maxSpaces);
	}
}