Skip to content

Commit 954cdc5

Browse files
committed
transfer: enable curl's native progress bar
Signed-off-by: dev-harsh1998 <harshitjain6751@gmail.com>
1 parent 2435204 commit 954cdc5

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66

77
# Issue 1 file size
8-
CFLAGS="-DGET_FILE_SIZE -Wall"
8+
CFLAGS="-DGET_FILE_SIZE" "-Wall" "-DPROGRESS_BAR"
99

1010
CC ?= gcc
1111
CLANG_FORMAT ?= clang-format

transfer.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,19 @@ int main(int argc, char *argv[]) {
8989
float mb = st.st_size / 1048576;
9090
printf("The size of the file going to be uploaded is near to %.2f "
9191
"megabytes\n",
92-
mb);
92+
mb);
9393
}
9494
#endif
9595

9696
char cmdbuf[256];
9797
int ret;
98+
99+
#ifdef PROGRESS_BAR
100+
sprintf(cmdbuf, "curl --progress-bar -T %s %s | tee /dev/null", argv[1], "https://transfer.sh");
101+
#else
98102
sprintf(cmdbuf, "curl -T %s %s", argv[1], "https://transfer.sh");
103+
#endif
104+
99105
ret = system(cmdbuf);
100106
printf("\n");
101107
return ret;

0 commit comments

Comments
 (0)