コード例 #1
0
ファイル: shell_impl.c プロジェクト: seckcoder/lang-learn
int print_node_pipe(NodeType *cmd, NodeType *pipe) {
  if (print_node_rec(cmd) < 0) return -1;
  if (pipe != NULL) {
    printf(" | ");
    if (print_node_rec(pipe) < 0) return -1;
  }
  return 0;
}
コード例 #2
0
ファイル: shell_impl.c プロジェクト: seckcoder/lang-learn
int print_node_redir(NodeType *cmd, NodeType *file) {
  if (print_node_rec(cmd) < 0) {
    return -1;
  }
  printf(" > ");
  if (print_node_rec(file) < 0) {
    return -1;
  }
  return 0;
}
コード例 #3
0
ファイル: bst.c プロジェクト: Cheyans/bst
//just a pretty way to print the nodes that is semi-readable and easy to code
void print_node_rec(bst_n *node) {
    if(node == NULL) {
        printf("Empty Leaf\n");
        return;
    }
    printf("%d\n", node->data);
    printf("%d ->\n", node->data);
    print_node_rec(node->right);
    printf("<- %d\n", node->data);
    print_node_rec(node->left);
}
コード例 #4
0
ファイル: bst.c プロジェクト: Cheyans/bst
//cause I like recursive functions
void print_tree(bst_t *tree) {
    if(tree == NULL || tree->head == NULL) {
        printf("Empty tree\n");
    } else {
        print_node_rec(tree->head);
    }
}
コード例 #5
0
ファイル: shell_impl.c プロジェクト: seckcoder/lang-learn
int print_node_cmd(char *cmd, NodeType *params) {
  printf("%s ", cmd);
  if (print_node_rec(params) < 0) {
    return -1;
  }
  return 0;
}
コード例 #6
0
ファイル: shell_impl.c プロジェクト: seckcoder/lang-learn
int print_node(NodeType *pn) {
  int ret = print_node_rec(pn);
  printf("\n");
  return ret;
}
コード例 #7
0
ファイル: shell_impl.c プロジェクト: seckcoder/lang-learn
int print_node_pair(NodeType *car, NodeType *cdr) {
  if (print_node_rec(car) < 0) return -1;
  if (print_node_rec(cdr) < 0) return -1;
  return 0;
}