[FFmpeg-cvslog] r18037 - in trunk: cmdutils.c cmdutils.h

stefano subversion
Wed Mar 18 22:35:49 CET 2009


Author: stefano
Date: Wed Mar 18 22:35:49 2009
New Revision: 18037

Log:
Implement read_yesno().

Modified:
   trunk/cmdutils.c
   trunk/cmdutils.h

Modified: trunk/cmdutils.c
==============================================================================
--- trunk/cmdutils.c	Wed Mar 18 22:34:19 2009	(r18036)
+++ trunk/cmdutils.c	Wed Mar 18 22:35:49 2009	(r18037)
@@ -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;
+}

Modified: trunk/cmdutils.h
==============================================================================
--- trunk/cmdutils.h	Wed Mar 18 22:34:19 2009	(r18036)
+++ trunk/cmdutils.h	Wed Mar 18 22:35:49 2009	(r18037)
@@ -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 */




More information about the ffmpeg-cvslog mailing list