On Wed, 25 Nov 2015 15:22:27 -0500, "Ted Unangst" wrote:
> I think this is the way to go, throughout games. The only things
> we need to know are username (getlogin() or even $USER) and home
> dir ($HOME). Digging the home dir out of passwd seems unnecessary
> (or even wrong, if i've set HOME to
On Wed, Nov 25, 2015 at 03:22:27PM -0500, Ted Unangst wrote:
> Theo Buehler wrote:
> >
> > If you're not going to maintain a list of high scores of the user, you
> > could still simplify snscore() further: The score file will just
> > contain the user's score as a short, so you could get the
This makes sense to me and keeps the game usable in principle without
needing to do silly things. ok beck@
Related is that reading threaded mail in gmail and seeing "Theo" on
them so you open them up is insidious. I think I need to change my
name to "Theo" as well...
On Thu, Nov 26, 2015
Hi,
Move score and log files to $HOME for snake(6), a few notes on it:
First open(2) operation must be changed to O_RDWR|O_CREAT since the file is no
longer copied to the location like it was in Makefile and now needs to be
created if it doesn't exist.
Remove one else when exiting the game
On Wed, Nov 25, 2015 at 03:28:55PM +, Ricardo Mestre wrote:
> First open(2) operation must be changed to O_RDWR|O_CREAT since the file is no
> longer copied to the location like it was in Makefile and now needs to be
> created if it doesn't exist.
I agree with that.
> Remove one else when
Hi Theo, hope you are doing well! I did the changes as you instructed and now
since the snscore() is so tiny we might just as well incorporate it into
snake.c. There's not need for a separate file just for a function with a few
lines.
Index: Makefile
On Wed, Nov 25, 2015 at 06:23:49PM +, Ricardo Mestre wrote:
> Another thing as well, maybe char *name for getlogin(2) could/should be
> declared as char name[LOGIN_NAME_MAX]?
No, that won't compile. You'd need to use the reentrant version
getlogin_r(name, LOGIN_NAME_MAX), then.
I think using
Theo Buehler wrote:
>
> If you're not going to maintain a list of high scores of the user, you
> could still simplify snscore() further: The score file will just
> contain the user's score as a short, so you could get the user name
> using getlogin(2) instead of doing getuid() getpwuid(), etc.
>
Another thing as well, maybe char *name for getlogin(2) could/should be
declared as char name[LOGIN_NAME_MAX]?
On 25/11/2015 18:00, Ricardo Mestre wrote:
> Hi Theo, hope you are doing well! I did the changes as you instructed and now
> since the snscore() is so tiny we might just as well