Skip to content

Conversation

@E5ten
Copy link
Contributor

@E5ten E5ten commented Jan 28, 2020

can be manually enabled or disabled at build time by defining
HAVE_TIOCGWINSZ in CFLAGS, otherwise automatically disabled on
operating systems known to have the TIOCGWINSZ ioctl

@E5ten E5ten force-pushed the one-line branch 3 times, most recently from a38449e to db8b53b Compare January 28, 2020 23:19
@E5ten E5ten requested a review from michaelforney January 29, 2020 01:43
@E5ten
Copy link
Contributor Author

E5ten commented Mar 31, 2020

I think I've resolved the issue I tried to solve the wrong way in #44.

Copy link
Owner

@michaelforney michaelforney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think you could come up with a small abstraction for the status printing? Then the smart status printer could go into a separate file, and we avoid all the ifdefs.

Maybe something like statusinit(), statusprint(const char *status, const char *description), statusoutput(const char *out, size_t len), statusdone()?

Actually, now that I think about it, it might be simpler to just have a single function size_t termwidth(void). term-dumb.c could just return 0, and term-ansi.c could use the ioctl.

@E5ten E5ten force-pushed the one-line branch 2 times, most recently from 104f33a to 93a5a53 Compare April 5, 2020 21:39
@E5ten
Copy link
Contributor Author

E5ten commented Apr 5, 2020

Do you think you could come up with a small abstraction for the status printing? Then the smart status printer could go into a separate file, and we avoid all the ifdefs.

Maybe something like statusinit(), statusprint(const char *status, const char *description), statusoutput(const char *out, size_t len), statusdone()?

Actually, now that I think about it, it might be simpler to just have a single function size_t termwidth(void). term-dumb.c could just return 0, and term-ansi.c could use the ioctl.

What would I do to have the build choose which of term-{dumb,ansi}.c to use?

@michaelforney
Copy link
Owner

What would I do to have the build choose which of term-{dumb,ansi}.c to use?

I'd just do

TERM=dumb
OBJ=\
	...
	term-$(TERM).o

Operating systems that want to enable smart status printing can just build with make TERM=ansi.

@E5ten
Copy link
Contributor Author

E5ten commented Apr 5, 2020

And should I add a header, or forward declare any functions from term-{dumb,ansi}.c in build.c?

@michaelforney
Copy link
Owner

Yeah, a term.h is probably appropriate.

@E5ten
Copy link
Contributor Author

E5ten commented Apr 5, 2020

This will probably need at least some cleanup but I've moved the ifdefed stuff into separate files.

Copy link
Owner

@michaelforney michaelforney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is looking pretty good now.

@E5ten E5ten force-pushed the one-line branch 4 times, most recently from 6182891 to 7327254 Compare April 5, 2020 23:34
can be manually enabled or disabled at build time by defining
HAVE_TIOCGWINSZ in CFLAGS, otherwise automatically enabled on
operating systems known to have the TIOCGWINSZ ioctl
@E5ten
Copy link
Contributor Author

E5ten commented Apr 15, 2020

Is there anything still blocking this?

@bonzini
Copy link
Contributor

bonzini commented Oct 24, 2020

Honestly I think printing all output on the same line is a bad idea and (the lack of) this is the main reason why I use samu instead of ninja. Since ninja has no "whatif" tool which is the opposite of "commands", that is to print what would be built if a file was touched, the only way to do so is to touch the source file and do a ninja -n. But ninja -n effectively only prints the last line, so you have to do ninja -n | cat... or just use samu instead.

@E5ten
Copy link
Contributor Author

E5ten commented Oct 24, 2020

This is a build-time option that defaults to being disabled, so I don't think that's really a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants