I'm attempting to make an Ncurses based menu frontend for a Hyper Text Coffee Pot Control Protocol Client. This was an april fools RFC and the spec for this can be found here:


At the moment the ncurses based menu works pretty well, you can pick the additions to add your coffee without any problems.

Where the problem lies at the moment is taking the selections from the menu and forming the request string to be sent to the coffee server. Or more specifically opening the socket to the server. I seem to be having issues with random seg faults. These are located in the brew function either just after attempting to open a socket or attempting to open a new window into which the request string will be dumped to see what the server should recieve.

The code can be found at www.rayjchris.co.uk/code/finalmenu.c

Any suggestions as to why the new window function is failing on line 155.

The line: wattrset(my_win2, COLOR_PAIR(WHITEONBLACK)| WA_BOLD); sometimes also appears to be the cause of a seg fault from time to time. line 156.

Or why the socket creation function is failing would be welcome on line 304.

Also if anyone has any suggestion to improve the quality of the code or robustness I'd like to hear from you.

Thanks in advance :-)