static void logger_command_line(const struct logger_ctl *ctl, char **argv) { /* note: we never re-generate the syslog header here, even if we * generate multiple messages. If so, we think it is the right thing * to do to report them with the same timestamp, as the user actually * intended to send a single message. */ char *const buf = xmalloc(ctl->max_message_size + 1); char *p = buf; const char *endp = buf + ctl->max_message_size - 1; size_t len; while (*argv) { len = strlen(*argv); if (endp < p + len && p != buf) { write_output(ctl, buf); p = buf; } if (ctl->max_message_size < len) { (*argv)[ctl->max_message_size] = '\0'; /* truncate */ write_output(ctl, *argv++); continue; } if (p != buf) *p++ = ' '; memmove(p, *argv++, len); *(p += len) = '\0'; } if (p != buf) write_output(ctl, buf); free(buf); }
static void clear_program_state_action (Widget w, XtPointer client_data, XtPointer call_data) { long clear_op = (long) client_data; switch (clear_op) { case CLEAR_REGS: write_output (message_out, "Registers cleared\n\n"); initialize_registers (); break; case CLEAR_MEM_REGS: write_output (message_out, "Memory and registers cleared\n\n"); initialize_world (load_exception_handler ? exception_file_name : NULL); write_startup_message (); break; case CLEAR_CONSOLE: write_output (message_out, "Console display cleared\n\n"); clear_console_display (); break; default: fatal_error("Unknown action: %d\n", clear_op); } redisplay_text (); redisplay_data (); }
char write_opcodes (void) { char err; opcs = get_opcodes(); if (pass == 1) { addr = addr + opcs; return; } if (pass==2) { if (opcs == 0) { opc0 = get_opcode0(); err = write_output(addr,0,(unsigned char *)file_line,line); } if (opcs == 1) { opc0 = get_opcode0(); err = write_output(addr,opc0,(unsigned char *)file_line,line); addr++; } if (opcs == 2) { opc0 = get_opcode0(); opc1 = get_opcode1(); err = write_output(addr,opc0,(unsigned char *)file_line,line); addr++; err = write_output(addr,opc1,(unsigned char *)"",line); addr++; } } return err; }
static void lasikbd_leds(unsigned char leds) { int loop = 1000; if (!lasikbd_hpa) return; cmd_status=2; while (cmd_status!=0 && --loop > 0) { write_output(KBD_CMD_SET_LEDS, lasikbd_hpa); mdelay(5); } cmd_status=2; while (cmd_status!=0 && --loop > 0) { write_output(leds, lasikbd_hpa); mdelay(5); } cmd_status=2; while (cmd_status!=0 && --loop > 0) { write_output(KBD_CMD_ENABLE, lasikbd_hpa); mdelay(5); } if (loop <= 0) printk("lasikbd_leds: timeout\n"); }
static void mmap_read(struct mmap_data *md) { unsigned int head = mmap_read_head(md); unsigned int old = md->prev; unsigned char *data = md->base + page_size; unsigned long size; void *buf; int diff; gettimeofday(&this_read, NULL); /* * If we're further behind than half the buffer, there's a chance * the writer will bite our tail and mess up the samples under us. * * If we somehow ended up ahead of the head, we got messed up. * * In either case, truncate and restart at head. */ diff = head - old; if (diff < 0) { struct timeval iv; unsigned long msecs; timersub(&this_read, &last_read, &iv); msecs = iv.tv_sec*1000 + iv.tv_usec/1000; fprintf(stderr, "WARNING: failed to keep up with mmap data." " Last read %lu msecs ago.\n", msecs); /* * head points to a known good entry, start there. */ old = head; } last_read = this_read; if (old != head) samples++; size = head - old; if ((old & md->mask) + size != (head & md->mask)) { buf = &data[old & md->mask]; size = md->mask + 1 - (old & md->mask); old += size; write_output(buf, size); } buf = &data[old & md->mask]; size = head - old; old += size; write_output(buf, size); md->prev = old; mmap_write_tail(md, old); }
void go() override { std::unique_ptr<Botan::Private_Key> key; std::string pass_in = get_arg("pass-in"); if (pass_in.empty()) { key.reset(Botan::PKCS8::load_key(get_arg("key"), rng())); } else { key.reset(Botan::PKCS8::load_key(get_arg("key"), rng(), pass_in)); } const std::chrono::milliseconds pbe_millis(get_arg_sz("pbe-millis")); const std::string pbe = get_arg("pbe"); const bool der_out = flag_set("der-out"); if(flag_set("pub-out")) { if(der_out) { write_output(Botan::X509::BER_encode(*key)); } else { output() << Botan::X509::PEM_encode(*key); } } else { const std::string pass_out = get_arg("pass-out"); if(der_out) { if(pass_out.empty()) { write_output(Botan::PKCS8::BER_encode(*key)); } else { write_output(Botan::PKCS8::BER_encode(*key, rng(), pass_out, pbe_millis, pbe)); } } else { if(pass_out.empty()) { output() << Botan::PKCS8::PEM_encode(*key); } else { output() << Botan::PKCS8::PEM_encode(*key, rng(), pass_out, pbe_millis, pbe); } } } }
void list_breakpoints () { bkpt *b; if (bkpts) for (b = bkpts; b != NULL; b = b->next) write_output (message_out, "Breakpoint at 0x%08x\n", b->addr); else write_output (message_out, "No breakpoints set\n"); }
static WRITE8_HANDLER( firetrk_out_w ) { if (GAME_IS_FIRETRUCK || GAME_IS_MONTECARLO) { write_output(data); } if (GAME_IS_SUPERBUG) { write_output(offset); } }
int main(int argc, char *argv[]) { bool success = true; if (argc < 3) { std::cerr << "Syntax error: use" << std::endl; std::cerr << argv[0] << " classname inputpath" << std::endl; return 1; } std::string modname(argv[1]); std::string inputpath(argv[2]); std::string ifname = inputpath + std::string("/") + modname + std::string("_tests.un"); std::string impl_fname = modname + std::string("_test_impls-tmp.F90"); std::string calls_fname = modname + std::string("_test_calls.F90"); std::string list_fname = modname + std::string("_tests.tests"); std::string mpilist_fname = modname + std::string("_tests.mpitests"); std::vector<std::string> input, output; try { success = success && read_template(ifname, input); success = success && replace_modname(modname, input); success = success && parse_impl(ifname, input, output); success = success && write_output(impl_fname, output); output.clear(); success = success && parse_calls(ifname, input, output); success = success && write_output(calls_fname, output); output.clear(); success = success && parse_list(ifname, input, output); success = success && write_output(list_fname, output); output.clear(); success = success && parse_mpilist(ifname, input, output); success = success && write_output(mpilist_fname, output); output.clear(); } catch (ParserException &ex) { std::cerr << "Caught exception: " << ex.getMsg() << std::endl; success = false; } catch (std::string &ex) { std::cerr << "Caught exception: " << ex << std::endl; success = false; } catch (...) { std::cerr << "Caught unknown exception." << std::endl; success = false; } return (success ? 0 : 1); }
int run(int argc, const char** argv) { options opts; if(int err = parse_options(argc, argv, opts)) { return err; } if(opts.output_path.value() == eagine::cstr_ref("-")) { write_output(std::cout, opts); } else { std::ofstream output_file(opts.output_path.value().c_str()); write_output(output_file, opts); } return 0; }
static void mp3_close(void) { if (output_file) { int imp3, encout; /* write remaining mp3 data */ encout = lame_encode_flush_nogap(gfp, encbuffer, LAME_MAXMP3BUFFER); write_output(encbuffer, encout); /* set gfp->num_samples for valid TLEN tag */ lame_set_num_samples(gfp, numsamples); /* append v1 tag */ imp3 = lame_get_id3v1_tag(gfp, encbuffer, sizeof(encbuffer)); if (imp3 > 0) write_output(encbuffer, imp3); /* update v2 tag */ imp3 = lame_get_id3v2_tag(gfp, encbuffer, sizeof(encbuffer)); if (imp3 > 0) { if (vfs_fseek(output_file, 0, SEEK_SET) != 0) { AUDDBG("can't rewind\n"); } else { write_output(encbuffer, imp3); } } /* update lame tag */ if (id3v2_size) { if (vfs_fseek(output_file, id3v2_size, SEEK_SET) != 0) { AUDDBG("fatal error: can't update LAME-tag frame!\n"); } else { imp3 = lame_get_lametag_frame(gfp, encbuffer, sizeof(encbuffer)); write_output(encbuffer, imp3); } } } g_free (write_buffer); lame_close(gfp); AUDDBG("lame_close() done\n"); free_lameid3(&lameid3); numsamples = 0; }
/* State function */ static int read_file(struct connection *conn) { size_t bytes; bytes = conn->endp - conn->curp; if (bytes > 0) { if (!write_output(conn, bytes)) return 1; conn->length -= bytes; if (conn->length <= 0) { if (verbose) printf("OK %s\n", conn->url); if (conn->regexp && !conn->matched) return do_process_html(conn); close_connection(conn); return 0; } } else { printf("Read file problems %zu for %s!\n", bytes, conn->url); return 1; } reset_buf(conn); return 0; }
static void mp3_write(void *ptr, gint length) { gint encoded; if (write_buffer_size == 0) { write_buffer_size = 8192; write_buffer = g_realloc (write_buffer, write_buffer_size); } RETRY: if (input.channels == 1) encoded = lame_encode_buffer (gfp, ptr, ptr, length / 2, write_buffer, write_buffer_size); else encoded = lame_encode_buffer_interleaved (gfp, ptr, length / 4, write_buffer, write_buffer_size); if (encoded == -1) { write_buffer_size *= 2; write_buffer = g_realloc (write_buffer, write_buffer_size); goto RETRY; } if (encoded > 0) write_output (write_buffer, encoded); numsamples += length / (2 * input.channels); }
int main(int argc, char *argv[]) { PetscErrorCode ierr; params params; Mat H; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscPrintf(PETSC_COMM_WORLD,"--------------------------------------------------------------------------------------\n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," _______ __ __ _______ _______ ______ _______ \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," |__ __| \\/ |/ ____\\ \\ / /_ _| ____|__ __| \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," | | | \\ / | (___ \\ \\ /\\ / / | | | |__ | | \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," | | | |\\/| |\\___ \\ \\ \\/ \\/ / | | | __| | | \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," | | | | | |____) | \\ /\\ / _| |_| | | | \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," |_| |_| |_|_____/ \\/ \\/ |_____|_| |_| \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," True Muonium Solver with Iterative Front-Form Techniques \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," \n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"--------------------------------------------------------------------------------------\n");CHKERRQ(ierr); read_input(ierr,argv,¶ms); print_input(ierr,¶ms); if(check_file(params.hfile)) { PetscViewer viewer_H; PetscViewerBinaryOpen(PETSC_COMM_WORLD,params.hfile.c_str(),FILE_MODE_READ,&viewer_H); MatCreate(PETSC_COMM_WORLD,&H); MatSetFromOptions(H); MatLoad(H,viewer_H); PetscViewerDestroy(&viewer_H); }else { discretize(ierr,¶ms); // ierr = VecView(params.mu,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr); // ierr = VecView(params.theta,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr); write_output(ierr,¶ms); coulomb_trick(ierr,¶ms); // ierr = VecView(params.CT,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr); ct_discrete(ierr,¶ms); // ierr = VecView(params.CT,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr); hamiltonian(ierr,¶ms,H); // ierr = PetscViewerSetFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_DENSE);//DENSE<-->COMMON // MatView(H,PETSC_VIEWER_STDOUT_WORLD); } cleanup(ierr,¶ms); eigensolver(ierr,¶ms,H,argc,argv); ierr = MatDestroy(&H);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; }
/** Reads an skp file, renders it to pdf and writes the output to a pdf file * @param inputPath The skp file to be read. * @param outputDir Output dir. * @param renderer The object responsible to render the skp object into pdf. */ static bool render_pdf(const SkString& inputPath, const SkString& outputDir, sk_tools::PdfRenderer& renderer) { SkString inputFilename; sk_tools::get_basename(&inputFilename, inputPath); SkFILEStream inputStream; inputStream.setPath(inputPath.c_str()); if (!inputStream.isValid()) { SkDebugf("Could not open file %s\n", inputPath.c_str()); return false; } bool success = false; SkAutoTUnref<SkPicture> picture(SkNEW_ARGS(SkPicture, (&inputStream, &success))); if (!success) { SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); return false; } SkDebugf("exporting... [%i %i] %s\n", picture->width(), picture->height(), inputPath.c_str()); renderer.init(picture); renderer.render(); success = write_output(outputDir, inputFilename, renderer); renderer.end(); return success; }
int main( int argc, char *argv[] ) { if ( argc != 2 ) { std::cout << "usage: " << argv[0] << " N " << "\n"; return 1; } int N = atoi( argv[1] ); assert( N > 1 ); double h = N / 100.0; double y = 1; std::ofstream write_output("xy.dat"); assert(write_output.is_open()); write_output.setf(std::ios::scientific); write_output.setf(std::ios::showpos); write_output.precision(4); for ( double i = 0; i < N; i += h ) { y += h * (-i); write_output << i << " " << y << "\n"; } write_output << "\n"; write_output.flush(); write_output.close(); return 0; }
int main(int argc, char *argv[]) { FILE *input = NULL; FILE *output = NULL; Edges edges = {0, NULL} ; double *shapley = NULL; long kernel_time = 0; long summary_time = 0; int n; Adjacency *adjacency; input = safeFopen(argv[1], "r"); output = safeFopen(argv[2], "w"); read_input(input, &edges); n = number_of_vertices(&edges); shapley = (double *) safeMalloc(n * sizeof(double)); adjacency = createAdjacency(n, &edges, n); compute_shapley(adjacency, n, shapley, function, &kernel_time, &summary_time); write_output(n, shapley, output); print_time("kernel", kernel_time); print_time("summary", summary_time); releaseAdjacency(adjacency); free(shapley); free(edges.list); fclose(input); fclose(output); return 0; }
static int decipher(struct sc_pkcs15_object *obj) { u8 buf[1024], out[1024]; int r, c, len; if (opt_input == NULL) { fprintf(stderr, "No input file specified.\n"); return 2; } c = read_input(buf, sizeof(buf)); if (c < 0) return 2; len = sizeof(out); if (!((struct sc_pkcs15_prkey_info *) obj->data)->native) { fprintf(stderr, "Deprecated non-native key detected! Upgrade your smart cards.\n"); return SC_ERROR_NOT_SUPPORTED; } r = sc_pkcs15_decipher(p15card, obj, opt_crypt_flags & SC_ALGORITHM_RSA_PAD_PKCS1, buf, c, out, len); if (r < 0) { fprintf(stderr, "Decrypt failed: %s\n", sc_strerror(r)); return 1; } r = write_output(out, r); return 0; }
static void vorbis_close(void) { vorbis_write_real (NULL, 0); /* signal end of file */ while (ogg_stream_flush (& os, & og)) { write_output (og.header, og.header_len); write_output (og.body, og.body_len); } ogg_stream_clear(&os); vorbis_block_clear(&vb); vorbis_dsp_clear(&vd); vorbis_info_clear(&vi); }
unsigned char compiler_core (void) { line_position = find_next_substring((unsigned char*)file_line, 0); //and find first word if (line_position>0) //where is it? { if (line_position<255) { //this is instruction - outside first row error = E_OK; if (file_line[line_position]>' ') {//non-empty line token_len = get_next_token((unsigned char *)file_line,(unsigned char *) token, 0); //take opcode if ((token_len>0)&(token_len<255)) //if valid { if (token[0]!='#') { if (pass==2) { replaced = replace_objects((unsigned char *)file_line,(unsigned char *)file_line2,line_position+token_len); if (replaced==255) error = E_DEF_UNKNOWN; strcpy((char *)file_line,(char *) file_line2); } if ((error == E_OK)|(pass==1)) { token_len = get_next_token((unsigned char *)file_line,(unsigned char *) token, 0); //take opcode opcode_jump(); } } else { pseudoopcode_jump(); } } else error = E_UNKNOWN_OPCODE; if (error==E_OK) { if (write_opcodes()!=0) error = E_FILE_ERROR; } else { write_output(0xFFFF,error,(unsigned char *)file_line,line); } } } } else {//this is label, first row if (pass==1) { token_len = get_next_token((unsigned char *)file_line,(unsigned char *) token, 0); //take label name if (token_len>0) { dt_pointer = update_deftable_num((unsigned char *)token, addr); if (dt_pointer > ((DEFATABLE_LEN/TABLE_ENTRY_LEN)-2)) return E_DEFTAB_OVER; } } } return error; }
void put_console_char(char c) { char buf[4]; buf[0] = c; buf[1] = '\0'; write_output(console_out, buf); }
int main(int argc, char *argv[]) { int ret_value = 0; libettercap_init(PROGRAM, EC_VERSION); ef_globals_alloc(); select_text_interface(); libettercap_ui_init(); /* etterfilter copyright */ USER_MSG("\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n", PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS); /* initialize the line number */ EF_GBL->lineno = 1; /* getopt related parsing... */ parse_options(argc, argv); /* set the input for source file */ if (EF_GBL_OPTIONS->source_file) { yyin = fopen(EF_GBL_OPTIONS->source_file, "r"); if (yyin == NULL) FATAL_ERROR("Input file not found !"); } else { FATAL_ERROR("No source file."); } /* no buffering */ setbuf(yyin, NULL); setbuf(stdout, NULL); setbuf(stderr, NULL); /* load the tables in etterfilter.tbl */ load_tables(); /* load the constants in etterfilter.cnt */ load_constants(); /* print the message */ USER_MSG("\n Parsing source file \'%s\' ", EF_GBL_OPTIONS->source_file); ef_debug(1, "\n"); /* begin the parsing */ if (yyparse() == 0) USER_MSG(" done.\n\n"); else USER_MSG("\n\nThe script contains errors...\n\n"); /* write to file */ ret_value = write_output(); if (ret_value == -E_NOTHANDLED) FATAL_ERROR("Cannot write output file (%s): the filter is not correctly handled.", EF_GBL_OPTIONS->output_file); else if (ret_value == -E_INVALID) FATAL_ERROR("Cannot write output file (%s): the filter format is not correct. ", EF_GBL_OPTIONS->output_file); ef_exit(0); }
static int init_keyb(unsigned long hpa) { int res = 0; unsigned long flags; spin_lock_irqsave(&kbd_controller_lock, flags); if (write_output(KBD_CMD_SET_LEDS, hpa) && wait_input(hpa) == AUX_REPLY_ACK && write_output(0, hpa) && wait_input(hpa) == AUX_REPLY_ACK && write_output(KBD_CMD_ENABLE, hpa) && wait_input(hpa) == AUX_REPLY_ACK) res = 1; spin_unlock_irqrestore(&kbd_controller_lock, flags); return res; }
static int sign(struct sc_pkcs15_object *obj) { u8 buf[1024], out[1024]; struct sc_pkcs15_prkey_info *key = (struct sc_pkcs15_prkey_info *) obj->data; int r, c, len; if (opt_input == NULL) { fprintf(stderr, "No input file specified.\n"); return 2; } c = read_input(buf, sizeof(buf)); if (c < 0) return 2; len = sizeof(out); if (obj->type == SC_PKCS15_TYPE_PRKEY_RSA && !(opt_crypt_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && (size_t)c != key->modulus_length/8) { fprintf(stderr, "Input has to be exactly %lu bytes, when using no padding.\n", (unsigned long) key->modulus_length/8); return 2; } if (!key->native) { fprintf(stderr, "Deprecated non-native key detected! Upgrade your smart cards.\n"); return SC_ERROR_NOT_SUPPORTED; } r = sc_pkcs15_compute_signature(p15card, obj, opt_crypt_flags, buf, c, out, len); if (r < 0) { fprintf(stderr, "Compute signature failed: %s\n", sc_strerror(r)); return 1; } len = r; if (obj->type == SC_PKCS15_TYPE_PRKEY_EC) { if (opt_sig_format && (!strcmp(opt_sig_format, "openssl") || !strcmp(opt_sig_format, "sequence"))) { unsigned char *seq; size_t seqlen; if (sc_asn1_sig_value_rs_to_sequence(ctx, out, len, &seq, &seqlen)) { fprintf(stderr, "Failed to convert signature to ASN1 sequence format.\n"); return 2; } memcpy(out, seq, seqlen); len = seqlen; free(seq); } } r = write_output(out, len); return r; }
void go() override { const std::string algo = get_arg("algo"); const std::string params = get_arg("params"); std::unique_ptr<Botan::Private_Key> key(Botan::create_private_key(algo, rng(), params)); if(!key) { throw CLI_Error_Unsupported("keygen", algo); } const std::string pass = get_arg("passphrase"); const bool der_out = flag_set("der-out"); const std::chrono::milliseconds pbe_millis(get_arg_sz("pbe-millis")); const std::string pbe = get_arg("pbe"); if(der_out) { if(pass.empty()) { write_output(Botan::PKCS8::BER_encode(*key)); } else { write_output(Botan::PKCS8::BER_encode(*key, rng(), pass, pbe_millis, pbe)); } } else { if(pass.empty()) { output() << Botan::PKCS8::PEM_encode(*key); } else { output() << Botan::PKCS8::PEM_encode(*key, rng(), pass, pbe_millis, pbe); } } }
int main(int argc, char* argv[]) { const Parameters* par = new Parameters(argc, argv); Community* community = build_community(par); vector<int> initial_susceptibles = community->getNumSusceptible(); seed_epidemic(par, community); simulate_epidemic(par, community); write_output(par, community, initial_susceptibles); return 0; }
void error(char *fmt, ...) { va_list args; char io_buffer [IO_BUFFSIZE]; va_start (args, fmt); vsprintf (io_buffer, fmt, args); va_end (args); write_output(message_out, io_buffer); }
static void write_event(event_t *buf, size_t size) { /* * Add it to the list of DSOs, so that when we finish this * record session we can pick the available build-ids. */ if (buf->header.type == PERF_RECORD_MMAP) dsos__findnew(buf->mmap.filename); write_output(buf, size); }
void compile_repo() { auto ues = load_input(); std::cout << folly::format("{} units\n", ues.size()); ues = whole_program(std::move(ues)); { trace_time timer("writing output repo"); write_output(std::move(ues)); } }
static void logger_stdin(struct logger_ctl *ctl) { int default_priority = ctl->pri; int last_pri = default_priority; size_t max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); char *const buf = xmalloc(max_usrmsg_size + 2 + 2); int pri; int c; size_t i; c = getchar(); while (c != EOF) { i = 0; if (ctl->prio_prefix) { if (c == '<') { pri = 0; buf[i++] = c; while (isdigit(c = getchar()) && pri <= 191) { buf[i++] = c; pri = pri * 10 + c - '0'; } if (c != EOF && c != '\n') buf[i++] = c; if (c == '>' && 0 <= pri && pri <= 191) { /* valid RFC PRI values */ i = 0; if (pri < 8) pri |= 8; /* kern facility is forbidden */ ctl->pri = pri; } else ctl->pri = default_priority; if (ctl->pri != last_pri) { generate_syslog_header(ctl); max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); last_pri = ctl->pri; } if (c != EOF && c != '\n') c = getchar(); } } while (c != EOF && c != '\n' && i < max_usrmsg_size) { buf[i++] = c; c = getchar(); } buf[i] = '\0'; if (i > 0 || !ctl->skip_empty_lines) write_output(ctl, buf); if (c == '\n') /* discard line terminator */ c = getchar(); } }