[brlcad-commits] SF.net SVN: brlcad:[49421] brlcad/trunk/src/shapes/window_frame.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2012-02-14 20:20:46
|
Revision: 49421 http://brlcad.svn.sourceforge.net/brlcad/?rev=49421&view=rev Author: brlcad Date: 2012-02-14 20:20:36 +0000 (Tue, 14 Feb 2012) Log Message: ----------- if the scanf fails, don't just perror and keep processing with the potentially 'tainted' scalar. set it to something sane (in leu of aborting). cid 2097, run 10. Modified Paths: -------------- brlcad/trunk/src/shapes/window_frame.c Modified: brlcad/trunk/src/shapes/window_frame.c =================================================================== --- brlcad/trunk/src/shapes/window_frame.c 2012-02-14 19:43:50 UTC (rev 49420) +++ brlcad/trunk/src/shapes/window_frame.c 2012-02-14 20:20:36 UTC (rev 49421) @@ -107,34 +107,46 @@ (void)printf("Enter the mged file to be created (25 char max).\n\t"); (void)fflush(stdout); ret = scanf("%26s", filemged); - if (ret == 0) + if (ret == 0) { perror("scanf"); + bu_strlcpy(filemged, "window_frame.g", sizeof(filemged)); + } /* Find the number of window frames to create. */ (void)printf("Enter the number of window frames to create (26 max).\n\t"); (void)fflush(stdout); ret = scanf("%d", &numwin); - if (ret == 0) + if (ret == 0) { perror("scanf"); + numwin = 1; + } /* Find the dimensions of the window frames. */ (void)printf("Enter the height, width, and depth of the window frame.\n\t"); (void)fflush(stdout); ret = scanf("%lf %lf %lf", &hgt, &wid, &dpt); - if (ret == 0) + if (ret == 0) { perror("scanf"); + hgt = 1618; /* golden ratio */ + wid = 1000; + dpt = 10; + } (void)printf("Enter the radius of the corner.\n\t"); (void)fflush(stdout); ret = scanf("%lf", &rds); - if (ret == 0) + if (ret == 0) { perror("scanf"); + rds = 2; + } (void)printf("Enter the actual width of the window frame.\n\t"); (void)fflush(stdout); ret = scanf("%lf", &isw); - if (ret == 0) + if (ret == 0) { perror("scanf"); + isw = 5; + } } /* END # 3 */ /* If there are arguments get answers from arguments. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |