Skip to content

Commit

Permalink
stdio: rename getc to getchar
Browse files Browse the repository at this point in the history
The function we have implemented as getc has the semantics of the
standard function getchar, so rename it accorgingly.

Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
saschahauer committed Apr 15, 2016
1 parent 70bbeea commit 01f8f60
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 32 deletions.
16 changes: 8 additions & 8 deletions arch/arm/mach-at91/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,49 +99,49 @@ static void boot_nand_barebox_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_nand(true);

getc();
getchar();
}

static void boot_nand_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_nand(false);

getc();
getchar();
}

static void boot_m25p80_barebox_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_nand(true);

getc();
getchar();
}

static void boot_m25p80_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_nand(false);

getc();
getchar();
}

static void boot_dataflash_barebox_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_dataflash(true);

getc();
getchar();
}

static void boot_dataflash_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_dataflash(false);

getc();
getchar();
}

static void boot_mmc_disk_action(struct menu *m, struct menu_entry *me)
{
at91bootstrap_boot_mmc();

getc();
getchar();
}

static void boot_reset_action(struct menu *m, struct menu_entry *me)
Expand Down Expand Up @@ -234,7 +234,7 @@ static int at91_bootstrap(void)
{
if (is_menu()) {
printf("press 'm' to start the menu\n");
if (tstc() && getc() == 'm')
if (tstc() && getchar() == 'm')
at91_bootstrap_menu();
}

Expand Down
2 changes: 1 addition & 1 deletion commands/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static void getwinsize(void)

printf(ESC "7" ESC "[r" ESC "[999;999H" ESC "[6n");

while ((r = getc()) != 'R') {
while ((r = getchar()) != 'R') {
buf[i] = r;
i++;
}
Expand Down
6 changes: 3 additions & 3 deletions commands/loads.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static int do_load_serial(int argc, char *argv[])
*/
for (i=0; i<100; ++i) {
if (tstc()) {
(void) getc();
(void) getchar();
}
udelay(1000);
}
Expand Down Expand Up @@ -142,7 +142,7 @@ static int read_record(char *buf, ulong len)
--len; /* always leave room for terminating '\0' byte */

for (p=buf; p < buf+len; ++p) {
c = getc(); /* read character */
c = getchar(); /* read character */
if (do_echo)
putchar(c);

Expand Down Expand Up @@ -180,7 +180,7 @@ static int do_save_serial(int argc, char *argv[])

printf ("## Ready for S-Record upload, press ENTER to proceed ...\n");
for (;;) {
if (getc() == '\r')
if (getchar() == '\r')
break;
}
if (save_serial(offset, size)) {
Expand Down
4 changes: 2 additions & 2 deletions commands/mmc_extcsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,14 +1867,14 @@ static int request_write_operation(void)
int c;

printf("This is a one time programmable field!\nDo you want to write? [y/N] ");
c = getc();
c = getchar();
/* default is N */
if (c == 0xD) {
printf("\n");
return 0;
}
printf("%c", c);
getc(); /* wait for carriage return */
getchar(); /* wait for carriage return */
printf("\n");
if (c == 'y' || c == 'Y')
return 1;
Expand Down
10 changes: 5 additions & 5 deletions common/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int console_set_baudrate(struct console_device *cdev, unsigned baudrate)
if (cdev->f_active) {
mdelay(50);
do {
c = getc();
c = getchar();
} while (c != '\r' && c != '\n');
}

Expand Down Expand Up @@ -345,7 +345,7 @@ static int tstc_raw(void)
return 0;
}

int getc(void)
int getchar(void)
{
unsigned char ch;
uint64_t start;
Expand Down Expand Up @@ -380,14 +380,14 @@ int getc(void)

return ch;
}
EXPORT_SYMBOL(getc);
EXPORT_SYMBOL(getchar);

int fgetc(int fd)
{
char c;

if (!fd)
return getc();
return getchar();
return read(fd, &c, 1);
}
EXPORT_SYMBOL(fgetc);
Expand Down Expand Up @@ -476,7 +476,7 @@ int ctrlc (void)
{
poller_call();

if (tstc() && getc() == 3)
if (tstc() && getchar() == 3)
return 1;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion common/console_countdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)

do {
if (tstc()) {
key = getc();
key = getchar();
if (flags & CONSOLE_COUNTDOWN_ANYKEY)
goto out;
if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
Expand Down
6 changes: 3 additions & 3 deletions common/console_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ int tstc(void)
}
EXPORT_SYMBOL(tstc);

int getc(void)
int getchar(void)
{
if (!console)
return -EINVAL;
return console->getc(console);
}
EXPORT_SYMBOL(getc);
EXPORT_SYMBOL(getchar);

void console_flush(void)
{
Expand All @@ -67,7 +67,7 @@ EXPORT_SYMBOL(console_flush);
/* test if ctrl-c was pressed */
int ctrlc (void)
{
if (tstc() && getc() == 3)
if (tstc() && getchar() == 3)
return 1;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion common/password.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int password(unsigned char *passwd, size_t length, int flags, int timeout)

do {
if (tstc()) {
ch = getc();
ch = getchar();

switch (ch) {
case '\r':
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/nand_imx_bbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static int do_imx_nand_bbm(int argc, char *argv[])
int c;

printf("create flash bbt (y/n)?");
c = getc();
c = getchar();
if (c == 'y')
yes = 1;
printf("\n");
Expand Down
4 changes: 2 additions & 2 deletions include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int tstc(void);

/* stdout */
void console_putc(unsigned int ch, const char c);
int getc(void);
int getchar(void);
int console_puts(unsigned int ch, const char *s);
void console_flush(void);

Expand All @@ -44,7 +44,7 @@ static inline int console_puts(unsigned int ch, const char *str)
return 0;
}

static inline int getc(void)
static inline int getchar(void)
{
return -EINVAL;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/readkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ int read_key(void)
{
char c;
char esc[5];
c = getc();
c = getchar();

if (c == 27) {
int i = 0;
esc[i++] = getc();
esc[i++] = getc();
esc[i++] = getchar();
esc[i++] = getchar();
if (isdigit(esc[1])) {
while(1) {
esc[i] = getc();
esc[i] = getchar();
if (esc[i++] == '~')
break;
if (i == ARRAY_SIZE(esc))
Expand Down
2 changes: 1 addition & 1 deletion lib/readline_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int readline (const char *prompt, char *line, int len)
show_activity(0);
}
#endif
c = getc();
c = getchar();

/*
* Special character handling
Expand Down

0 comments on commit 01f8f60

Please sign in to comment.