summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timer.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/timer.c b/timer.c
index 7000727..0e4ce7c 100644
--- a/timer.c
+++ b/timer.c
@@ -1,11 +1,10 @@
#include <stdio.h>
#include <unistd.h>
-int main(){
+int main(int argc, char** argv){
int min; int sec;
- printf("Input #minutes:#seconds ");
- scanf("%d:%d", &min, &sec);
- printf("\n");
+ if (argc != 2) return 1;
+ sscanf(argv[1], "%d:%d", &min, &sec);
int time = min*60 + sec;
for (int i = 1; i<=time; i++){
printf("%d:%02d/%d:%02d\r", (i-i%60)/60, i%60, min, sec);