syslinux/com32/samples/fancyhello.c
<<
>>
Prefs
   1
   2/* ----------------------------------------------------------------------- *
   3 *
   4 *   Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
   5 *
   6 *   This program is free software; you can redistribute it and/or modify
   7 *   it under the terms of the GNU General Public License as published by
   8 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
   9 *   Boston MA 02111-1307, USA; either version 2 of the License, or
  10 *   (at your option) any later version; incorporated herein by reference.
  11 *
  12 * ----------------------------------------------------------------------- */
  13
  14/*
  15 * fancyhello.c
  16 *
  17 * Hello, World! using libcom32 and ANSI console; also possible to compile
  18 * as a Linux application for testing.
  19 */
  20
  21#include <string.h>
  22#include <stdio.h>
  23
  24#include <consoles.h>           /* Provided by libutil */
  25
  26int main(void)
  27{
  28    char buffer[1024];
  29
  30    console_ansi_std();
  31
  32    printf("\033[1;33;44m *** \033[37mHello, World!\033[33m *** \033[0m\n");
  33
  34    for (;;) {
  35        printf("\033[1;36m>\033[0m ");
  36        fgets(buffer, sizeof buffer, stdin);
  37        if (!strncmp(buffer, "exit", 4))
  38            break;
  39        printf("\033[1m:\033[0m %s", buffer);
  40    }
  41    return 0;
  42}
  43
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.