crossystem: Fix cros_debug detection on non-chrome systems.

"cros_debug" is usually the last token of kernel command line on UEFI/legacy
BIOS systems.

However, kernel command line may end with new line ("\n") and that may cause
strcmp to fail (i.e., can't detect "cros_debug" if it's the last parameter in
command line), so we need to add that into strtok delimiters.

BRANCH=none
BUG=chromium:222248
TEST=crossystem cros_debug # display 1 on UEFI system with cros_debug

Change-Id: I9aed1562291469118acbadcc5211ff5c45eb9feb
Reviewed-on: https://gerrit.chromium.org/gerrit/46106
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index c4d0a60..2ef222b 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -129,6 +129,7 @@
   FILE* f = NULL;
   char buf[4096] = "";
   char *t, *saveptr;
+  const char *delimiters = " \r\n";
 
   /* If the currently running system specifies its debug status, use
    * that in preference to other indicators. */
@@ -138,7 +139,8 @@
       buf[0] = 0;
     fclose(f);
   }
-  for (t = strtok_r(buf, " ", &saveptr); t; t=strtok_r(NULL, " ", &saveptr)) {
+  for (t = strtok_r(buf, delimiters, &saveptr); t;
+       t = strtok_r(NULL, delimiters, &saveptr)) {
     if (0 == strcmp(t, "cros_debug"))
       return 1;
     else if (0 == strcmp(t, "cros_nodebug"))