示例#1
0
int main(void) {
	say_hello();
	say_hello();
	return 0;
	
	
return 0;

}
示例#2
0
int main(int argc, char* argv[])
{
  if (argc > 1) {
    if ( 0 == strcmp("h", argv[1])) {
      say_hello();
    }
    else {
      say_bye();
    }
    return 0;
  }
  say_hello();
  say_bye();
  return 0;
}
示例#3
0
NTSTATUS my_ioctl_say_hello(PIRP Irp, PDEVICE_OBJECT deviceObject) {
	NTSTATUS status = STATUS_SUCCESS;

	DbgPrint("my_ioctl_say_hello called\n");
	DbgPrint("deviceObject=0x%08X\n", deviceObject);

	PDRIVER_OBJECT driver = deviceObject->DriverObject;
	PDEVICE_OBJECT device = driver->DeviceObject;
	DbgPrint("driver->DeviceObject=0x%08X\n", driver->DeviceObject);

	while (device) {
		PDEVICE_OBJECT currentDevice = device;
		DbgPrint("currentDevice=0x%08X\n", currentDevice);
		device = device->NextDevice;
		DbgPrint("NextDevice=0x%08X\n", device);

		device_extension_t* device_extension = (device_extension_t*) currentDevice->DeviceExtension;
		DbgPrint("device_extension->next=0x%08X\n", device_extension->next);
		if (device_extension->next) {
			status = say_hello(device_extension->next);
			if (status != STATUS_SUCCESS) {
				DbgPrint("0x%08X does not answer correctly\n", device_extension->next);
				goto cleanup;
			}
		}
	}

cleanup:
	Irp->IoStatus.Status = status;
	Irp->IoStatus.Information = 0;

	return status;
}
示例#4
0
文件: mti.1.c 项目: sudolee/sudolee
static int __init mti_init(void)
{
//    printk("%s : Hello world, i'm %s, :)\n", __func__, MTI_MODULE_VERSION);
    say_hello();

    return 0;
}
示例#5
0
文件: hello.c 项目: jkew/intheory
int main(int argc, char **args) {
  if (argc < 5) {
    printf("Usage: %s LOCAL_ADDRESS:LOCAL_PORT second_node:port third_node:port fourth_node:port ...\n", args[0]);
    printf("   ex: %s 10.0.0.1:4321 10.0.0.2:4321 10.0.0.3:4321 10.0.0.4:4321 ...\n", args[0]);
    return 1;
  }

  set_log_level(GRAPH);
  char * all_nodes[argc - 1];

  all_nodes[0] = args[1];
  int i = 1;
  for (; i < argc; i++) {
    all_nodes[i] = args[i + 1];
  }


  start_intheory(0, argc - 1, all_nodes);

  register_changed_cb(SLOT, got_hello);
  printf("MY ID: %d\n", my_id());
  if (my_id() == 0) {
    printf("I guess I'm the designated hello-er! Start your nodes!\n");
    sleep(5);
    say_hello();
  }

  while (hellos_received < 1) { sleep(1); }

  stop_intheory();
  return 0;
}
示例#6
0
int main(int argc, char * argv[])
{
	create_fifo();
	
	say_hello();
	
	fd_set *input_fd;
	FD_ZERO(input_fd);
	FD_SET(3,input_fd);
	FD_SET(4,input_fd);	

	int val;
	while (true)
	{
		select(2,input_fd,NULL,NULL,NULL);
		if (read(3,&val,4)==4)
		{
			printf("%d", val);
		} 
		else if (read(4,&val,4)==4)
		{
			printf("%d",val);
		}
		else
		{
			break;
		}
	}
}
示例#7
0
int main(int argc, char *argv[]) {
    if (argc > 1)
        say_hello(argv[1]);
    else
        printf("no one to say hello to...\n");
    return EXIT_SUCCESS;
}
示例#8
0
文件: tests.c 项目: moy/dumb-project
int main() { 
	int x = sum(2, 3);
	assert(x == 5);
	say_hello();
	printf("%d\n", x);
	assert(sub(3, 2) == 1);
	assert(f() == 42);
	return 0;
}
示例#9
0
int main(){
    const char* name="Test";
    say_hello(name);
    //say_hi(name);
    say_goodbye(name);
    //say_bye(name);
    puts(" test succeded ");
    return 0;
}
示例#10
0
文件: hello.c 项目: tjyang/abmon
/**
 * \brief  brief description
 * 
 * Detail description of main. 
 */
