Artifact
cc99da2c8d925c295c0c40018eb659fc547f6a62:
Ticket change
[cc99da2c8d]
- Ticket [2857ab0995]
Introduce commandline switches to avoid user input status still Open with 2 other changes
by
anonymous
2011-01-05 21:55:59.
D 2011-01-05T21:55:59
J +comment \n\n<hr\s/><i>anonymous\sclaiming\sto\sbe\sikoch\sadded\son\s2011-01-05\s21:55:59\sUTC:</i><br\s/>\nI'm\sstill\spuzzling\stogether\sthe\spieces\sto\strace\sfossils\soutput\sand\sinject\sthe\sappropriate\sanswers.\sNow\san\sother\sproblem\sraised\sits\sugly\shead.\r\n\r\nWhen\sfossil\sprompts\sthe\suser\sfor\sinput,\sit\swaits\sfor\sthe\sanswer\son\sthe\ssame\sline\sas\sthe\sprompt.\sIt\sdoesn't\sadd\sa\sline\send\sterminator\safter\sthe\sprompt.\s\r\nThe\sproblem\sis\sthat\sI\sneed\sto\sread\sthe\sfossil\soutput\sbefore\sI\scan\sdecide\swhat\sto\sdo.\sI\sdo\sthis\sby\sregistering\sto\sevents\swhich\soccur\swhenever\sa\sline\shas\sbeen\swritten\sto\sstdout\sor\sstderr.\sUnfortunately\sthe\sline\sisn't\swritten\scompletely\sfor\sprompts,\sthe\sline\send\sterminator\sis\smissing.\sBecause\sof\sthis,\sthe\sline\sis\snever\sread,\sthe\sevent\sis\snever\sfired\sand\sthe\sanswer\sis\snever\ssent\sto\sstdin\sto\smake\sfossil\shappy.\sFossil\swaits\sforever.\r\n\r\nA\sminor\schange\sin\suser.c\swould\smake\sit\spossible\sto\sread\sthe\sline.\sJust\sadd\sa\snewline\sto\sthe\sformat\sstring\sin\sthe\sprintf\sstatement\sand\sanything\sshould\swork.\s\r\n<pre>\r\nvoid\sprompt_user(const\schar\s*zPrompt,\sBlob\s*pIn){\r\n\s\schar\s*z;\r\n\s\schar\szLine[1000];\r\n\s\sblob_zero(pIn);\r\n\s\sprintf("%s\\n",\szPrompt);\s/*\sadded\sa\snewline\sto\sterminate\sthe\sline\s*/\r\n\s\sfflush(stdout);\r\n\s\sz\s=\sfgets(zLine,\ssizeof(zLine),\sstdin);\r\n\s\sif(\sz\s){\r\n\s\s\s\sstrip_string(pIn,\sz);\r\n\s\s}\r\n}\r\n</pre>\r\nI\sthink\sexcept\sfor\sthe\sinput\sin\sthe\suser_cmd\sfunction\sit\sdoesn't\sreally\smatter\swether\sthe\sresponse\sis\sentered\son\sa\snew\sline\sor\snot\sand\seven\sthere\sit\sis\snot\sreally\sa\sproblem.
J resolution Open
K 2857ab0995828207effd6ebc4526ca88a53755f7
U anonymous
Z ea3033097910bb58c3312f3a57cc1e05