=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/main.c,v retrieving revision 1.123 retrieving revision 1.124 diff -c -r1.123 -r1.124 *** src/usr.bin/mandoc/main.c 2015/01/20 21:12:46 1.123 --- src/usr.bin/mandoc/main.c 2015/02/07 06:27:53 1.124 *************** *** 1,4 **** ! /* $OpenBSD: main.c,v 1.123 2015/01/20 21:12:46 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: main.c,v 1.124 2015/02/07 06:27:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze *************** *** 125,132 **** int options; int c; ! progname = strrchr(argv[0], '/'); ! if (progname == NULL) progname = argv[0]; else ++progname; --- 125,133 ---- int options; int c; ! if (argc < 1) ! progname = "mandoc"; ! else if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else ++progname; *************** *** 277,284 **** /* Parse arguments. */ ! argc -= optind; ! argv += optind; resp = NULL; /* --- 278,287 ---- /* Parse arguments. */ ! if (argc > 0) { ! argc -= optind; ! argv += optind; ! } resp = NULL; /* *************** *** 395,407 **** if (OUTT_MAN == curp.outtype) mparse_keep(curp.mp); ! if (argc == 0) { if (use_pager && isatty(STDOUT_FILENO)) spawn_pager(); parse(&curp, STDIN_FILENO, "", &rc); } ! while (argc) { rctmp = mparse_open(curp.mp, &fd, resp != NULL ? resp->file : *argv); if (rc < rctmp) --- 398,410 ---- if (OUTT_MAN == curp.outtype) mparse_keep(curp.mp); ! if (argc < 1) { if (use_pager && isatty(STDOUT_FILENO)) spawn_pager(); parse(&curp, STDIN_FILENO, "", &rc); } ! while (argc > 0) { rctmp = mparse_open(curp.mp, &fd, resp != NULL ? resp->file : *argv); if (rc < rctmp)