diff --git a/man2/execve.2 b/man2/execve.2 index b9611f4d7..0ea50db15 100644 --- a/man2/execve.2 +++ b/man2/execve.2 @@ -34,7 +34,7 @@ .\" 2007-09-14 Ollie Wild , mtk .\" Add text describing limits on command-line arguments + environment .\" -.TH EXECVE 2 2009-04-21 "Linux" "Linux Programmer's Manual" +.TH EXECVE 2 2009-09-15 "Linux" "Linux Programmer's Manual" .SH NAME execve \- execute program .SH SYNOPSIS @@ -555,7 +555,6 @@ argument: #include #include #include -#include int main(int argc, char *argv[]) @@ -563,8 +562,11 @@ main(int argc, char *argv[]) char *newargv[] = { NULL, "hello", "world", NULL }; char *newenviron[] = { NULL }; - assert(argc == 2); /* argv[1] identifies - program to exec */ + if (argc != 2) { + fprintf(stderr, "Usage: %s \\n", argv[0]); + exit(EXIT_FAILURE); + } + newargv[0] = argv[1]; execve(argv[1], newargv, newenviron); diff --git a/man2/pipe.2 b/man2/pipe.2 index 731ab962e..67fb1f445 100644 --- a/man2/pipe.2 +++ b/man2/pipe.2 @@ -33,7 +33,7 @@ .\" to EXAMPLE text. .\" 2008-10-10, mtk: add description of pipe2() .\" -.TH PIPE 2 2008-11-04 "Linux" "Linux Programmer's Manual" +.TH PIPE 2 2009-09-15 "Linux" "Linux Programmer's Manual" .SH NAME pipe, pipe2 \- create pipe .SH SYNOPSIS @@ -139,7 +139,6 @@ and echoes it on standard output. .nf #include -#include #include #include #include @@ -152,7 +151,10 @@ main(int argc, char *argv[]) pid_t cpid; char buf; - assert(argc == 2); + if (argc != 2) { + fprintf(stderr, "Usage: %s \\n", argv[0]); + exit(EXIT_FAILURE); + } if (pipe(pipefd) == \-1) { perror("pipe"); diff --git a/man2/tee.2 b/man2/tee.2 index 9863ac74f..23ffab2c0 100644 --- a/man2/tee.2 +++ b/man2/tee.2 @@ -139,7 +139,6 @@ system call. #include #include #include -#include #include #include @@ -149,7 +148,10 @@ main(int argc, char *argv[]) int fd; int len, slen; - assert(argc == 2); + if (argc != 2) { + fprintf(stderr, "Usage: %s \\n", argv[0]); + exit(EXIT_FAILURE); + } fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd == \-1) { diff --git a/man3/fmemopen.3 b/man3/fmemopen.3 index 0eb263ef2..c92924f95 100644 --- a/man3/fmemopen.3 +++ b/man3/fmemopen.3 @@ -3,7 +3,7 @@ .\" Distributed under the GPL. .\" 2008-12-04, Petr Baudis : Document open_wmemstream() .\" -.TH FMEMOPEN 3 2009-04-21 "GNU" "Linux Programmer's Manual" +.TH FMEMOPEN 3 2009-09-15 "GNU" "Linux Programmer's Manual" .SH NAME fmemopen, open_memstream, open_wmemstream \- open memory as stream .SH SYNOPSIS @@ -206,7 +206,6 @@ size=11; ptr=1 529 1849 \& .nf #define _GNU_SOURCE -#include #include #include #include @@ -222,7 +221,10 @@ main(int argc, char *argv[]) size_t size; char *ptr; - assert(argc == 2); + if (argc != 2) { + fprintf(stderr, "Usage: %s \\n", argv[0]); + exit(EXIT_FAILURE); + } in = fmemopen(argv[1], strlen(argv[1]), "r"); if (in == NULL) diff --git a/man3/mq_notify.3 b/man3/mq_notify.3 index ad4410eda..b17a7bb7e 100644 --- a/man3/mq_notify.3 +++ b/man3/mq_notify.3 @@ -23,7 +23,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH MQ_NOTIFY 3 2009-03-31 "Linux" "Linux Programmer's Manual" +.TH MQ_NOTIFY 3 2009-09-15 "Linux" "Linux Programmer's Manual" .SH NAME mq_notify \- register for notification when a message is available .SH SYNOPSIS @@ -215,7 +215,6 @@ queue and then terminates the process. #include #include -#include #include #include #include @@ -254,7 +253,10 @@ main(int argc, char *argv[]) mqd_t mqdes; struct sigevent not; - assert(argc == 2); + if (argc != 2) { + fprintf(stderr, "Usage: %s \\n", argv[0]); + exit(EXIT_FAILURE); + } mqdes = mq_open(argv[1], O_RDONLY); if (mqdes == (mqd_t) \-1) diff --git a/man3/qsort.3 b/man3/qsort.3 index e29ed28b2..87ef12940 100644 --- a/man3/qsort.3 +++ b/man3/qsort.3 @@ -31,7 +31,7 @@ .\" .\" FIXME glibc 2.8 added qsort_r(), which needs to be documented. .\" -.TH QSORT 3 2009-02-01 "" "Linux Programmer's Manual" +.TH QSORT 3 2009-09-15 "" "Linux Programmer's Manual" .SH NAME qsort \- sorts an array .SH SYNOPSIS @@ -85,7 +85,6 @@ which sorts the strings given in its command-line arguments: #include #include #include -#include static int cmpstringp(const void *p1, const void *p2) @@ -102,7 +101,10 @@ main(int argc, char *argv[]) { int j; - assert(argc > 1); + if (argc < 2) { + fprintf(stderr, "Usage: %s ...\\n", argv[0]); + exit(EXIT_FAILURE); + } qsort(&argv[1], argc \- 1, sizeof(char *), cmpstringp);