]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Implement read_yesno().
authorstefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 18 Mar 2009 21:35:49 +0000 (21:35 +0000)
committerstefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 18 Mar 2009 21:35:49 +0000 (21:35 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18037 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

cmdutils.c
cmdutils.h

index 7c4a530ef9c92d3475c32dcd0a2321cf28ccd42e..167d15a71c9c517b02cd91aac72b39dec35bc713 100644 (file)
@@ -472,3 +472,14 @@ void show_formats(void)
 "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
 "worse.\n");
 }
+
+int read_yesno(void)
+{
+    int c = getchar();
+    int yesno = (toupper(c) == 'Y');
+
+    while (c != '\n' && c != EOF)
+        c = getchar();
+
+    return yesno;
+}
index 959c3f7cd289ea96191c5a800b02bfc342c32c85..e30ea0f9afc13a975eb19bfa9d5973cc09c7d838 100644 (file)
@@ -152,4 +152,10 @@ void show_license(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 */