Currently autolab submit insists on being given the name of a file that both exists and is a "regular file" (file_exists is true only for files that pass stat(file, &st) == 0 && S_ISREG(st.st_mode)). This means it is impossible to get it to read the submission from standard input, which makes it significantly harder to feed a submission to autolab submit from a C program.
Please make at least one, preferably both, of the following changes:
- If the file name given on the command line is a single ASCII minus sign (
-), read the submission from standard input. (Skip the "does this file exist" check in [], and then all the way down in RawClient::raw_request, change how you call curl_formadd.)
- Allow use of
/dev/stdin as the file argument, by changing file_exists so that it considers files that exist but aren't regular files, as long as you can read() from them normally. (Probably the right thing is to blacklist S_ISDIR and S_ISBLK and accept anything else.)
Also, whichever of the two changes you make, you need to test that submitting standard input works correctly when stdin is any of:
These are in decreasing order of importance, but ideally all of them would work.