sim

the sim text editor
git clone git://ssnf.xyz/sim
Log | Files | Refs | README

commit a6c2a9c7abd0e092744202be7f481a75365d88ad
parent a554e40db6f29fea69199f66dfa5fd2ed7e94b4e
Author: ssnf <ssnf@ssnf.xyz>
Date:   Sun, 15 Aug 2021 15:51:54 +0000

put main() on top of the functions

Diffstat:
Msim.c | 56++++++++++++++++++++++++++++----------------------------
1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/sim.c b/sim.c @@ -34,6 +34,34 @@ static Window w; #include "config.h" +int +main(int argc, char* argv[]) +{ + uint i; + uchar c; + + win_init(); + fr_init(&frame); + for (i = 0; i < FILECOUNT; ++i) + file_init(&file[i]); + f = &file[0]; + if (argv[1]) { + str_adds(f->name, argv[1]); + file_load(f); + } + for (;;) { + win_query(&w); + fr_update(); + c = fgetc(stdin); + for (i = 0; i < LENGTH(keys); ++i) { + if (keys[i].key == c) { + keys[i].func(keys[i].value); + break; + } + } + } +} + void die(char* fmt, ...) { @@ -264,31 +292,3 @@ quit(int arg) win_end(); exit(arg); } - -int -main(int argc, char* argv[]) -{ - uint i; - uchar c; - - win_init(); - fr_init(&frame); - for (i = 0; i < FILECOUNT; ++i) - file_init(&file[i]); - f = &file[0]; - if (argv[1]) { - str_adds(f->name, argv[1]); - file_load(f); - } - for (;;) { - win_query(&w); - fr_update(); - c = fgetc(stdin); - for (i = 0; i < LENGTH(keys); ++i) { - if (keys[i].key == c) { - keys[i].func(keys[i].value); - break; - } - } - } -}