int ed_main(int argc, char **argv) { if (!initEdit()) return EXIT_FAILURE; if (argc > 1) { fileName = strdup(argv[1]); if (fileName == NULL) { bb_error_msg("no memory"); termEdit(); return EXIT_SUCCESS; } if (!readLines(fileName, 1)) { termEdit(); return EXIT_SUCCESS; } if (lastNum) setCurNum(1); dirty = FALSE; } doCommands(); termEdit(); return EXIT_SUCCESS; }
void do_ed(int argc, const char ** argv) { if (!initEdit()) return; if (argc > 1) { fileName = strdup(argv[1]); if (fileName == NULL) { fprintf(stderr, "No memory\n"); termEdit(); return; } if (!readLines(fileName, 1)) { termEdit(); return; } if (lastNum) setCurNum(1); dirty = FALSE; } doCommands(); termEdit(); }
int ed_main(int argc UNUSED_PARAM, char **argv) { INIT_G(); bufSize = INITBUF_SIZE; bufBase = xmalloc(bufSize); bufPtr = bufBase; lines.next = &lines; lines.prev = &lines; if (argv[1]) { fileName = xstrdup(argv[1]); if (!readLines(fileName, 1)) { return EXIT_SUCCESS; } if (lastNum) setCurNum(1); dirty = FALSE; } doCommands(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { doCommands(); }