s/return 0/exit(EXIT_FAILURE)/ in main() function example program

This commit is contained in:
Michael Kerrisk 2007-05-16 02:09:09 +00:00
parent 3618596929
commit 5bc8c34c03
17 changed files with 18 additions and 18 deletions

View File

@ -114,7 +114,7 @@ main(void)
s_info.sharedram, s_info.bufferram,
s_info.totalswap, s_info.freeswap,
s_info.procs);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SS "Sample Output"

View File

@ -341,7 +341,7 @@ main(void)
else
printf("No data within five seconds.\\n");
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "CONFORMING TO"

View File

@ -98,7 +98,7 @@ main(void)
perror("sysctl");
else
printf("This machine is running %*s\en", osnamelth, osname);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "RETURN VALUE"

View File

@ -108,7 +108,7 @@ main(int argc, char **argv)
else
printf("%s: month #%d\en", res->name, res->nr);
}
return 0;
exit(EXIT_SUCCESS);
}
.fi
.\" this example referred to in qsort.3

View File

@ -391,7 +391,7 @@ main(int argc, char **argv)
printf("%f\en", (*cosine)(2.0));
dlclose(handle);
return 0;
exit(EXIT_SUCCESS);
}
.if t .ft P
.fi

View File

@ -132,7 +132,7 @@ main(int argc, char *argv[], char *envp[])
printf("%s\en", str);
str = envz_get(*envp, e_len, "HOME");
printf("%s\en", str);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "CONFORMING TO"

View File

@ -260,7 +260,7 @@ main(void)
default:
printf("Unknown error from fmtmsg()\en");
}
return 0;
exit(EXIT_SUCCESS);
}
.fi
.PP

View File

@ -128,7 +128,7 @@ main(void)
printf("\en");
}
endgrent();
return 0;
exit(EXIT_SUCCESS);
}
.fi
.\" perhaps add error checking - should use strerror_r

View File

@ -62,7 +62,7 @@ main(void)
struct passwd *pw = getpwnam(user);
if (pw == NULL)
return 0;
exit(EXIT_SUCCESS);
if (getgrouplist(user, pw->pw_gid, NULL, &ng) < 0) {
groups = (gid_t *) malloc(ng * sizeof (gid_t));
@ -72,7 +72,7 @@ main(void)
for(i = 0; i < ng; i++)
printf("%d\en", groups[i]);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "SEE ALSO"

View File

@ -125,7 +125,7 @@ main(void)
pwp->pw_uid, pwp->pw_dir, pwp->pw_shell);
}
endpwent();
return 0;
exit(EXIT_SUCCESS);
}
.fi
.\" perhaps add error checking - should use strerror_r

View File

@ -182,7 +182,7 @@ main(int argc, char *argv[])
system("echo after removing entry:;who");
endutent();
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH FILES

View File

@ -208,7 +208,7 @@ main(void)
printf("%9.9s \-> %9.9s:%d\\n", e.key,
ep ? ep\->key : "NULL", ep ? (int)(ep->data) : 0);
}
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "SEE ALSO"

View File

@ -90,7 +90,7 @@ main(void)
else
printf("%s\\n", ctime((time_t *) &time1.tv_sec));
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "NOTES"

View File

@ -292,7 +292,7 @@ main(void)
strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
puts(buf);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "GNU EXTENSIONS"

View File

@ -244,7 +244,7 @@ main(void)
exit(EXIT_FAILURE);
}
twalk(root, action);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH "CONFORMING TO"

View File

@ -91,7 +91,7 @@ main(int argc, char **argv)
for (i=0; i<p.we_wordc; i++)
printf("%s\en", w[i]);
wordfree(&p);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH DETAILS

View File

@ -101,7 +101,7 @@ main(void)
attrib ^= 0x10;
(void) lseek(fd, \-1, 1);
(void) write(fd, &attrib, 1);
return 0;
exit(EXIT_SUCCESS);
}
.fi
.SH FILES