Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/memswitch Whitespace.
details: https://anonhg.NetBSD.org/src/rev/adb742a202ae
branches: trunk
changeset: 760863:adb742a202ae
user: minoura <minoura%NetBSD.org@localhost>
date: Fri Jan 14 13:31:47 2011 +0000
description:
Whitespace.
diffstat:
usr.sbin/memswitch/memswitch.c | 198 ++++++++++++++--------------
usr.sbin/memswitch/methods.c | 286 ++++++++++++++++++++--------------------
2 files changed, 242 insertions(+), 242 deletions(-)
diffs (truncated from 1180 to 300 lines):
diff -r ce0d2bddb9e8 -r adb742a202ae usr.sbin/memswitch/memswitch.c
--- a/usr.sbin/memswitch/memswitch.c Fri Jan 14 13:25:16 2011 +0000
+++ b/usr.sbin/memswitch/memswitch.c Fri Jan 14 13:31:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: memswitch.c,v 1.11 2011/01/14 13:25:16 minoura Exp $ */
+/* $NetBSD: memswitch.c,v 1.12 2011/01/14 13:31:47 minoura Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -63,10 +63,10 @@
void
usage(void)
{
- fprintf (stderr, "usage: %s -a\n", progname);
- fprintf (stderr, " %s [-h] variable ...\n", progname);
- fprintf (stderr, " %s -w variable=value ...\n", progname);
- fprintf (stderr, " %s [-rs] filename\n", progname);
+ fprintf(stderr, "usage: %s -a\n", progname);
+ fprintf(stderr, " %s [-h] variable ...\n", progname);
+ fprintf(stderr, " %s -w variable=value ...\n", progname);
+ fprintf(stderr, " %s [-rs] filename\n", progname);
exit(1);
}
@@ -112,7 +112,7 @@
if (argc == 0)
usage();
while (argv[0]) {
- show_single (argv[0]);
+ show_single(argv[0]);
argv++;
}
break;
@@ -128,13 +128,13 @@
modify_single (argv[0]);
argv++;
}
- flush ();
+ flush();
break;
case MD_HELP:
if (argc == 0)
usage();
while (argv[0]) {
- help_single (argv[0]);
+ help_single(argv[0]);
argv++;
}
break;
@@ -165,16 +165,16 @@
for (i = 0; i < number_of_props; i++) {
snprintf(fullname, sizeof(fullname), "%s.%s",
- properties[i].class, properties[i].node);
+ properties[i].class, properties[i].node);
if (strcmp(name, fullname) == 0 || strcmp(name, properties[i].class) == 0) {
- properties[i].print (&properties[i], valuestr);
+ properties[i].print(&properties[i], valuestr);
if (!nflag)
- printf ("%s=%s\n", fullname, valuestr);
+ printf("%s=%s\n", fullname, valuestr);
n++;
}
}
if (n == 0) {
- errx (1, "No such %s: %s", strstr(name, ".")?"property":"class", name);
+ errx(1, "No such %s: %s", strstr(name, ".")?"property":"class", name);
}
return;
@@ -187,11 +187,11 @@
char valuestr[MAXVALUELEN];
for (i = 0; i < number_of_props; i++) {
- properties[i].print (&properties[i], valuestr);
+ properties[i].print(&properties[i], valuestr);
if (!nflag)
- printf ("%s.%s=",
- properties[i].class, properties[i].node);
- printf ("%s\n", valuestr);
+ printf("%s.%s=",
+ properties[i].class, properties[i].node);
+ printf("%s\n", valuestr);
}
return;
@@ -213,27 +213,27 @@
l = i + 1;
class = alloca(l);
if (class == 0)
- err (1, "alloca");
- strncpy (class, expr, i);
+ err(1, "alloca");
+ strncpy(class, expr, i);
class[i] = 0;
break;
}
}
if (i >= n)
- errx (1, "Invalid expression: %s", expr);
+ errx(1, "Invalid expression: %s", expr);
for ( ; i < n; i++) {
if (expr[i] == '=') {
node = alloca(i - l + 1);
if (node == 0)
- err (1, "alloca");
- strncpy (node, &(expr[l]), i - l);
+ err(1, "alloca");
+ strncpy(node, &(expr[l]), i - l);
node[i - l] = 0;
break;
}
}
if (i >= n)
- errx (1, "Invalid expression: %s", expr);
+ errx(1, "Invalid expression: %s", expr);
value = &(expr[++i]);
@@ -243,14 +243,14 @@
if (properties[i].parse(&properties[i], value) < 0) {
/* error: do nothing */
} else {
- properties[i].print (&properties[i], valuestr);
+ properties[i].print(&properties[i], valuestr);
printf("%s.%s -> %s\n", class, node, valuestr);
}
break;
}
}
if (i >= number_of_props) {
- errx (1, "No such property: %s.%s", class, node);
+ errx(1, "No such property: %s.%s", class, node);
}
return;
@@ -268,16 +268,16 @@
snprintf(fullname, sizeof(fullname), "%s.%s",
properties[i].class, properties[i].node);
if (strcmp(name, fullname) == 0) {
- properties[i].print (&properties[i], valuestr);
+ properties[i].print(&properties[i], valuestr);
if (!nflag)
- printf ("%s=", fullname);
- printf ("%s\n", valuestr);
- printf ("%s", properties[i].descr);
+ printf("%s=", fullname);
+ printf("%s\n", valuestr);
+ printf("%s", properties[i].descr);
break;
}
}
if (i >= number_of_props) {
- errx (1, "No such property: %s", name);
+ errx(1, "No such property: %s", name);
}
return;
@@ -288,10 +288,10 @@
{
if (current_values == 0)
alloc_current_values();
- modified_values = malloc (256);
+ modified_values = malloc(256);
if (modified_values == 0)
- err (1, "malloc");
- memcpy (modified_values, current_values, 256);
+ err(1, "malloc");
+ memcpy(modified_values, current_values, 256);
}
void
@@ -302,71 +302,71 @@
int sramfd = 0;
struct sram_io buffer;
- current_values = malloc (256);
+ current_values = malloc(256);
if (current_values == 0)
- err (1, "malloc");
+ err(1, "malloc");
- sramfd = open (_PATH_DEVSRAM, O_RDONLY);
+ sramfd = open(_PATH_DEVSRAM, O_RDONLY);
if (sramfd < 0)
- err (1, "Opening %s", _PATH_DEVSRAM);
+ err(1, "Opening %s", _PATH_DEVSRAM);
/* Assume SRAM_IO_SIZE = n * 16. */
for (i = 0; i < 256; i += SRAM_IO_SIZE) {
buffer.offset = i;
- if (ioctl (sramfd, SIOGSRAM, &buffer) < 0)
- err (1, "ioctl");
- memcpy (¤t_values[i], buffer.sram, SRAM_IO_SIZE);
+ if (ioctl(sramfd, SIOGSRAM, &buffer) < 0)
+ err(1, "ioctl");
+ memcpy(¤t_values[i], buffer.sram, SRAM_IO_SIZE);
}
- close (sramfd);
+ close(sramfd);
#else
int i;
int fd;
struct stat st;
- current_values = malloc (256);
+ current_values = malloc(256);
if (current_values == 0)
- err (1, "malloc");
+ err(1, "malloc");
- fd = open (PATH_RAMFILE, O_RDONLY);
+ fd = open(PATH_RAMFILE, O_RDONLY);
if (fd < 0 && errno == ENOENT) {
- modified_values = malloc (256);
+ modified_values = malloc(256);
if (modified_values == 0)
- err (1, NULL);
+ err(1, NULL);
for (i = 0; i < number_of_props; i++) {
properties[i].modified_value
= properties[i].default_value;
properties[i].modified = 1;
- properties[i].flush (&properties[i]);
+ properties[i].flush(&properties[i]);
}
- fd = creat (PATH_RAMFILE, 0666);
+ fd = creat(PATH_RAMFILE, 0666);
if (fd < 0)
- err (1, "Creating %s", PATH_RAMFILE);
- if (write (fd, modified_values, 256) != 256)
- err (1, "Writing %s", PATH_RAMFILE);
- close (fd);
- free (modified_values);
+ err(1, "Creating %s", PATH_RAMFILE);
+ if (write(fd, modified_values, 256) != 256)
+ err(1, "Writing %s", PATH_RAMFILE);
+ close(fd);
+ free(modified_values);
modified_values = 0;
- fd = open (PATH_RAMFILE, O_RDONLY);
+ fd = open(PATH_RAMFILE, O_RDONLY);
}
if (fd < 0)
- err (1, "Opening %s", PATH_RAMFILE);
- if (fstat (fd, &st) < 0)
- err (1, "fstat");
+ err(1, "Opening %s", PATH_RAMFILE);
+ if (fstat(fd, &st) < 0)
+ err(1, "fstat");
if (st.st_size != 256)
- errx (1, "PANIC! INVALID RAMFILE");
- if (read (fd, current_values, 256) != 256)
- err (1, "reading %s", PATH_RAMFILE);
- close (fd);
+ errx(1, "PANIC! INVALID RAMFILE");
+ if (read(fd, current_values, 256) != 256)
+ err(1, "reading %s", PATH_RAMFILE);
+ close(fd);
#endif
- properties[PROP_MAGIC1].fill (&properties[PROP_MAGIC1]);
- properties[PROP_MAGIC2].fill (&properties[PROP_MAGIC2]);
+ properties[PROP_MAGIC1].fill(&properties[PROP_MAGIC1]);
+ properties[PROP_MAGIC2].fill(&properties[PROP_MAGIC2]);
if ((properties[PROP_MAGIC1].current_value.longword != MAGIC1) ||
(properties[PROP_MAGIC2].current_value.longword != MAGIC2))
- errx (1, "PANIC! INVALID MAGIC");
+ errx(1, "PANIC! INVALID MAGIC");
}
void
@@ -390,30 +390,30 @@
#ifndef DEBUG
/* Assume SRAM_IO_SIZE = n * 16. */
for (i = 0; i < 256; i += SRAM_IO_SIZE) {
- if (memcmp (¤t_values[i], &modified_values[i],
- SRAM_IO_SIZE) == 0)
+ if (memcmp(¤t_values[i], &modified_values[i],
+ SRAM_IO_SIZE) == 0)
continue;
if (sramfd == 0) {
- sramfd = open (_PATH_DEVSRAM, O_RDWR);
+ sramfd = open(_PATH_DEVSRAM, O_RDWR);
if (sramfd < 0)
- err (1, "Opening %s", _PATH_DEVSRAM);
+ err(1, "Opening %s", _PATH_DEVSRAM);
}
buffer.offset = i;
- memcpy (buffer.sram, &modified_values[i], SRAM_IO_SIZE);
- if (ioctl (sramfd, SIOPSRAM, &buffer) < 0)
- err (1, "ioctl");
+ memcpy(buffer.sram, &modified_values[i], SRAM_IO_SIZE);
+ if (ioctl(sramfd, SIOPSRAM, &buffer) < 0)
+ err(1, "ioctl");
Home |
Main Index |
Thread Index |
Old Index