openpam_readword.c (236099) | openpam_readword.c (247809) |
---|---|
1/*- 2 * Copyright (c) 2012 Dag-Erling Sm��rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 72 unchanged lines hidden (view full) --- 81 while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { 82 if (ch == '\\' && !escape && quote != '\'') { 83 /* escape next character */ 84 escape = ch; 85 } else if ((ch == '\'' || ch == '"') && !quote && !escape) { 86 /* begin quote */ 87 quote = ch; 88 /* edge case: empty quoted string */ | 1/*- 2 * Copyright (c) 2012 Dag-Erling Sm��rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 72 unchanged lines hidden (view full) --- 81 while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { 82 if (ch == '\\' && !escape && quote != '\'') { 83 /* escape next character */ 84 escape = ch; 85 } else if ((ch == '\'' || ch == '"') && !quote && !escape) { 86 /* begin quote */ 87 quote = ch; 88 /* edge case: empty quoted string */ |
89 if (word == NULL && (word = malloc(1)) == NULL) { 90 openpam_log(PAM_LOG_ERROR, "malloc(): %m"); 91 errno = ENOMEM; | 89 if (openpam_straddch(&word, &size, &len, 0) != 0) |
92 return (NULL); | 90 return (NULL); |
93 } 94 *word = '\0'; 95 size = 1; | |
96 } else if (ch == quote && !escape) { 97 /* end quote */ 98 quote = 0; 99 } else if (ch == '\n' && escape && quote != '\'') { 100 /* line continuation */ 101 escape = 0; 102 } else { 103 if (escape && quote && ch != '\\' && ch != quote && --- 104 unchanged lines hidden --- | 91 } else if (ch == quote && !escape) { 92 /* end quote */ 93 quote = 0; 94 } else if (ch == '\n' && escape && quote != '\'') { 95 /* line continuation */ 96 escape = 0; 97 } else { 98 if (escape && quote && ch != '\\' && ch != quote && --- 104 unchanged lines hidden --- |