.\" 2007-09-14 Ollie Wild <aaw@google.com>, 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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <assert.h>
int
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 <file-to-exec>\\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
newargv[0] = argv[1];
execve(argv[1], newargv, newenviron);
.\" 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
.nf
#include <sys/wait.h>
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
pid_t cpid;
char buf;
- assert(argc == 2);
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <string>\\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
if (pipe(pipefd) == \-1) {
perror("pipe");
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <assert.h>
#include <errno.h>
#include <limits.h>
int fd;
int len, slen;
- assert(argc == 2);
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <file>\\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == \-1) {
.\" Distributed under the GPL.
.\" 2008-12-04, Petr Baudis <pasky@suse.cz>: 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
\&
.nf
#define _GNU_SOURCE
-#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
size_t size;
char *ptr;
- assert(argc == 2);
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <file>\\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
in = fmemopen(argv[1], strlen(argv[1]), "r");
if (in == NULL)
.\" 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
#include <pthread.h>
#include <mqueue.h>
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
mqd_t mqdes;
struct sigevent not;
- assert(argc == 2);
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <mq-name>\\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
mqdes = mq_open(argv[1], O_RDONLY);
if (mqdes == (mqd_t) \-1)
.\"
.\" 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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
static int
cmpstringp(const void *p1, const void *p2)
{
int j;
- assert(argc > 1);
+ if (argc < 2) {
+ fprintf(stderr, "Usage: %s <string>...\\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
qsort(&argv[1], argc \- 1, sizeof(char *), cmpstringp);