From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) by mx.groups.io with SMTP id smtpd.web11.45960.1656357422893877933 for ; Mon, 27 Jun 2022 12:17:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WPx1lJ8a; spf=pass (domain: gmail.com, ip: 209.85.166.177, mailfrom: ayushdevel1325@gmail.com) Received: by mail-il1-f177.google.com with SMTP id p9so6396571ilj.7 for ; Mon, 27 Jun 2022 12:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=KcwsBwPgHIIGTOEO6tFbHMGn0krmyiPHLYo0mzmerqY=; b=WPx1lJ8atgGCZ4r0ptMHeJp8VU+zxSdn0mnPOlvI5wrjqnLrWq89ECuMWEoXQWRrVs Q6Ztpwl3vqF6hVmOmHob42hd0tw1Yyo0wZqovqizUSjN/PL4fMieKW88IPWNYNI+kKAu 606end9n0cqOIsToe+vrsMKIzQ/R7bI0trn3cdSoi/1WbNccX3RYBMMNhV0nef12mcjW YbuQ2W79kaGJtgd8t+homuByqqpqGPWx3/4qkPn07fPqQZU0jIdoxpXBpGuspZ/KP30G 2R/8m00QN7/V9OIQ5nHAwlOUOIwoJPIpisi9w2SmzUjHMaEQPYvqNFENLu6HuPm/jQP2 yc0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=KcwsBwPgHIIGTOEO6tFbHMGn0krmyiPHLYo0mzmerqY=; b=rGwA5c6IoveyX9OETnNraS+n0H31pj3xNLEItPY8RdETMRHasswCAUqthDzgA4qQRz F/WhGzdAWFGiXkt2/9YTxBry+IPRXgq4HLn4a8sWcWl3q7cxd+Ocfuvv9GjQx+KzVlet 8WAyJp52X+avb7hPksbJXqyZp5kbAQ3G3RJWjqShI0ePaHM2/sltyvdSrgL8gKUjvpjE uOcS5dCEu2fajzwYYzI7NmlzqhrqnYWtLTA70jI830j7foaE+BnXKdMYvqWXfGjlZLlz Uyh7HdfLYf2+VOrfffJm4BMJfW7f/2lvmDa8m/TwfdBDIJNqgRQelX4ddk7ZgCVRpSm8 HYuA== X-Gm-Message-State: AJIora/jFK9hWQ1LrQDFvkRKHWe+OCW5F2AJS/EtHFCFA16BHwuBqDJP GH9Uw8jkESGy4XfqiZsRfzQVIdf0dKIIl8zu3Nnf8vgLZVUYgw== X-Google-Smtp-Source: AGRyM1ubPkljy3uniBp6Mg/ER0GSZFKNgrC+zmCH5Aez5K9GVkrnVCI3FOsG3u9/n56z4Ai/gR9bNiz22zTGYKpJzg0= X-Received: by 2002:a05:6e02:154a:b0:2da:8a02:bcba with SMTP id j10-20020a056e02154a00b002da8a02bcbamr5092787ilu.167.1656357422194; Mon, 27 Jun 2022 12:17:02 -0700 (PDT) MIME-Version: 1.0 From: "Ayush Singh" Date: Tue, 28 Jun 2022 00:47:08 +0530 Message-ID: Subject: Dealing with CRLF in Rust printing To: edk2-devel-groups-io Cc: Michael Kubacki , michael.d.kinney@intel.com, jabeena.b.gaibusab@intel.com, Jiewen Yao Content-Type: text/plain; charset="UTF-8" Hello everyone, I have been somewhat successful in implementing Rust stdio for UEFI. This means it is now possible to do things like this: ```rust let s = 10; println!("ConOut: {}", s); eprintl!("StdErr: {}", s); ``` However, Rust uses LF on all platforms currently, which means that the `println!`, `eprintln!` and other macros only output LF at the end. After discussion in zulipchat [1], it seems that rather than changing the macro, it would be better to change what is printed as output. This means changing: `\n` to `\r\n`, when we go for printing to screen. Note: This means that the LF will be changed to CRLF only when using stdio and not when writing to say an external file. Firstly, I wanted to ask other people's opinions about doing this. Secondly, I wanted to ask if `\r\r\n` is the same as `\r\n` or if the extra CR should be trimmed. Ayush Singh [1]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.60println!.60.20for.20CRLF.20console