/* * file_ascii.c -- ascii import and export filters for hnb * * Copyright (C) 2001-2003 Øyvind Kolås * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H #include #endif #include #include #include "cli.h" #include "tree.h" #include "file.h" #include "query.h" #define indent(count,char) {int j;for(j=0;j= startlevel)) { level = nodes_left (tnode) - startlevel; flags = node_getflags (tnode); cdata = fixnullstring (node_get (tnode, TEXT)); ascii_export_node (file, level, flags, cdata); tnode = node_recurse (tnode); } if (file != stdout) fclose (file); cli_outfunf ("ascii export, wrote output to \"%s\"", filename); return (int) node; } /* !init_file_ascii(); */ void init_file_ascii () { cli_add_command ("export_ascii", export_ascii, ""); cli_add_command ("import_ascii", import_ascii, ""); cli_add_int ("ascii_margin", &ascii_margin, "the margin that ascii export wraps at (-1=no wrap)"); }