int main(void)
{

  setlocale (LC_ALL,"");
  bindtextdomain(PACKAGE,LOCALEDIR);
  textdomain(PACKAGE);
  /** use say_hello subroutine  to print hello */
  say_hello(); 
  return 0;
}
示例#11
0
int32_t main(int32_t argc, char* argv[])
{
  uint32_t addr = 0;
  int32_t arg;
  char* serial_path = NULL;
  for(arg = 1; arg < argc;)
  {
	if (strcmp(argv[arg],"-a") == 0)
	  sscanf(argv[arg+1],"%d",&addr);
	else if (strcmp(argv[arg],"-f") == 0)
	{
	  serial_path = (char*) malloc(40);
	  sscanf(argv[arg+1],"%s",serial_path);
	}
	arg = arg+2;
  }
  if ((addr == 0) || (serial_path == NULL))
  {
	printf(USAGE);
	return -1;
  }

  pup_context_t *context = new_pup_context(0,serial_path,9600,NULL,0);
  if (context == NULL)
  {
    printf("Could not create a new pup_context");
    free_pup_context(context);
  }

  if (connect_pup_context(context))
  {
    printf( "Could not connect to %s\nexiting\n", serial_path);
    free_pup_context(context);
    return -1;
  }
  if (say_hello(context, addr & 0xFFFF) == -1)
  {
    printf("Hello not acknowledged\n");
  } else 
  {
    printf("Hello acknowledged\n");
  }
  disconnect_pup_context(context);
  free_pup_context(context);
  return 0;
}
int main(int argc, char *argv[]) {

    int ret = 0;

    pthread_t pid_wait, pid_handle;

    ALOGI("%s mmi_diag start", __FUNCTION__);
    sem_init(&g_msg_sem, 0, 0);
    sem_init(&g_cmd_complete_sem, 0, 0);

    ret = diag_init();
    if(ret < 0)
        goto out;

    /** Connect to MMI server via socket*/
    g_sock = connect_server(MMI_SOCKET);
    if(g_sock < 0)
        goto out;

     /**Ready, say hello to server*/
    say_hello(g_sock, CLIENT_DIAG_NAME);

    ret = pthread_create(&pid_wait, NULL, msg_waiting_thread, &g_sock);
    if(ret < 0) {
        ALOGE("%s:Can't create msg waiting pthread: %s\n", __FUNCTION__, strerror(errno));
        goto out;
    }

    ret = pthread_create(&pid_handle, NULL, msg_handle_thread, NULL);
    if(ret < 0) {
        ALOGE("%s:Can't create msg handle pthread: %s\n", __FUNCTION__, strerror(errno));
        goto out;
    }

    pthread_join(pid_wait, NULL);
    pthread_join(pid_handle, NULL);

  out:
    ALOGI("%s: mmi diag exit to clear resource", __FUNCTION__);
    diag_deinit();
    sem_close(&g_msg_sem);
    sem_close(&g_cmd_complete_sem);
    exit(1);
}
示例#13
0
int main(int argc, char** argv) {

    init_parser();

    /* initialize environment */
    lenv* e = lenv_new();
    lenv_add_builtins(e);

    /* load standard library functions */
    lval* x = builtin_load(e, lval_add(lval_sexpr(), lval_str("prelude.lsp")));
    if (x->type == LVAL_ERR) { lval_println(x); }
    lval_del(x);

    if (argc >= 2) {

        /* read from command line */
        parse_args(e, argc, argv);

    } else {

        /* interactive prompt */
        say_hello();
        while (1) {
            char* input = prompt();
            lval* x = parse(input);
            if (x != NULL) {
                x = lval_eval(e, x);
                lval_println(x);
                lval_del(x);
            }
            free(input);
        }

    }

    /* cleanup */
    lenv_del(e);
    free_parser();

    return 0;
}
示例#14
0
int main()
{
    

    int foo = 0x41414141;
    int * foo_ptr;
    foo_ptr = &foo;

    say_hello();

    if(*foo_ptr == 8)
    {
        printf("You win!\n");
    }
    else
    {
        printf("You lose\n");
    }

    return 0;
}
示例#15
0
文件: foo.c 项目: Baloo81/edu
int main(int argc, char *argv[])
{
  say_hello();
  return 0;
}
示例#16
0
int main(void)
{
    printf("%s\n", say_hello());
    return 0;
}
int main(int argc, char **argv)
{
	say_hello();
}
示例#18
0
int main() {
    signal(SIGSEGV, print_stack_frames);
    say_hello();
}
示例#19
0
文件: say_hello.c 项目: cpalumbo/cs50
int main(void)
{
    say_hello("Chris");
    
    return 0;
}
示例#20
0
文件: main.c 项目: sdhanru/code
int main()
{
    say_hello();
}
示例#21
0
int main() {
  say_hello();
  return 0;
}
示例#22
0
int init_serial (char * port){

	// Attempt to open port

	printf("Attempting to open %s...\n", port);

	if ((dev = fopen(port, "r+b"))){

        int dev_fd = fileno(dev);
        
        // Set stream to not block when reading
        fcntl(dev_fd, F_SETFL, O_NONBLOCK);
        int flags = fcntl(dev_fd, F_GETFL);

        // Set baud rate to 34800
        struct termios devConfig;
        tcgetattr(dev_fd, &devConfig);
        cfsetspeed(&devConfig, B38400);
        int baudSet = tcsetattr(dev_fd, TCSANOW, &devConfig);

        if (!(flags & O_NONBLOCK) || baudSet){

            printf("ERROR: Failed to open port.\n");
            return -1;
        }
        
        printf("%s opened successfully.\n", port);
        
        // Wait for handshake

        printf("Waiting for \"Hello\"... ");
        packet * in_shake;

        int i = 0;
        while ((!(in_shake = read_serial()) ||
               ((in_shake->type) != PKT_HELLO)) &&
               (i < 10)){
            i++;
            sleep(1);
        }
        if(i == 10)
            return -1;
        
        printf("\"Hello\" received.\n");

        int j = 0;
        while ((!(in_shake = read_serial()) ||
               ((in_shake->type) != PKT_RDY)) &&
               (j < 10)){
            j++;
            say_hello();
            sleep(1);
        }
        if(i == 10)
            return -1;

        printf("Mongol is Ready!\n");

        return 0;
	}
            
    printf("ERROR: Failed to open port.\n");
    return -1;
}
示例#23
0
文件: hello.c 项目: Deividy/lab
int main () {
    char* name = "Deividy";

    say_hello(name);
    printf("May the force be with you.\n");
}
int main() {
  char *now = get_time();
  say_hello(now);
  return 0;
}