aboutsummaryrefslogblamecommitdiffstats
path: root/io.h
blob: 0a1b5e53abf80ea54af23cbec87e249d1a942615 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                                        
                   


                                                                  
                                                 
 



                                                                            
                                 

                                                
                                               
 



                                                                           
               
/* Copyright (c) 2021 nytpu <alex@nytpu.com>
 * SPDX-License-Identifier: GPL-3.0-only
 * For more license details, see LICENSE or <https://www.gnu.org/licenses/gpl-3.0.html>.
 */

#pragma once
#ifndef _IO_H
#define _IO_H

#include "common.h"
#include <stdbool.h>

// load the specified file into buffer.  will re-initialize buffer
void open_file(const char *filename, bool force);

// write buffer to given filename, or use saved filename if argument is NULL
// Return: 0 on success, -1 on error
int write_file(const char *filename);

// print rows in range [from. to)
int print_rows(RowNum from, RowNum to);
int print_rows_numbered(RowNum from, RowNum to);
int print_rows_escaped(RowNum from, RowNum to);

// enter into insert mode, inserting new lines /at/ target RowNum (shifting
// other rows down)
void insert_mode(RowNum target);

#endif // _IO_H