-/* $NetBSD: machdep.c,v 1.16 2008/01/14 00:23:52 dholland Exp $ */
+/* $NetBSD: machdep.c,v 1.20 2012/12/01 11:37:27 mbalmer Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: machdep.c,v 1.16 2008/01/14 00:23:52 dholland Exp $");
+__RCSID("$NetBSD: machdep.c,v 1.20 2012/12/01 11:37:27 mbalmer Exp $");
#endif
#endif /* not lint */
* #endif
* }
*
- * Appropriate variations of this are of course acceptible.
+ * Appropriate variations of this are of course acceptable.
* The use of "#elseif" is discouraged because of non-portability.
* If the correct #define doesn't exist, "UNIX_SYSV" in this case, make it up
* and insert it in the list at the top of the file. Alter the CFLAGS
*/
void
-md_slurp()
+md_slurp(void)
{
(void)fpurge(stdin);
}
*/
void
-md_heed_signals()
+md_heed_signals(void)
{
signal(SIGINT, onintr);
signal(SIGQUIT, byebye);
*/
void
-md_ignore_signals()
+md_ignore_signals(void)
{
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
*/
int
-md_get_file_id(fname)
- const char *fname;
+md_get_file_id(const char *fname)
{
struct stat sbuf;
*/
int
-md_link_count(fname)
- const char *fname;
+md_link_count(const char *fname)
{
struct stat sbuf;
*/
void
-md_gct(rt_buf)
- struct rogue_time *rt_buf;
+md_gct(struct rogue_time *rt_buf)
{
struct tm *t;
time_t seconds;
*/
void
-md_gfmt(fname, rt_buf)
- const char *fname;
- struct rogue_time *rt_buf;
+md_gfmt(const char *fname, struct rogue_time *rt_buf)
{
struct stat sbuf;
time_t seconds;
struct tm *t;
stat(fname, &sbuf);
- seconds = (long)sbuf.st_mtime;
+ seconds = sbuf.st_mtime;
t = localtime(&seconds);
rt_buf->year = t->tm_year;
*/
boolean
-md_df(fname)
- const char *fname;
+md_df(const char *fname)
{
if (unlink(fname)) {
return(0);
*/
const char *
-md_gln()
+md_gln(void)
{
struct passwd *p;
if (!(p = getpwuid(getuid())))
- return((char *)NULL);
- return(p->pw_name);
+ return NULL;
+ return p->pw_name;
}
/* md_sleep:
*/
void
-md_sleep(nsecs)
- int nsecs;
+md_sleep(int nsecs)
{
(void)sleep(nsecs);
}
*/
char *
-md_getenv(name)
- const char *name;
+md_getenv(const char *name)
{
char *value;
* when no more memory can be allocated.
*/
-char *
-md_malloc(n)
- int n;
+void *
+md_malloc(size_t n)
{
char *t;
*/
int
-md_gseed()
+md_gseed(void)
{
time_t seconds;
*/
void
-md_exit(status)
- int status;
+md_exit(int status)
{
exit(status);
}
*/
void
-md_lock(l)
- boolean l;
+md_lock(boolean l)
{
- static int fd;
+ static int fd = -1;
short tries;
if (l) {
if (!flock(fd, LOCK_EX|LOCK_NB))
return;
} else {
- (void)flock(fd, LOCK_NB);
+ (void)flock(fd, LOCK_UN|LOCK_NB);
(void)close(fd);
}
}
*/
void
-md_shell(shell)
- const char *shell;
+md_shell(const char *shell)
{
int w;
pid_t pid;
case -1:
break;
case 0:
- execl(shell, shell, (char *)0);
+ execl(shell, shell, (char *)NULL);
_exit(255);
default:
waitpid(pid, &w, 0);
}
}
-#endif
+#endif /* UNIX */