Valor de retorno de fgets ()

Hace poco comencé a trabajar conI/O enC. Aquí está mi pregunta:
Tengo un archivo, del cual leo mi entrada. Entonces usofgets() para obtener cadenas en un búfer que utilizo de alguna manera. Ahora, ¿qué sucede si la entrada es demasiado corta para el búfer, es decir, si la primera lectura porfgets() alcanzaEOF. Deberíafgets() regresoNULL(como he leído enfgets() documentación)? Parece que no lo hace y recibo mi opinión correctamente. Además incluso mifeof(input) no dice que hemos alcanzadoEOF.
Aquí está mi fragmento de código.

char    buf[BUFSIZ];
FILE    *input,
        *output;

input   = fopen(argv[--argc], "r");
output  = fopen(argv[--argc], "w");

/**
 *  If either of the input or output were unable to be opened
 *          we exit
 */
if (input == NULL) {
    fprintf(stdout, "Failed to open file - %s.\n", argv[argc + 1]);
    exit(EXIT_FAILURE);
}

if (output == NULL) {
    fprintf(stdout, "Failed to open file - %s.\n", argv[argc + 0]);
    exit(EXIT_FAILURE);
}

if (fgets(buf, sizeof(buf), input) != NULL) {
    ....
}

/**
 *  After the fgets() condition exits it is because, either -
 *      1) The EOF was reached.
 *      2) There is a read error.
 */
if (feof(input)) {
    fprintf(stdout, "Reached EOF.\n");
}
else if (ferror(input)) {
    fprintf(stdout, "Error while reading the file.\n");
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta