- if(outfile != NULL) {
- if((out = fopen(outfile, "a")) == NULL) {
- flog(LOG_ERR, "accesslog: could not open %s for logging: %s", outfile, strerror(errno));
+ if(!strcmp(argv[optind], "-")) {
+ out = stdout;
+ } else {
+ if((out = fopen(argv[optind], "a")) == NULL) {
+ flog(LOG_ERR, "accesslog: could not open %s for logging: %s", argv[optind], strerror(errno));