From d3d5d96e6c17a4eaf409212b806e4d6a9d04f6c5 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Mon, 16 Jul 2018 11:23:36 +0100 Subject: exec halfaway through --- buff.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'buff.c') diff --git a/buff.c b/buff.c index fde4448..b5922a5 100644 --- a/buff.c +++ b/buff.c @@ -297,7 +297,7 @@ int write_lines(char app){ l = l->next; } fclose(fout); - printf("%d\n", tot); + fprintf(stderr, "%d\n", tot); return 0; } @@ -389,3 +389,19 @@ void transfer_lines(int addr, char move){ move_to_line(addr+n,0); mod = 1; } + + +void exec_command(char *s, FILE *fout){ + + char buff[4096]; + FILE *fin; + + fin = popen(s, "r"); + while(feof(fin) == 0){ + if (!fgets(buff, 4095, fin)) break; + fputs(buff, fout); + } + pclose(fin); + printf("!\n"); + +} -- cgit v1.2.3