Implement read_yesno().

Originally committed as revision 18037 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Stefano Sabatini 16 years ago
parent eab5168cd3
commit 090b61b2d1
  1. 11
      cmdutils.c
  2. 6
      cmdutils.h

@ -472,3 +472,14 @@ void show_formats(void)
"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n" "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
"worse.\n"); "worse.\n");
} }
int read_yesno(void)
{
int c = getchar();
int yesno = (toupper(c) == 'Y');
while (c != '\n' && c != EOF)
c = getchar();
return yesno;
}

@ -152,4 +152,10 @@ void show_license(void);
*/ */
void show_formats(void); void show_formats(void);
/**
* Returns a positive value if reads from standard input a line
* starting with [yY], otherwise returns 0.
*/
int read_yesno(void);
#endif /* FFMPEG_CMDUTILS_H */ #endif /* FFMPEG_CMDUTILS_H */

Loading…
Cancel
Save