随笔 - 64, 文章 - 11, 评论 - 12, 引用 - 0
数据加载中……

Linux 程序man手册页模板

      写了个小工具,为了让它看起来更专业一些,也很想让工具能象Linux中的其它工具一样能被man显示使用它的帮助信息。上网搜了下相关的资料,网上找到了一些关于写man帮助的语法,介绍得比较详细和深入。同样也得花许多时间来学习和掌握,我们的程序不需要更加表现丰富的帮助页。我希望能花很少的时间快速写出一个帮助来,所以我找到begin linux programing中的第九章中的帮助示例。以这个示例为基础作些改动就可以作出一个还不错的帮助页,减少难度。

.TH MYAPP 1

.SH NAME
Myapp \- A simple demonstration application that does very little.

.SH SYNOPSIS
.B myapp
[\-option ...]

.SH DESCRIPTION
.PP
\fImyapp\fP is a complete application that does nothing useful.

.PP
It was written for demonstration purposes.

.SH OPTIONS
.PP
It doesn't have any, but lets pretend, to make this template complete:

.TP
.BI \-option
If there was an option, it would not be -option.

.SH RESOURCES
.PP
myapp uses almost no resources.

.SH DIAGNOSTICS
The program shouldn't output anything, so if you find it doing so there's
probably something wrong. The return value is zero.

.SH SEE ALSO
The only other program we know with this this little functionality is the
ubiquitous hello world application.

.SH COPYRIGHT
myapp is Copyright (c) 2007 Wiley Publishing, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

.SH BUGS
There probably are some, but we don't know what they are yet.

.SH AUTHORS
Neil Matthew and Rick Stones

.SH ACKNOWLEDGEMENT
Thanks to Wrox press for publishing this book.

posted on 2013-04-07 17:03 Robertxiao 阅读(1371) 评论(0)  编辑 收藏 引用 所属分类: Linux


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理