add FAIL message for requests
This commit is contained in:
parent
8efb9bbce7
commit
d46ba98831
2 changed files with 6 additions and 2 deletions
|
@ -29,6 +29,7 @@ Good to know! I can also give the ``-r`` flag to display the resolution if I so
|
||||||
What if I don't want my wife to find a photo of Peter Griffin on my laptop? Well, you can use a link instead::
|
What if I don't want my wife to find a photo of Peter Griffin on my laptop? Well, you can use a link instead::
|
||||||
|
|
||||||
$ uirc https://upload.wikimedia.org/wikipedia/en/c/c2/Peter_Griffin.png
|
$ uirc https://upload.wikimedia.org/wikipedia/en/c/c2/Peter_Griffin.png
|
||||||
|
downloading "https://upload.wikimedia.org/wikipedia/en/c/c2/Peter_Griffin.png"...ok
|
||||||
Peter_Griffin.png > 1:1.45 (uneven)
|
Peter_Griffin.png > 1:1.45 (uneven)
|
||||||
|
|
||||||
There's also a help menu with the ``-h`` flag if you really need it.
|
There's also a help menu with the ``-h`` flag if you really need it.
|
||||||
|
|
7
uirc.c
7
uirc.c
|
@ -70,7 +70,7 @@ int readFile(char *file, int rFlag, int req, char* url) {
|
||||||
unsigned char *img = stbi_load(file, &width, &height, &channels, 0);
|
unsigned char *img = stbi_load(file, &width, &height, &channels, 0);
|
||||||
if (img == NULL) {
|
if (img == NULL) {
|
||||||
if (req == 0) {
|
if (req == 0) {
|
||||||
printf("uirc: request failed (%s), trying local fs instead\n", url);
|
printf("FAIL\nuirc: request failed (%s), trying local fs instead\n", url);
|
||||||
return 4;
|
return 4;
|
||||||
} else if (access(file, F_OK) != 0) {
|
} else if (access(file, F_OK) != 0) {
|
||||||
printf("uirc: %s: No such file or directory\n", file);
|
printf("uirc: %s: No such file or directory\n", file);
|
||||||
|
@ -81,6 +81,9 @@ int readFile(char *file, int rFlag, int req, char* url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req == 0)
|
||||||
|
printf("ok\n");
|
||||||
|
|
||||||
factor = getBcf(width, height);
|
factor = getBcf(width, height);
|
||||||
stbi_image_free(img);
|
stbi_image_free(img);
|
||||||
double wuneven = ((float) height) / ((float) width);
|
double wuneven = ((float) height) / ((float) width);
|
||||||
|
@ -139,7 +142,7 @@ int download(char *url) {
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
printf("ok\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// end of stack overflow snippet
|
// end of stack overflow snippet
|
||||||
|
|
Loading…
Add table
Reference in a new issue