=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/Attic/apropos.c,v retrieving revision 1.16 retrieving revision 1.17 diff -c -r1.16 -r1.17 *** src/usr.bin/mandoc/Attic/apropos.c 2012/04/15 11:54:47 1.16 --- src/usr.bin/mandoc/Attic/apropos.c 2013/07/12 11:01:42 1.17 *************** *** 1,4 **** ! /* $Id: apropos.c,v 1.16 2012/04/15 11:54:47 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze --- 1,4 ---- ! /* $Id: apropos.c,v 1.17 2013/07/12 11:01:42 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze *************** *** 43,50 **** struct expr *e; char *defpaths, *auxpaths; char *conf_file; - extern int optind; extern char *optarg; progname = strrchr(argv[0], '/'); if (progname == NULL) --- 43,50 ---- struct expr *e; char *defpaths, *auxpaths; char *conf_file; extern char *optarg; + extern int optind; progname = strrchr(argv[0], '/'); if (progname == NULL) *************** *** 52,58 **** else ++progname; ! whatis = 0 == strncmp(progname, "whatis", 6); memset(&paths, 0, sizeof(struct manpaths)); memset(&opts, 0, sizeof(struct opts)); --- 52,58 ---- else ++progname; ! whatis = (0 == strncmp(progname, "whatis", 6)); memset(&paths, 0, sizeof(struct manpaths)); memset(&opts, 0, sizeof(struct opts)); *************** *** 81,100 **** opts.cat = optarg; break; default: ! fprintf(stderr, ! "usage: %s [-C file] [-M path] [-m path]" ! " [-S arch] [-s section]%s ...\n", ! progname, ! whatis ? " name" : ! "\n expression"); ! return(EXIT_FAILURE); } argc -= optind; argv += optind; ! if (0 == argc) ! return(EXIT_SUCCESS); rc = 0; --- 81,94 ---- opts.cat = optarg; break; default: ! goto usage; } argc -= optind; argv += optind; ! if (0 == argc) ! goto usage; rc = 0; *************** *** 116,126 **** --- 110,127 ---- fprintf(stderr, "%s: Bad database\n", progname); goto out; } + out: manpath_free(&paths); resfree(res, ressz); exprfree(e); return(rc ? EXIT_SUCCESS : EXIT_FAILURE); + + usage: + fprintf(stderr, "usage: %s [-C file] [-M path] [-m path] " + "[-S arch] [-s section]%s ...\n", progname, + whatis ? " name" : "\n expression"); + return(EXIT_FAILURE); } /* ARGSUSED */